Compare commits

...

1758 Commits

Author SHA1 Message Date
yellows8
70ea18a477
ldn: Added *ActionFrame, ldnSetHomeChannel, *TxPower. 2025-06-30 15:48:05 -04:00
MasaGratoR
18002c9735
Update SetSysEdid to include different types of Extension blocks (#677) 2025-06-25 09:08:53 +01:00
ITotalJustice
f094767faf
add usbDsGetSpeed and missing speed enum entries. (#676) 2025-06-25 07:44:46 +01:00
yellows8
1ff513dc17
ldn: Updated docs. 2025-06-24 12:54:32 -04:00
Dave Murphy
2680749e8c
ensure libs rebuilt on code changes 2025-06-24 16:05:12 +01:00
yellows8
dfee0c8ba2
ldn: Added ldnSetProtocol. 2025-06-18 18:17:05 -04:00
Dave Murphy
0a4ac1b87c
remove unused dist-bin target 2025-06-12 16:06:29 +01:00
Dave Murphy
638624cf02
actually install libs too. Closes #681 2025-06-12 08:40:44 +01:00
Dave Murphy
2f471a1c26
remove unused version number in Makefile (#679)
* remove unused version number in Makefile
* add dist-src target using git tag
2025-06-10 18:01:55 +01:00
ndeadly
d1dbd8db51 btdrv: fix struct alignment issue in BtdrvBleEventInfo 2025-06-09 21:26:36 +02:00
XorTroll
de7cfeb3d9
nfp: Improve types and enums 2025-05-18 01:09:53 +02:00
ndeadly
2fc81d8f35 btdrv: label proto_mode field in data_report event info 2025-05-18 01:08:51 +02:00
Luis Scheurenbrand
29f6f4fa7a update capsdc for 18.0.0 2025-05-07 23:19:48 +02:00
ndeadly
b88afc509c btmsys: add missing 13.0.0 commands 2025-05-07 23:19:05 +02:00
ndeadly
ceb7ee1cbf set: update SetSysBluetoothDevicesSettings with new fields found in recent firmwares 2025-05-07 23:18:38 +02:00
ndeadly
0ba4f96bfe btdrv: document timeout parameter to btdrvTriggerConnection 2025-05-07 23:18:16 +02:00
Michael Scire
17bcd07095 fsp-pr: update RegisterProgram for 20.0.0 change 2025-05-07 23:17:19 +02:00
Michael Scire
ce6bc0c3e8 ldr/fsldr: update for 20.0.0 2025-05-07 23:17:19 +02:00
Michael Scire
8f1cce6946 libnx: fix compilation with gcc15 2025-05-07 21:09:09 +02:00
ndeadly
60bf943ec1 btdrv: complete definition of BtdrvBleAdvertisePacketData struct and add supporting enums 2025-01-26 18:57:17 +01:00
ndeadly
0ae0792770 btdrv: update gatt server event names to better reflect usage 2025-01-26 18:57:17 +01:00
ndeadly
953c1b7a8a btdrv: fixed swapped permissions and property parameters for btdrvAddGattCharacteristic function 2025-01-26 18:57:17 +01:00
ndeadly
5da574f852 btdrv: add notes about broken gatt server function implementations 2025-01-26 18:57:17 +01:00
ndeadly
b2d7022e1b btdrv: change argument from service id to server interface for gatt server functions 2025-01-26 18:57:17 +01:00
ndeadly
29a6691b66 hidsys: add commands for setting/checking state of joycons attached via rails 2025-01-26 18:56:58 +01:00
averne
88de3cbea7 nvfence: expose nvhost-ctrl fd 2025-01-25 18:10:36 +01:00
averne
218e3f3a04 nvchannel: fix submit ioctl 2025-01-25 18:10:22 +01:00
MasaGratoR
a063ceb19c Fix wrong names in SetSysModeLine 2024-12-08 20:48:22 +01:00
MasaGratoR
e79dd7ac52
Update setsysEdid struct (#654) 2024-11-26 21:34:21 +01:00
Dave Murphy
2e2b110668
use nproc for max jobs on github workflow (#652) 2024-11-25 00:55:17 +00:00
yellows8
432b4e3900
hid: Use the Npad-revision for 18.0.0+. 2024-11-24 19:34:53 -05:00
ndeadly
eef44aa5e1
btm: add audio profile (#650)
Co-authored-by: ndeadly <24677491+ndeadly@users.noreply.github.com>
2024-11-25 00:31:32 +01:00
yellows8
688e4dd14e
hiddbg: Fixed crash when accessing Hdls tmem. Closes #653. 2024-11-24 16:46:45 -05:00
yellows8
d4f5f4b145
audctl: Updated sysver checks. 2024-11-24 16:19:59 -05:00
yellows8
6c430b273a
capsc: Pass CapsApplicationId/u64 for input as required by sysver. 2024-11-24 15:48:35 -05:00
Michael Scire
58f1fc6561 caps: add fields to AlbumFileId, simplify old invoke 2024-11-24 21:44:07 +01:00
Michael Scire
65c643f149 capsc: account for new command sizes 2024-11-24 21:44:07 +01:00
Michael Scire
73d79d4a0f fs: add GetContentStorageInfoIndex 2024-11-24 21:44:07 +01:00
Michael Scire
163fdddabf fs: add new outsize parameter to fsDeviceOperatorGetGameCardDeviceCertificate 2024-11-24 21:44:07 +01:00
Michael Scire
c7c9617290 switch.ld: fix absolute addressing, incompatible with relr relocations 2024-11-24 21:44:07 +01:00
Michael Scire
250a5777f7 ldr:pm: Update ProgramInfo 2024-11-24 21:44:07 +01:00
Michael Scire
5d5d13c9d6 svc: WaitIfEqual64 is value 3 2024-11-24 21:44:07 +01:00
Michael Scire
2bbf49377e svc: add new info type 2024-11-24 21:44:07 +01:00
Michael Scire
81bed00b5b svc: update WaitForAddress 2024-11-24 21:44:07 +01:00
fincs
8cff58d5af
dynamic: add support for ELF packed relocations (relr) 2024-08-31 00:40:56 +02:00
Irne Racoonovich
d66e3aa487 spl: add missing service header 2024-08-29 21:14:38 +02:00
fincs
7b4e02be35
nwindowReleaseBuffers: cancel dequeued buffer instead of failing 2024-08-19 17:43:51 +02:00
ndeadly
3c851a3443
bt: fill in unknowns and update function parameters to match their btdrv counterparts (#644) 2024-06-28 13:48:22 +01:00
ndeadly
df0508200b
Add missing hid shared memory structures and accessor functions for system buttons (#647)
* hid: add missing shared memory format structures
* hid: add functions for getting the state of the home, sleep and capture buttons from shmem
2024-06-28 13:48:02 +01:00
Dave Murphy
c769852631
update Makefile version 2024-05-31 17:28:15 +01:00
Dave Murphy
e8341a00fe
4.7.0 changelog 2024-05-31 17:22:52 +01:00
Dave Murphy
e570e67704
add changelog for 4.6.0 2024-05-31 17:20:52 +01:00
Michael Scire
bb65fec6eb hidsys: use hosversionBetween 2024-05-30 21:41:06 +02:00
Michael Scire
510d85bf48 hidsys: add version checking to removed commands 2024-05-30 21:41:06 +02:00
Michael Scire
ff2e76daf9 ns: Add version checking for ns:dev commands 2024-05-30 21:41:06 +02:00
Michael Scire
c8c4406467 svc: Add new InfoTypes 2024-05-30 21:41:06 +02:00
Pablo Curiel
b69d2fa95e fs: add GetFileSystemAttribute cmd 2024-05-07 14:58:51 -04:00
averne
919e3d3938 Update for review 2024-02-04 00:57:09 +01:00
averne
b615b01d44 nvchannel: Implement GET_CLK_RATE and SET_SUBMIT_TIMEOUT 2024-02-04 00:57:09 +01:00
averne
be45a91b9c nvchannel: Fix SET_CLK_RATE 2024-02-04 00:57:09 +01:00
Rambo6Glaz
827c6b6ddf Implement IFSDeviceOperator "ChallengeCardExistence" and "GetGameCardDeviceCertificate" 2024-02-04 00:56:19 +01:00
MasaGratoR
ce1f87050d Update SetSysProductModel_Aula comment 2024-02-04 00:11:36 +01:00
Dave Murphy
99edb1c0f0
libnx 4.6.0 2023-12-17 20:21:05 +00:00
ThisALV
7d68ad6bd4
fix: avoid segfault at static dtors (#638) 2023-12-17 14:15:33 +00:00
ITotalJustice
fda4e6b105
add fsDeviceOperatorGetGameCardUpdatePartitionInfo (#635) 2023-11-23 20:46:29 +01:00
yellows8
8d10ef8745
nv: Added __nx_nv_service_type. Closes #633. 2023-11-20 14:12:52 -05:00
Ghabry
a215ae2da2 Add NX_ prefix to PACKED, NORETURN, IGNORE_ARG and DEPRECATED macros 2023-11-20 19:22:12 +01:00
Michael Scire
933c5a12f0 svc: fix query/insecure names 2023-11-01 19:06:56 +01:00
fincs
bb0ae8ac74
libnx v4.5.0 2023-10-27 23:48:15 +02:00
fincs
1bb5a21453
socket: automatically detect and use latest bsdsockets version (fix #551) 2023-10-27 23:46:40 +02:00
yellows8
9439b39631
ssl: Updated sslConnectionSetPrivateOption for 17.0.0. 2023-10-26 14:47:07 -04:00
SciresM
386118d16b
fs: add commands needed for 17.x SubmitFsInfo (#629) 2023-10-26 17:35:37 +02:00
Michael Scire
08373603f7 sf: fix service macro C++ compat 2023-10-25 20:30:24 +02:00
ndeadly
412c48eab5 btdrv: add missing ble definitions
(cherry picked from commit f60935fcc2afc82f20a921284a520dab9c61caab)
2023-10-25 19:21:12 +02:00
liamadvance
0094af6d29 crypto: fix aes-cbc individual block decryption 2023-10-21 21:20:57 +02:00
p-sam
ae491ce57b Add GetPossibleClockRates method for pcv and clkrst 2023-10-21 16:55:34 +02:00
yellows8
94cfa2be1c
ns: Added nsEstimateSizeToMove. 2023-10-20 18:53:41 -04:00
fincs
4ff1c52869 crt0/dynamic: refactoring + add support for reprotecting relro segment 2023-10-21 00:18:04 +02:00
fincs
3a5d0dae35 Linker script refactoring, see details:
- Added separate relro "segment" (introduced by [17.0.0+])
- Reordered sections to better reflect official layout
- Fixed handling of TLS segment alignment
2023-10-21 00:18:04 +02:00
Michael Scire
288a09c4eb uart: use hosversionBetween when possible 2023-10-21 00:18:04 +02:00
Michael Scire
3bb619f46e restrict gpio/uart commands on 17.0.0 2023-10-21 00:18:04 +02:00
Michael Scire
3cb556acb3 ts: update for 17.0.0 2023-10-21 00:18:04 +02:00
Michael Scire
140400d566 svc: add PermissionLocked attribute 2023-10-21 00:18:04 +02:00
Michael Scire
6f9bc920c9 add capsdcShrinkJpeg 2023-10-21 00:18:04 +02:00
Michael Scire
e322bdf82d fs: fix GetProgramId 2023-10-21 00:18:04 +02:00
Michael Scire
e6626a7825 fsldr: update OpenCodeFileSystem for 17.0.0 2023-10-21 00:18:04 +02:00
Michael Scire
25a8f21796 ncm/fs: add new 17.0.0 commands 2023-10-21 00:18:04 +02:00
Michael Scire
cb6f366a2a add static_assert to fs macros 2023-10-12 01:29:03 +02:00
Michael Scire
edc000928b service: Static assert arguments aren't pointers to prevent failure-to-deref 2023-10-12 01:29:03 +02:00
Narr the Reg
4fcdb6eb34 service: hidsys: Implement functions needed by QLaunch 2023-08-12 16:51:58 +02:00
german77
e2424fd8bf service: pctl: Implement functions used by Qlaunch 2023-08-09 18:10:59 +02:00
Narr the Reg
af5072c096 service: nfc: add mifare guard 2023-07-04 23:16:56 +02:00
german77
6bd6fa8907 service: nfc: Implement all interfaces and function calls 2023-06-14 20:40:43 +02:00
Dave Murphy
b954aaf35d
dereference pointer. Closes #612 2023-06-07 16:16:37 +01:00
Dave Murphy
8ce306b9b6
4.4.2 release 2023-05-27 15:24:25 +01:00
Dave Murphy
2e80cf9bba quote timezone to allow +/- & alphanumerics 2023-05-27 16:16:37 +02:00
Dave Murphy
95f973fe98 ensure correct address for __bss_start__ 2023-05-27 16:16:31 +02:00
Dave Murphy
6602c440b4
end compile_commmands generation when elf linked 2023-05-27 10:25:44 +01:00
Dave Murphy
99a29b97ca
ignore more generated files 2023-05-27 10:18:45 +01:00
Dave Murphy
dc0de47eb1
libnx 4.4.1 2023-05-07 22:13:45 +01:00
Dave Murphy
77c2d18046 add missing separator to local path 2023-05-07 18:09:12 +02:00
Dave Murphy
a6686ae27a
libnx 4.4.0 2023-05-07 03:18:32 +01:00
Dave Murphy
8747689be1
gcc 13 fixes (#610) 2023-05-07 03:04:58 +01:00
MasaGratoR
d219884bfa
tmem: Add tmemCloseHandle(), tmemWaitForPermission(), use those functions in nv.c to fix a race condition (#606) 2023-04-14 18:33:16 +02:00
Liam
db592d8aeb usbcomms: expose VID:PID configuration 2023-04-08 17:24:53 +02:00
Liam
9d1fd27b62 usbcomms: add async API 2023-04-08 17:24:53 +02:00
Liam
2e2284109b applet: add appletGetMessageEvent 2023-04-08 17:22:26 +02:00
Dave Murphy
dca4fb772a
Changelog for 4.3.0 2023-04-02 19:19:41 +01:00
Dave Murphy
cbb49e2ce0
libnx v4.3.0 2023-04-02 16:57:13 +01:00
Vinogradov Daniil
4c0991dd88
Added CMSG macros to /sys/socket.h (#605) 2023-04-02 16:43:42 +01:00
Michael Theall
ab2c2fb256 Avoid long connection hang in nxlink 2023-04-02 16:37:05 +02:00
yellows8
c09a21d87d
socket: Fix building without bsd-headers. 2023-03-10 12:30:55 -05:00
yellows8
3332ee2f6f
ssl: minor fix 2023-03-09 23:15:22 -05:00
yellows8
f64d2059c4
ssl: Add support for the new 16.0.0 functionality. 2023-03-09 23:14:40 -05:00
yellows8
8d9959010f
ssl: Updated SslCaCertificateId. 2023-03-09 01:30:45 -05:00
yellows8
f7af27cd21
ssl: Add ssl:s support and sslClearTls12FallbackFlag. 2023-03-09 01:09:21 -05:00
yellows8
c3e110988a
pdm: Updated/fixed sysver compat, updated structs. 2023-03-08 16:31:44 -05:00
yellows8
4ece4e5b8f
pl: Add 16.0.0 sysver checks, etc. 2023-03-07 18:35:32 -05:00
Michael Scire
ee873e34d0 vi: Add 16.x Manager commands
vi: fix duplicate decl of Indirect service

vi: fix style

vi: use s32 over int

vi: fix argument names for FatalDrawRectangle
2023-03-07 23:36:02 +01:00
Michael Scire
b5e47b6b67 fs: update bindings for 16.0.0 changes
fs: add new ContentAttributes enum

fs: add version check

fs: use hosversionBetween
2023-03-07 23:36:02 +01:00
Michael Scire
6175293d0f ncm: Add ActivateFsContentStorage
ncm: update bindings for 16.0.0 changes

ncm: fix missing rename on GetPatchContentMetaId

ncm: they broke serialization ordering by changing type alignment

ncm: remove alignment on content id/placeholder id
2023-03-07 23:36:02 +01:00
averne
ada230a882 audctl: add GetActiveOutputTarget 2023-02-04 16:45:15 +01:00
averne
4d59d366a1 auddev: add GetActiveAudioDeviceName 2023-02-04 16:45:15 +01:00
ndeadly
dcebe96e71
hiddbg: modify hiddbgAttachHdlsWorkBuffer to accept a user-supplied buffer and size (#601)
Co-authored-by: ndeadly <24677491+ndeadly@users.noreply.github.com>
2023-02-02 00:20:48 +01:00
yellows8
174b5066a5
usbhs: Use an user-specified buffer for tmem, etc. 2023-02-01 14:00:33 -05:00
yellows8
7549d3b124
usbhs: Expose the id param, and update a struct. 2023-02-01 13:16:32 -05:00
yellows8
e768ac74f9
usbhs: Added the remaining cmds and expose more functionality, etc. 2023-01-31 21:32:45 -05:00
averne
6ee5d8d148 audctl: fix TargetVolume functions 2023-01-31 21:06:01 -05:00
Pablo Curiel
7caf74af76
Update ncm_types to 15.0.0. (#597) 2022-12-06 12:45:23 +01:00
yellows8
3b2d72a427
error: Add note for errorApplicationCreate. 2022-11-02 22:56:30 -04:00
yellows8
75290f912e
applet: Updated for 15.0.0. Various fixes and added __nx_applet_init_timeout. 2022-11-01 14:27:32 -04:00
yellows8
cea3018de6
result: Add LibnxError_Timeout. 2022-11-01 14:24:22 -04:00
yellows8
5ca15e7696
wlaninf: Add sysver check since this was removed in 15.0.0. 2022-10-22 16:30:42 -04:00
Michael Scire
09338f80b2 bpc: fix GetSleepButtonState/GetPowerButton 2022-10-21 23:51:40 +02:00
fincs
c4c9a6af3c
libnx v4.2.2 2022-10-16 19:39:20 +02:00
yellows8
ac414d2bc5
pdm: Updated sysver checks for 15.0.0. 2022-10-16 12:45:58 -04:00
yellows8
ea145a8d3c
setsys: Updated sysver check for setsysNeedsToUpdateHeadphoneVolume. 2022-10-16 12:45:58 -04:00
fincs
8b77139a04
env: Add support for svc 0x80..0xBF hinting 2022-10-12 19:42:37 +02:00
Michael Scire
de4d19df1a MapDeviceAddressSpace svcs now take option, not perm 2022-10-12 09:03:04 -07:00
Michael Scire
1543e84627 svc: add MapInsecureMemory/UnmapInsecureMemory 2022-10-11 20:18:30 -07:00
yellows8
328d041c5c
swkbd: Fixed height value in swkbdInlineGetTouchRectangles. 2022-10-06 15:22:47 -04:00
averne
1a05cb20a2 Fix typos in swkbd.h 2022-10-06 19:49:54 +02:00
averne
97fef5e48d Fix calculation of the inline swkbd touch rectangle 2022-10-06 19:49:54 +02:00
notaz
d8a4f33192 cache: need an isb barrier on icache invalidate
I don't have a switch but on r-pi4 it's easy to reproduce problems
without this Instruction Synchronization Barrier. Better be safe than
having "fun" dealing with super rare crashes.
2022-08-02 23:06:52 +02:00
averne
8b17648d0b nv: Implement ioctl GET_GPU_TIME 2022-07-02 16:02:01 +02:00
Michael Scire
62755bebe0 svc: fix wrong ids for (Un)MapIoRegion 2022-06-27 17:34:41 +02:00
yellows8
bb42eab289
nifm: Added nifmSetWowlDelayedWakeTime. 2022-06-06 01:50:33 -04:00
yellows8
d33bb0ad6a
nifm/socket: Add nifmRequest sleep/register-socket cmds. 2022-05-31 20:09:26 -04:00
fincs
3a508e13b1
libnx v4.2.1 2022-05-22 16:36:06 +02:00
Dave Murphy
d14f931eab payload can never be NULL 2022-05-02 23:12:56 +01:00
Dave Murphy
bf50bfdbbe disable array bounds checking for __tls_start 2022-05-02 23:11:24 +01:00
yellows8
9865dbf921
btdrv: Updated sysver check for removed cmds in 14.x. 2022-04-07 22:12:26 -04:00
MasaGratoR
a1d6b3be43
ts: Update tsGetTemperatureMilliC (#588)
* ts: Update tsGetTemperatureMilliC for 14.0.0
2022-04-07 21:47:04 -04:00
Michael Scire
d42ddeff78 bpc: add 6.0.0 bpcGetPowerButton, update accessible-firmware comments. 2022-04-07 21:43:32 -04:00
Michael Scire
cdba7dc808 pm: update for 14.0.0 2022-04-07 21:43:32 -04:00
Michael Scire
f9a27d6cc7 svc: add new info type 2022-04-07 21:43:32 -04:00
Michael Scire
f60f82856a cache: set flag in tlr when doing maintenance 2022-04-07 21:43:32 -04:00
yellows8
0a88426a6a
svc: ret for svcCallSecureMonitor is void. 2022-03-06 14:00:40 -05:00
Morph
e6c7ac7c0b fs: Add fsOpenSaveDataInfoReaderWithFilter 2022-03-06 19:20:40 +01:00
yellows8
04aa28c436
nv: Added nvIoctl3, updated _nvGetSessionForRequest, and:
* Check hosver in nvIoctl2.
2022-02-26 12:54:26 -05:00
averne
3d9e1a9c7b Fix MemoryInfo field order 2022-01-29 16:38:34 +01:00
Michael Theall
6d8d9fd2fc Don't apply bold/faint to bg console 2022-01-08 01:07:56 +01:00
yellows8
32370bd19c
fs: Added fsCreate_TemporaryStorage + fixed fsOpen_TemporaryStorage. 2022-01-06 12:20:19 -05:00
yellows8
587115f10a
btm: Fixed backwards sysver check in _btmCmdGetEventOutFlag. 2021-12-09 01:02:47 -05:00
yellows8
4a33b32f43
nfc: Added more cmds, etc. 2021-12-09 01:01:32 -05:00
fincs
74c639ec3a
random.c: Avoid UB type punning that results in miscompilation 2021-12-05 19:31:42 +01:00
Michael Theall
16f8547f4c Add support for SGR 38 and 48
This supports the escape sequences used by fmtlib
2021-11-10 20:38:30 +01:00
yellows8
c208dd0a57
hid: Added the new controllers to HidDeviceType. 2021-11-01 18:15:11 -04:00
fincs
431c99465c
switch.ld: Merge .crt0 into .text 2021-11-01 01:34:06 +01:00
yellows8
93db7abb03
hid: Updated various enums/etc, + support for new controllers. 2021-10-27 16:27:32 -04:00
yellows8
65b8ed5582
Added BITL. 2021-10-27 16:23:56 -04:00
ndeadly
cee75bbe13 hidsys: add some missing unique pad service wrappers 2021-10-04 21:35:15 +02:00
fincs
748cf5ab98
libnx v4.2.0 2021-10-02 16:57:22 +02:00
yellows8
c6dcbdfffb
btm: Updated structs/params for 13.0.0. 2021-09-25 11:01:30 -04:00
ndeadly
b5714296d6 setsys: update SetSysBluetoothDevicesSettings for 13.0.0 2021-09-24 22:59:54 +02:00
yellows8
8db41edc43
psel: Added pselShowUserQualificationPromoter for 13.0.0. 2021-09-24 11:56:15 -04:00
ndeadly
bf2e48e22a
btm: update GetDeviceCondition and GetDeviceInfo service wrappers and related types for 13.0.0 (#576) 2021-09-24 17:35:11 +02:00
p-sam
b35d42faaa hiddbg: fix IsHdlsVirtualDeviceAttached for 13.0.0 2021-09-22 17:32:38 +02:00
yellows8
0cc2da720c
setsys: Updated SetSysNxControllerSettings. 2021-09-19 16:14:17 -04:00
Michael Scire
8daccdf35a ncm: add new 13.0.0 commands 2021-09-18 21:55:14 +02:00
Michael Scire
49507b86a8 svc: add 13.0.0 svc changes 2021-09-18 12:34:58 +02:00
yellows8
369bb31311
btdrv: Added 13.0.0 cmds + minor improvements. 2021-09-18 00:31:53 -04:00
yellows8
0a64ff5af0
setsys: 13.0.0 support 2021-09-17 16:02:49 -04:00
yellows8
4ac0a9ffdc
hidsys: use hosversionBetween 2021-09-17 11:48:09 -04:00
yellows8
8e93933157
hiddbg: hdls 13.0.0 support 2021-09-17 11:23:11 -04:00
yellows8
4ac3b0cec5
hidsys: Check sysver for the removed cmds with 13.0.0. 2021-09-17 01:50:31 -04:00
Sean Maas
960599c4b5 btdrv: fix btdrvRespondToSspRequest for 12.0.0 2021-09-15 12:19:30 -04:00
XorTroll
ade5038282 Fix ldr:ro/ro:1 initialization 2021-09-15 12:18:18 -04:00
fincs
fc2aaefb0f
framebufferCreate: actually set NWindow dimensions (fix #568) 2021-09-13 19:01:34 +02:00
Michael Scire
d90afaacde thread: set arguments/fields before CreateThread 2021-07-20 18:13:10 +02:00
fincs
bee27ba607
libnx v4.1.3 2021-06-25 19:27:05 +02:00
Vicki Pfau
0aba35b3ed Fix inet_pton by passing in base instead of getting it out (#557) 2021-06-24 22:59:28 +02:00
fincs
3c9a623b24
switch.specs: ensure main() is referenced first (fix devkitPro/pacman-packages#237) 2021-06-22 19:45:06 +02:00
fincs
982aef9ea5
sessionmgr: fix deadlock with multiple waiters (fix #556) 2021-06-20 12:39:42 +02:00
fincs
b17873d071
libnx v4.1.0 2021-06-12 16:34:48 +02:00
fincs
cfdd847f11
Add doxygen generation workflow on tag 2021-06-11 17:52:16 +02:00
Dave Murphy
84b92d9e64
use correct badge for github workflow (#555) 2021-06-10 19:47:45 +02:00
ndeadly
373b13b7c0 btm: add BtmDeviceCondition definitions
(cherry picked from commit a598dca0e1d8cb4c4f3c053494048832c05a79ed)
(cherry picked from commit 9736386850dc4b987b095a43eceefc469996b2fa)
2021-06-09 21:32:47 +02:00
ndeadly
58885db2cd btdrv: update bluetooth hid connection event info for 12.0.0 2021-06-02 17:56:55 +02:00
ndeadly
8c8bd9debf btdrv: add bluetooth event info definition for connection event on fw < 9.0.0
(cherry picked from commit 1e7abd975fc906d1a483b33fa86969cb15e93ece)
2021-06-02 17:56:55 +02:00
fincs
4a850437f2
audctl/audrec: fixup 2021-05-31 17:43:02 +02:00
plutoo
5421d1d716 audrec: Fix typo 2021-05-30 17:54:26 -07:00
plutoo
5d95e17f9b switch: Fix documentation comments 2021-05-30 17:53:33 -07:00
plutoo
4b2d111859 audctl: Fix prefix on enum 2021-05-30 17:46:49 -07:00
plutoo
f893c043f7 switch: Add audrec/audctl to default header 2021-05-30 17:33:39 -07:00
plutoo
6ce881b013 audrec: Initial commit 2021-05-30 17:33:26 -07:00
plutoo
a1ddefd3ca audctl: Initial commit 2021-05-30 17:33:11 -07:00
yellows8
f486127615
Bluetooth pr rebased (#552 and #540)
* btdrv: expand upon and refine event data definitions

* btdrv changes for 12.0.0

* btdrv: Various fixes, added enums, etc.

Co-authored-by: ndeadly <24677491+ndeadly@users.noreply.github.com>
2021-05-30 13:47:36 -04:00
Dave Murphy
5d448a1048 remove broken doozer builds 2021-05-24 19:28:05 +01:00
fincs
f47e1d26ec
Remove obsolete reference to 3dmoo carried over from libctru 2021-05-21 23:03:54 +02:00
Pablo Curiel
e604350e9c
crc: allow checksum calculation in blocks. (#550) 2021-05-21 00:07:35 +02:00
Dave Murphy
4bd7863364 add github workflow building 2021-05-20 08:27:51 +01:00
Morph
08e2b2d945
swkbd: Fix several swkbd enums and structs (#549)
* swkbd: Provide more accurate SwkbdInline State descriptions

* swkbd: Correct stringLenMaxExt to stringLenMin

* swkbd: Add setters for stringLenMax/Min in SwkbdAppearArg
2021-05-10 18:16:40 +02:00
Narr the Reg
e2c3ae8e44 hid: Correct some gesture errors
I recently did some RE on touch gestures with the help of a nro I made. I have found that those values where incorrect.
2021-05-04 17:34:34 +02:00
fincs
95fca6753d
virtmem: Allow rng algorithm override 2021-05-02 18:26:40 +02:00
fincs
137f6d1ddc
Make argvSetup overridable 2021-05-02 15:18:11 +02:00
TurtleP
00d1a696b9 add audrvVoiceIsPaused 2021-04-26 20:33:10 +02:00
Pablo Curiel
d6c6431a22
Fix unused parameter warnings in tipc.h when -Wextra is used. (#545)
Removes unused TipcService parameter in tipcMakeRequest and tipcParseResponse.
2021-04-20 20:43:50 +02:00
Michael Scire
f7df9d578c pgl: fix argument order for LaunchProgram on 12.x 2021-04-20 17:38:31 +02:00
yellows8
5509f8f14b
hiddbg: Fix IPC params from the previous commit, closes #543. 2021-04-19 10:33:03 -04:00
yellows8
d54c9f9cc8
hiddbg: hdls 12.0.0 support, closes #542. 2021-04-18 18:35:36 -04:00
averne
5d644b6e82 Fix mm:u on 1.0.0 2021-04-18 19:20:02 +02:00
yellows8
2e2cf43cf5
btdrv: Added support for the new 12.0.0 cmds. 2021-04-16 16:46:45 -04:00
fincs
0d32a2c0d5
sm: docufix 2021-04-11 14:07:42 +02:00
Michael Scire
d6a1ef0af4
pgl: convert to cmif/tipc polyglot 2021-04-11 12:20:08 +02:00
Michael Scire
eb8ee97f1c
smm: support tipc/cmif 2021-04-11 12:20:08 +02:00
fincs
7416b23ef9
sm: update for 12.0.0, tipc 2021-04-11 12:20:07 +02:00
Michael Scire
ebb54a1224
tipc: add cmif-like wrapper 2021-04-11 12:20:06 +02:00
fincs
de97b82bce
envSetup: detect Atmosphère environment using EntryType_HosVersion 2021-04-11 12:20:06 +02:00
Jeremy S. Postelnek
ca9d007bd4
friends: ability to get Friend Code (#539) 2021-04-10 23:14:24 +02:00
Jeremy S. Postelnek
c5a9a909a9
set:sys: add ProductModel enums (#538) 2021-04-02 19:34:40 +02:00
Vicki Pfau
7e29719263 psm: Fix charger definitions 2021-03-30 17:40:05 +02:00
SciresM
f365c9b2b5
htcs: implement hipc bindings (#530) 2021-03-16 23:42:50 +01:00
averne
05744823ac Const request 2021-03-07 19:59:46 +01:00
averne
3374db38a2 Add mm:u service wrappers 2021-03-07 19:59:46 +01:00
averne
3bb44d77b7 Fix nvioctlChannel_Submit syncpt writeback 2021-03-07 19:59:46 +01:00
averne
0716ed6ffd
Add some nvchannel ioctls (#534) 2021-02-28 21:17:57 +01:00
Michael Scire
ae6f69d339 bsd: fix bsdRegisterClient 2021-02-26 17:43:20 +01:00
Michael Scire
c8f8145195 bsd: allow user-specified tmem backing buffer 2021-02-24 17:41:52 +01:00
Michael Scire
38ee48032f sf: add serialization fixes necessary for htcs 2021-02-20 13:16:10 +01:00
yellows8
d4542ec9b0
hiddbg: Added support for SleepButton AutoPilot. 2021-02-13 14:20:44 -05:00
Michael Scire
ae3271ba4c fs: add fsOpenHostFileSystem(WithOption) 2021-02-13 16:46:49 +01:00
yellows8
0f4f0ed039
btdrv: Updated BtdrvFatalReason. 2021-02-12 13:11:57 -05:00
yellows8
3fce0d49e2
time: Fixed signedness issue with time calculation, closes #522. 2021-02-12 12:33:24 -05:00
Michael Scire
c71cd80bcf psc: fix dependency argument on init 2021-02-10 17:31:51 +01:00
yellows8
15a5d1c44f
btdrv: Updated params/docs for btdrvSetBleVisibility. 2021-02-04 11:47:50 -05:00
yellows8
531f9d7921
Updated/added bluetooth structs/enums. Updated docs.
Moved btm types into a dedicated .h.
2021-02-03 14:02:38 -05:00
yellows8
7751df9356
btdrv: Updated param names + docs. 2021-02-02 15:51:31 -05:00
SciresM
e48f1c339f
add hosversionIsAtmosphere (#525) 2021-01-27 23:20:41 +01:00
fincs
076657fd31
Allow user override of dynamic memory allocation functions throughout libnx 2021-01-22 18:37:46 +01:00
yellows8
d813bef54b
btdrv: Added/updated structs/enums for events, etc. 2021-01-19 20:02:01 -05:00
fincs
5057a1912e
nv: Allow user override of transfer memory creation 2021-01-18 20:46:50 +01:00
fincs
d53150f855
thread: Allow user override of automatic stack memory allocation 2021-01-17 17:48:08 +01:00
fincs
109bd683df
hid: Add HidKeyboardKey & hidKeyboardStateGetKey 2021-01-17 17:45:48 +01:00
fincs
649f308d4b
Delete old virtmem API 🦀🦀 2021-01-17 17:05:29 +01:00
fincs
637dd12b2d
Delete old HID API 🦀🦀 2021-01-17 17:05:21 +01:00
yellows8
c8fdae9189
btdrv: Updated/added structs/enums for events, etc. 2021-01-16 13:34:12 -05:00
Luis Scheurenbrand
9e52e55177 avm: fix buffer size for version list import 2021-01-06 20:53:52 +01:00
Luis Scheurenbrand
a1a69ebe09 avm: fix more merge errors 2021-01-06 18:27:12 +01:00
HookedBehemoth
43202cc829
add application version manager service wrapper (#519) 2021-01-06 17:25:29 +01:00
yellows8
110c2f0622
btdrv: Updated docs. 2021-01-05 01:36:29 -05:00
yellows8
348b21def2
btdrv: Updated names for BtdrvHidReportEvent*. 2021-01-03 02:07:17 -05:00
yellows8
2f6fcf7fb2
btdrv: Updated param names/docs. 2020-12-29 20:31:06 -05:00
yellows8
e9ee0b2421
btm/btdrv: Updated param names. 2020-12-29 14:46:10 -05:00
yellows8
a35321b360
hid: Minor Palma improvements. 2020-12-27 00:58:15 -05:00
fincs
73feb933ce
libnx v4.0.0 2020-12-19 17:03:29 +01:00
Tim Gates
8cbd1cf03c docs: fix simple typo, recieve -> receive
There is a small typo in nx/include/switch/runtime/devices/socket.h, nx/include/switch/services/bsd.h.

Should read `receive` rather than `recieve`.
2020-12-19 13:35:29 +01:00
yellows8
3c9e4e2ebc
ns: Use ns:ro if available. 2020-12-17 15:01:46 -05:00
yellows8
d4014bde62
miiLa: Added for support for 10.2.0 functionality + various fixes. 2020-12-17 00:21:47 -05:00
yellows8
0d5dcde5b9
swkbd: Added swkbdInlineGetMiniaturizedHeight. 2020-12-16 20:32:42 -05:00
yellows8
c51918a605
hidLa: 11.0 support and fixed the arg_size value. 2020-12-16 13:24:48 -05:00
yellows8
06d38571b4
libapplet: Added the new 11.0 funcs. 2020-12-15 22:10:58 -05:00
yellows8
55179074cc
web: Added 11.0 webConfigSetTransferMemory(). 2020-12-15 19:22:24 -05:00
Pablo Curiel
41fc8bb17c
fs: Added fsCreateSaveDataFileSystem(), fsDeleteSaveDataFileSystem() and fsDeleteSaveDataFileSystemBySaveDataAttribute(). #518 2020-12-15 17:48:00 +01:00
yellows8
ccec5bd36c
apm/applet: Updated names/docs.
Added AppletWindowOriginMode.
2020-12-15 11:14:35 -05:00
yellows8
d406db725d
applet: Added 11.0 cmds. 2020-12-14 15:32:54 -05:00
yellows8
13716b5e7b
hidsys: Updated ButtonConfig cmds for 11.0.
Removed an extra param from hidsysIsAnyCustomButtonConfigEnabled.
2020-12-12 12:38:13 -05:00
yellows8
c365c1ae68
hid: Minor adjustments. 2020-12-11 15:42:01 -05:00
yellows8
16fb73cc96
hid: Fixed hidKeyboard{Held/Down/Up}. 2020-12-11 15:15:58 -05:00
yellows8
3d003aef39
lp2p: Updated docs. 2020-12-10 23:37:56 -05:00
yellows8
9ede39d15d
lp2p: Updated docs. 2020-12-10 19:44:47 -05:00
fincs
767a7a295c
switch.specs: Disable .interp section, shrink .dynamic section 2020-12-08 21:43:05 +01:00
yellows8
af837185d0
hiddbg: Added HiddbgNpadButton. 2020-12-08 15:24:57 -05:00
masagrator
c3aeb885e7 Fix svcSetHeapSize error in comment section 2020-12-08 12:25:47 +01:00
yellows8
d91a2e22e7
hid: Updated docs. 2020-12-05 01:09:13 -05:00
yellows8
de5e158545
hid: Updated Palma docs. 2020-12-05 00:46:49 -05:00
SciresM
c3b63e8723
svc: add new InfoType_FreeThreadCount (#514) 2020-12-05 03:11:49 +01:00
Michael Theall
1e9fe9b199 usbDsWaitReady: use deadline timeout 2020-12-05 02:42:45 +01:00
HookedBehemoth
f82d97f88a
Add capmtp service wrapper [11.0.0+] (#510) 2020-12-04 21:53:44 +01:00
SciresM
21b0613fa4
usb: add UsbState enum (#512) 2020-12-04 21:13:30 +01:00
yellows8
e8a4f22063
ssl: Updated for 11.0.0. 2020-12-04 13:42:42 -05:00
yellows8
49d7fe81b8
usbds: Fixed usbDsInterface_AppendConfigurationData for 11.0.0. 2020-12-03 23:11:28 -05:00
yellows8
0f38ec8a3d
hidbus: Adjusted out-of-bounds size handling. 2020-12-03 18:03:32 -05:00
SciresM
1291966976
ectx: add ectxrPullContext (#511) 2020-12-03 22:09:06 +01:00
yellows8
0fbbea2c77
lp2p: Updated for [11.0.0+]. 2020-12-03 14:39:55 -05:00
SciresM
2d470ee2af
sm: add smDetachClient (#509) 2020-12-02 17:42:09 +01:00
SciresM
83dc9203dc
usb: update for 11.0.0 (#508) 2020-12-02 17:06:24 +01:00
fincs
ab71d6033a
hid: Read SystemExt/System first in hidScanInput for compatibility with old homebrew 2020-12-01 21:07:03 +01:00
fincs
676f254be1
pad: Fix logic typo 2020-12-01 16:37:01 +01:00
fincs
e904bb05d4
hid: Deprecate old input interface 2020-12-01 13:50:00 +01:00
fincs
d290697bfd
Add pad.h - new wrapper API for reading controller input 2020-12-01 13:50:00 +01:00
yellows8
5551d42b29
hid: Added/updated Palma structs/enums. 2020-12-01 13:50:00 +01:00
yellows8
09bcd32fbc
hid: Updated structs/enums. 2020-12-01 13:50:00 +01:00
yellows8
a45b951db2
hiddbg/hidsys: Updated structs. 2020-12-01 13:50:00 +01:00
yellows8
3a11e1d309
hidbus: Updated structs/enums. 2020-12-01 13:50:00 +01:00
yellows8
5aa8986505
hid: Added support for the Palma cmds. 2020-12-01 13:49:59 +01:00
yellows8
49183c9953
hidsys: Updated the {Home/Sleep/Capture}Button cmds. 2020-12-01 13:49:59 +01:00
yellows8
4010c70b1e
hiddbg: Added support for AutoPilot with the following:
DebugPad, TouchScreen, Mouse, Keyboard.
2020-12-01 13:49:59 +01:00
yellows8
b7e1ec852c
hid: Added DebugPad structs/enums. 2020-12-01 13:49:59 +01:00
yellows8
527b813bcf
notif: Use hidLaShowControllerFirmwareUpdate if needed. 2020-12-01 13:49:59 +01:00
yellows8
baa9dab747
hidsys: Added the following cmds:
hidsysSendKeyboardLockKeyEvent, hidsysGetNpadInterfaceType, hidsysGetNpadLeftRightInterfaceType, hidsysHasBattery, hidsysHasLeftRightBattery, hidsysIsUsbFullKeyControllerEnabled, hidsysEnableUsbFullKeyController, hidsysIsUsbConnected, hidsysIsFirmwareUpdateNeededForNotification.
2020-12-01 13:49:59 +01:00
yellows8
9bc156a42e
hid: Adjusted param for hidSetNpadCaptureButtonAssignment. 2020-12-01 13:49:58 +01:00
yellows8
27b43dc53b
hid: Updated docs. 2020-12-01 13:49:58 +01:00
yellows8
089f9f18ac
hid: Added the following cmds:
hidSendKeyboardLockKeyEvent, hidDisconnectNpad, hidGetPlayerLedPattern, hidSetNpadJoyAssignmentModeSingle, hidStartLrAssignmentMode, hidStopLrAssignmentMode, hidSwapNpadAssignment, hidEnableUnintendedHomeButtonInputProtection, hidSetNpadJoyAssignmentModeSingleWithDestination, hidSetNpadAnalogStickUseCenterClamp, hidSetNpadCaptureButtonAssignment, hidClearNpadCaptureButtonAssignment, hidIsUsbFullKeyControllerEnabled, hidEnableUsbFullKeyController, hidIsUsbFullKeyControllerConnected, hidGetNpadOfHighestBatteryLevel, hidSetNpadCommunicationMode, hidGetNpadCommunicationMode, hidSetTouchScreenConfiguration, hidIsFirmwareUpdateNeededForNotification.
2020-12-01 13:49:58 +01:00
yellows8
004d2f4f63
hid: Moved funcs to match cmd order. 2020-12-01 13:49:58 +01:00
yellows8
d4ccf6ab03
hid: Added the following cmds:
hidIsSixAxisSensorFusionEnabled, hidEnableSixAxisSensorFusion, hidIsSixAxisSensorAtRest, hidIsFirmwareUpdateAvailableForSixAxisSensor.

Minor adjustments.
2020-12-01 13:49:58 +01:00
fincs
eaeabad315
hid: Add hid{Set,Get}NpadHandheldActivationMode 2020-12-01 13:49:58 +01:00
yellows8
639ba8ef78
hidsys: Updated Hidcfg. 2020-12-01 13:49:57 +01:00
yellows8
73768fffa7
hid: Updated docs. 2020-12-01 13:49:57 +01:00
yellows8
d4b3b1e90f
hidbus: Updated HidbusJoyPollingMode. 2020-12-01 13:49:57 +01:00
yellows8
141f1b6e5d
hid: Updated enums. 2020-12-01 13:49:57 +01:00
yellows8
01457fb3b1
hid: Added hidBeginPermitVibrationSession/hidEndPermitVibrationSession. 2020-12-01 13:49:57 +01:00
yellows8
5c7118a003
hid: Added support for GcErm vibration. Minor adjustments. 2020-12-01 13:49:56 +01:00
yellows8
88cae40620
hid: Added/updated enums and updated HidVibrationDeviceInfo. 2020-12-01 13:49:56 +01:00
fincs
8e0c514044
hid: Added pre-made HidNpadStyleSet values for common style sets 2020-12-01 13:49:56 +01:00
yellows8
1aa4ec82fb
hid: Updated docs. 2020-12-01 13:49:56 +01:00
yellows8
a5799c87ed
hid(dbg): Updated docs + minor adjustments. 2020-12-01 13:49:56 +01:00
yellows8
7a8d397d81
hid: Added HidAnalogStickState and updated structs. 2020-12-01 13:49:56 +01:00
yellows8
f784c9a3f3
hid: Updated structs. 2020-12-01 13:49:55 +01:00
yellows8
ff2846e481
hid: Updated docs + minor struct adjustment. 2020-12-01 13:49:55 +01:00
yellows8
9b808793fb
hid: Updated docs + various adjustments. 2020-12-01 13:49:55 +01:00
yellows8
2b7c3fee90
hiddbg: Use structs for handles and various adjustments. 2020-12-01 13:49:55 +01:00
yellows8
215d62966e
hidsys: Added HidsysUniquePadId/HidsysUniquePadSerialNumber.
These are now used where needed. Various adjustments.
2020-12-01 13:49:55 +01:00
yellows8
012e84d7bd
hid: Updated docs. 2020-12-01 13:49:55 +01:00
yellows8
f9f23bef8f
hid: Replaced the lifo layouts/sixaxis arrays with individual fields.
Use the Lark/Lucia enum in the GetNpadStates funcs.
2020-12-01 13:49:54 +01:00
fincs
aa77de9f71
hid: Added HidNpadButton enum 2020-12-01 13:49:54 +01:00
yellows8
3c13d353b0
hid: Updated _hidGetNpadPowerInfo(). 2020-12-01 13:49:54 +01:00
yellows8
9a2fab817d
hid: Fixed docs. 2020-12-01 13:49:54 +01:00
yellows8
7c64b5b70b
hid: Updated HidNpadSystemProperties. 2020-12-01 13:49:54 +01:00
yellows8
912713bda0
hid: Added XcdDeviceHandle. 2020-12-01 13:49:54 +01:00
yellows8
5e03104d1d
hid: Updated structs. 2020-12-01 13:49:53 +01:00
yellows8
dab3750c50
hid: Updated HidMouseButton/HidKeyboardModifier. 2020-12-01 13:49:53 +01:00
yellows8
4149481608
hid: Fix comment. 2020-12-01 13:49:53 +01:00
yellows8
d3838b8e08
hid: Gesture support. Updated HidNpadSystemProperties. 2020-12-01 13:49:53 +01:00
yellows8
324a835b0c
hid: Various fixes. 2020-12-01 13:49:53 +01:00
yellows8
d28776e4d9
hid: Updated/added structs/enums. 2020-12-01 13:49:52 +01:00
yellows8
902af6cce0
hid: Updated structs. 2020-12-01 13:49:52 +01:00
fincs
967a5054a3
hid: Expose InitializeNpad/TouchScreen/Keyboard/Mouse
- Moved hidScanInput-specific initialization code to hidScanInput
- TouchScreen/Keyboard/Mouse are now activated during hidScanInput
  initialization (previously this was not done, which is technically UB)
- Removed hidDeactivateNpad (not called by retail software)
- Tweaks and adjustments to reduce code size when features are not used
2020-12-01 13:49:52 +01:00
yellows8
e4c701dc19
hid: Use _hidGetStates in hidGetSevenSixAxisSensorStates. 2020-12-01 13:49:52 +01:00
yellows8
d4c1d069f1
hid: Added hidGetKeyboardStates, which hidScanInput now uses.
Struct adjustments.
2020-12-01 13:49:52 +01:00
yellows8
52bf73e047
hid: Added hidGetMouseStates, which hidScanInput/etc now uses.
Struct adjustments.
2020-12-01 13:49:52 +01:00
yellows8
dc0bc2ab7b
hid: Fixed memset in hidJoystickRead(). 2020-12-01 13:49:51 +01:00
yellows8
1c82758c03
hid: Added hidGetTouchScreenStates, which hidScanInput now uses.
Struct adjustments.
2020-12-01 13:49:51 +01:00
fincs
2c26092608
hid: Implement hidSixAxisSensorValuesRead using hidGetSixAxisSensorStates + other minor adjustments 2020-12-01 13:49:51 +01:00
yellows8
e32acbeb9f
hid: Added hidGetSixAxisSensorStates.
Internal improvements, etc.
2020-12-01 13:49:51 +01:00
yellows8
16ff35faea
hid: Use structs for vibration/SixAxis handles.
Various internal improvements, andpass vibration handles by value where needed.
2020-12-01 13:49:51 +01:00
fincs
c0ef14fcaa
hid: Changed hidGetNpadStates* to return total_out directly instead of using an output var 2020-12-01 13:49:51 +01:00
fincs
0640c9da76
hid: Introduce HidNpadIdType, see details:
- Replaced most usages of HidControllerID with HidNpadIdType
- HidControllerID still exists for now, and the following functions
  keep accepting it for compatibility with most homebrew:
  - hidIsControllerConnected
  - hidKeysHeld/Down/Up
  - hidJoystickRead
  - hidSixAxisSensorValuesRead
- hidControllerIDTo/FromOfficial renamed to ToNpadIdType/FromNpadIdType
- Updated some comments that were left untouched during previous hid refactoring
- Partial internal refactor of hidGetNpadStates*
2020-12-01 13:49:50 +01:00
fincs
40e5b08f70
Split hidGetNpadControllerColor/PowerInfo into Single/Split variants 2020-12-01 13:49:50 +01:00
yellows8
3f4f6dba44
hid: Handle NULL with hidGetNpadStates*() total_out.
Use const for hidSetSupportedNpadIdType().
2020-12-01 13:49:50 +01:00
yellows8
82bc8bf648
hid: Updated docs. 2020-12-01 13:49:50 +01:00
yellows8
a924fac0ab
hid: Filled in the Gc trigger fields. 2020-12-01 13:49:50 +01:00
yellows8
5aaf6905dd
hid: Docs updated. 2020-12-01 13:49:50 +01:00
yellows8
9f13045546
hid: Added support for NpadGc.
Struct adjustments.
2020-12-01 13:49:49 +01:00
yellows8
7340772267
hid: Internal state reading improvements.
Struct adjustments.
2020-12-01 13:49:49 +01:00
yellows8
21647a76c8
hid: Added support for *Lark/Lucia.
Struct adjustments.
2020-12-01 13:49:49 +01:00
yellows8
ce20e14034
hid: Added hidGetNpadStatesPalma. 2020-12-01 13:49:49 +01:00
yellows8
46377bc180
hid: Added handling for NpadSystem(Ext).
Added hidGetNpadStatesSystemExt/hidGetNpadStatesSystem, and functionality for using these in hidScanInput().

Updated a struct.
2020-12-01 13:49:49 +01:00
yellows8
db39de34c5
hid: Replaced various funcs with versions which read from sharedmem.
* Various struct adjustments.
* Removed HidControllerLayoutType/hidSetControllerLayout/hidGetControllerLayout, since these are no longer used.
* Added HidNpadJoyAssignmentMode and hidGetNpadJoyAssignment.
* Replaced hidGetControllerFlags with hidGetNpadSystemProperties/hidGetNpadSystemButtonProperties.
* Added hidGetAppletFooterUiAttributesSet/hidGetAppletFooterUiTypes.
* hidScanInput() now uses hidGetNpadStates*() as determined by the output from hidGetNpadStyleSet().
2020-12-01 13:49:48 +01:00
yellows8
1e3145f81d
hid: Struct adjustments. 2020-12-01 13:49:48 +01:00
yellows8
54a296bc69
hid: Updated HidSharedMemory. 2020-12-01 13:49:48 +01:00
yellows8
c3a6d29cf4
hid: Added KEY_NES_HANDHELD_LEFT_B. 2020-12-01 13:49:48 +01:00
yellows8
991a262e19
hid: Replaced HidControllerType with HidNpadStyleTag.
HidNpadStyleTag now includes more controllers.

Replaced hidGetControllerType with hidGetNpadStyleSet().

Improved _hidGetDeviceHandles(), more controllers are now supported.
2020-12-01 13:49:48 +01:00
yellows8
e74c605a91
hid: Fixed HidNpadInterfaceType. 2020-12-01 13:49:48 +01:00
yellows8
ddc9538b69
hid: Updated/added structs and added hidGetNpadStates*(). 2020-12-01 13:49:47 +01:00
fincs
74b295827f
Add svcGetResourceLimitPeakValue [11.0.0+] 2020-12-01 13:49:15 +01:00
SciresM
8ce231e7c9
ldr: update SetProgramArguments for 11.0.0 abi change (#507) 2020-12-01 12:01:33 +01:00
Michael Scire
e5ae43f4c2 results: use R_VALUE for comparisons 2020-12-01 02:26:26 +01:00
Luis Scheurenbrand
c95b46c053 news: fix structs 2020-11-18 19:16:32 +01:00
averne
2fdae0db52
Add service wrappers for ins:r and ins:s (#502) 2020-11-08 00:28:20 +01:00
fincs
091f88915d
virtmemRemoveReservation: add forgotten mutex note to docs 2020-10-31 14:06:48 +01:00
fincs
22a3efcbe1
virtmem: Deprecate virtmemReserve/virtmemFree 2020-10-30 16:10:52 +01:00
fincs
8310f438ca
virtmem: Add memory reservation system
jit: Use virtmemFindCodeMemory on both codepaths; use virtmem reservations
in order to support the JitType_SetProcessMemoryPermission codepath
2020-10-30 16:07:38 +01:00
fincs
490d96e6eb
virtmem: Add virtmemFindCodeMemory to work around a quirk in 1.x kernel 2020-10-30 00:16:03 +01:00
fincs
eecf2a9d32
Add detectMesosphere() 2020-10-29 16:52:16 +01:00
fincs
970d982e57
Add diagAbortWithResult, see details:
- This is a (weak/overridable) function meant to be called when the
  program encounters an unrecoverable error, but it's not fatal enough
  to bring down the entire system with it.
- The default implementation uses svcBreak, passing the result code
  in the user buffer.
- Replaced all usages of fatalThrow with diagAbortWithResult throughout
  the entire library.
2020-10-29 13:40:35 +01:00
fincs
a05a44fca8
virtmem: Major rewrite to support ASLR, see details:
- Added virtmemLock/Unlock, needed for atomic find-and-map operations
- Added virtmemFindAslr, which looks for a random free area in AslrRegion
  - virtmemReserve still exists for legacy callers who rely on sequential
    allocation in order to avoid race conditions from concurrent uses
- Added virtmemFindStack, which searches within StackRegion instead
  - Removed virtmemReserveStack/FreeStack
- Changed shmem/thread/tmem/codememory-jit to use the new virtmem API
  - Legacy jit still uses virtmemReserve
2020-10-27 12:27:32 +01:00
fincs
e655b48c41
crt0: clean up/refactor; envSetup: properly detect NSO/NRO environment... 2020-10-27 12:27:32 +01:00
fincs
7c6d7849f5
Remove obsolete kernel detection code 2020-10-27 12:27:32 +01:00
fincs
8d51f7de1c
jit: Transfer the responsibility of detecting whether CodeMemory syscalls are available/usable to the homebrew environment 2020-10-27 12:27:31 +01:00
fincs
d0d64ce1ce
fatalThrow: use hosversion instead of kerneldetect (and remove old alias) 2020-10-27 12:27:31 +01:00
fincs
4c6abe1e41
svcBreak: fix prototype, add and use BreakReason enum 2020-10-27 12:27:31 +01:00
fincs
e0c1dfe2ce
Add light event synchronization primitive [4.0.0+] 2020-10-27 12:27:20 +01:00
Michael Scire
dee3a7a241 gpio: loosen sysver restriction on OpenSession 2020-10-26 11:55:03 +01:00
Michael Scire
0ff42ee69e gpio: implement majority of the service 2020-10-26 11:48:07 +01:00
yellows8
8718c145f6
lp2p: Updated docs. 2020-10-25 19:55:33 -04:00
yellows8
8a31abeea7
Added lp2p. 2020-10-25 14:00:44 -04:00
averne
022887ac2d Fix event handle retrieval in spl 2020-10-04 00:20:16 +02:00
Vicki Pfau
4afec4016d psm: Add more battery functions 2020-09-28 00:36:35 +02:00
yellows8
f01fb21da5
Added uart. 2020-09-12 18:53:30 -04:00
yellows8
ab59dfb5bb
btdrv: Updated docs for BtdrvBluetoothPropertyType_Unknown3. 2020-09-04 11:59:35 -04:00
yellows8
625616bd44
btm: Update the right struct, BtmDeviceInfoList. 2020-08-26 19:10:38 -04:00
yellows8
9febf780b1
btm: Updated BtmDevicePropertyList. 2020-08-26 19:03:55 -04:00
yellows8
cc2be8375a
btm: Updated BtmHostDeviceProperty. 2020-08-26 12:28:32 -04:00
yellows8
cccef0c525
audout: Properly pass the aruid in audoutOpenAudioOut, fixes #197. 2020-08-21 13:32:31 -04:00
yellows8
ac8ac4919e
set: Updated for [10.1.0+], added more cmds, use struct for nickname. 2020-08-20 23:20:10 -04:00
yellows8
797cdffb14 btdrv: Updated BtdrvBleScanResult. 2020-08-20 18:38:55 -04:00
yellows8
5820178f56 btdrv: Updated param order. 2020-08-20 18:38:55 -04:00
yellows8
89358ba98c btdrv: Use const for btdrvWriteHidData/btdrvSetHidReport. 2020-08-20 18:38:55 -04:00
yellows8
c669589a35 bluetooth: Updated params, improved docs, etc. 2020-08-20 18:38:55 -04:00
yellows8
8718ea3659 Added btdev. 2020-08-20 18:38:55 -04:00
yellows8
4fae8554f7 btdrv/btm: Updated/added various structs. 2020-08-20 18:38:55 -04:00
yellows8
4db3c621e8 set: Use BtdrvAddress. 2020-08-20 18:38:55 -04:00
yellows8
3b670bc652 btdrv: Added the remaining cmds, various fixes, and added a types .h. 2020-08-20 18:38:55 -04:00
yellows8
ab9ce7c330 btdrv: Added support for pre-4.0.0, etc. 2020-08-20 18:38:55 -04:00
yellows8
8789077bb8 btm: Added the aruid cmds. 2020-08-20 18:38:55 -04:00
yellows8
070e959609 btm: Added more cmds. 2020-08-20 18:38:55 -04:00
yellows8
abf3600724 Added btm, moved btmu structs into btm, and updated docs. 2020-08-20 18:38:55 -04:00
yellows8
5551fcfab6 btmu/btdrv: Use bool flag where needed and updated docs. 2020-08-20 18:38:55 -04:00
yellows8
1442280447 btmu: g_btdrvIBtmUserCore -> g_btmuIBtmUserCore 2020-08-20 18:38:55 -04:00
yellows8
e7fbdf9eb1 Added btmsys. 2020-08-20 18:38:55 -04:00
yellows8
6ad9bd15d5 btmu: Updated docs. 2020-08-20 18:38:55 -04:00
yellows8
4e0fcb105d btdrv/btmu: Updated structs. 2020-08-20 18:38:55 -04:00
yellows8
94464baf38 btdrv/btmu: Various improvements. 2020-08-20 18:38:55 -04:00
yellows8
9439243649 Added btmu and added btdrv structs. 2020-08-20 18:38:55 -04:00
yellows8
a771f06a0e btdrv: Fixed btdrvGetHidReport IPC, updated docs, and added an enum. 2020-08-20 18:38:55 -04:00
yellows8
354e7d84fd btdrv: Added btdrvTriggerConnection. 2020-08-20 18:38:55 -04:00
yellows8
bc16eb227b btdrv: Updated the BtdrvBleAdvertisePacketData struct. 2020-08-20 18:38:55 -04:00
yellows8
045f6477d9 btdrv: Added cmds:
btdrvSetBleVisibility, btdrvSetBleAdvertiseData, btdrvSetBleAdvertiseParameter, btdrvRegisterGattClient, btdrvUnregisterGattClient, btdrvUnregisterAllGattClients, btdrvGetGattAttribute, btdrvGetGattService, btdrvRegisterGattServer, btdrvUnregisterGattServer, btdrvConnectGattClient, btdrvDisconnectGattClient, btdrvAddGattService, btdrvEnableGattService, btdrvAddGattCharacteristic, btdrvAddGattDescriptor, btdrvGetBleManagedEventInfo, btdrvGetGattFirstCharacteristic, btdrvGetGattNextCharacteristic, btdrvGetGattFirstDescriptor, btdrvGetGattNextDescriptor, btdrvRegisterGattManagedDataPath, btdrvUnregisterGattManagedDataPath, btdrvRegisterGattHidDataPath, btdrvUnregisterGattHidDataPath, btdrvRegisterGattDataPath, btdrvUnregisterGattDataPath.
2020-08-20 18:38:55 -04:00
yellows8
e0ee2ffc86 btdrv: Added btdrvGetEventInfo/btdrvGetHidEventInfo, etc. 2020-08-20 18:38:55 -04:00
yellows8
0075672b93 btdrvGetLeEventInfo -> btdrvGetLeHidEventInfo 2020-08-20 18:38:55 -04:00
yellows8
b15a583b80 btdrv: Added more cmds and the required enum:
btdrvGetLatestPlr, btdrvEnableTxPowerBoostSetting, btdrvIsTxPowerBoostSettingEnabled, btdrvEnableAfhSetting, btdrvIsAfhSettingEnabled, btdrvGetChannelMap, btdrvMoveToSecondaryPiconet, btdrvIsManufacturingMode, btdrvEmulateBluetoothCrash, btdrvGetBleChannelMap.
2020-08-20 18:38:55 -04:00
yellows8
b18912980e btdrv: Added HidReportEventInfo support. 2020-08-20 18:38:55 -04:00
yellows8
2878b97f3a btdrv: Added cmds:
btdrvGetAdapterProperties, btdrvGetAdapterProperty, btdrvSetAdapterProperty, btdrvWriteHidData, btdrvWriteHidData2, btdrvSetHidReport, btdrvGetHidReport.

Added/updated the required enum/struct.

bt(drv): Updated docs.
2020-08-20 18:38:55 -04:00
yellows8
7e06e0e657 btdrv: Use InitializeBluetoothDriver during init. 2020-08-20 18:38:55 -04:00
yellows8
a5e8572019 Added initial bluetooth support. 2020-08-20 18:38:55 -04:00
yellows8
bcc0f86aa3
hidbus/ringcon: Fixed cleanup, this also fixed a crash. 2020-08-20 13:28:26 -04:00
HookedBehemoth
9a1e3aeb47
add news service wrapper (#493) 2020-08-04 19:37:34 +02:00
fincs
1b95c09a27
switch.ld: update init_array/fini_array handling for latest devkitA64 2020-07-25 18:26:33 +02:00
Adubbz
ed16b7f948 hiddbg: implement DeactivateHomeButton 2020-07-07 12:35:37 +02:00
SciresM
b8a095ac2f
fs: add missing AccessLog functions. (#491) 2020-07-03 00:03:36 +02:00
Michael Scire
e36c7a760f err: add ErrorContextType enum 2020-06-27 12:52:01 +02:00
yellows8
e2db987144
web: Added WebSession support. 2020-06-24 10:39:18 -04:00
yellows8
6620dfaa6f
applet: Added get-event funcs:
appletHolderGetExitEvent and expose appletHolderGetPopInteractiveOutDataEvent.
2020-06-24 10:35:30 -04:00
yellows8
a0ce273019
ssl: Improved docs. 2020-06-21 13:16:34 -04:00
Ezekiel Bethel
d0a7c6a2a5
fix return value of romfs_stat for non-existent files/directories (#488) 2020-06-18 10:58:12 +01:00
yellows8
044eac2f3d
web: Updated for 10.x. 2020-06-15 15:40:05 -04:00
yellows8
3d4f61735a
swkbd: Updated for 10.x and added:
swkbdInlineGetMaxHeight, swkbdInlineGetTouchRectangles, swkbdInlineIsUsedTouchPointByKeyboard.
2020-06-14 00:03:19 -04:00
yellows8
42568d6af8
swkbd: Adjusted the order in the .h. 2020-06-11 22:51:48 -04:00
yellows8
857e2f5c4d
swkbd: Added proper support for using SwkbdInlineMode_UserDisplay. 2020-06-11 22:40:14 -04:00
yellows8
29dd63e5db
Added support for nifmLa. Added nifmRequestGetAppletInfo. 2020-06-11 19:00:07 -04:00
yellows8
05badbdc29
miiLa: Minor docs adjustment. 2020-06-09 22:03:17 -04:00
yellows8
7940d8e9e1
Added support for the miiLa libapplet (MiiEdit). 2020-06-09 22:01:15 -04:00
yellows8
9dc185ba3c
Added support for libapplet nfpLa (amiibo). 2020-06-06 22:40:28 -04:00
HookedBehemoth
ac468913e4
add commands for accessing process storage (#485) 2020-06-06 15:13:23 +02:00
yellows8
eb9d377320
hid: Implemented the remaining functionality for supporting SevenSixAxisSensor, and added the required structs. Updated hidInitializeSevenSixAxisSensor for the [10.0.0+] change. 2020-06-01 12:11:24 -04:00
fincs
bce0ea871d
libnx v3.3.0 2020-05-27 16:52:38 +02:00
Dave Murphy
db795f42ad fix stat for romfs directories 2020-05-27 14:59:43 +02:00
Ezekiel Bethel
573e2f772c add lstat to fs_dev and romfs_dev 2020-05-26 17:32:54 +02:00
yellows8
17ebe4104a
ldn: Updated structs. 2020-05-24 12:34:43 -04:00
yellows8
ff931da962
ldn: Updated structs etc. 2020-05-19 17:30:50 -04:00
yellows8
6e92692043
ldn: Updated LdnNetworkInfo struct. 2020-05-18 22:46:53 -04:00
yellows8
07ba98b702
ldn: Filled in LdnAcceptPolicy, updated LdnNetworkInfo, and updated docs. 2020-05-18 16:02:41 -04:00
yellows8
2f25c57d0e
ldn: Updated structs. 2020-05-18 14:57:22 -04:00
yellows8
55c0205de0
ldn: Updated structs and docs. 2020-05-18 12:51:14 -04:00
yellows8
7bf43fefea
ldn: Updated structs/docs. 2020-05-17 19:54:25 -04:00
yellows8
02ed902558
Added support for ldn. 2020-05-17 15:49:23 -04:00
Michael Scire
3d726ed78c mutex: rewrite to optimize 2020-05-17 17:46:59 +02:00
yellows8
3c08ce6936
nifm: Added support for IRequest. 2020-05-12 23:32:20 -04:00
fincs
d1f4b11f9a
libnx v3.2.0 2020-05-11 20:28:37 +02:00
Michael Scire
4f401256b0 psc: correct version for pscPmModuleAcknowledge 2020-05-07 12:29:43 +02:00
yellows8
3971f3e053
ssl: Updated docs. 2020-05-05 21:51:40 -04:00
yellows8
de27e7b171
ssl: Improved docs. 2020-05-03 12:43:29 -04:00
Dave Murphy
c7130a785a fix string truncation warning 2020-05-03 00:58:03 +02:00
Dave Murphy
5b879cbb0e remove unreferenced struct 2020-05-03 00:58:03 +02:00
yellows8
2e41795194
ssl: Improved docs. 2020-05-02 12:02:22 -04:00
yellows8
bcdbd89292
ssl: Updated docs. 2020-05-01 22:49:51 -04:00
yellows8
8fcd1b2afa
ssl: Improved docs. 2020-04-30 12:26:43 -04:00
yellows8
ea77c1d4cb
ssl: Improved the SslVersion enum and updated the param type for sslCreateContext. 2020-04-29 12:26:44 -04:00
yellows8
3f5362a7bb
ssl: Updated docs. 2020-04-28 00:36:24 -04:00
fincs
b0494c1acb
Update outdated comments and naming in jit.h/c 2020-04-27 13:46:55 +02:00
Adubbz
dbc4b759e2 set: fix GetGyroscopeOffset 2020-04-26 16:52:28 +02:00
yellows8
3b2b3ebad4 socket-ssl: Updated docs. Check for output sockfd=-1 from the cmd with socketSslConnectionSetSocketDescriptor. 2020-04-24 16:39:22 -04:00
yellows8
41e90ef8b5 ssl: Updated params and docs + various improvements. Added sslConnectionGetServerCertDetail and the required structs. 2020-04-24 16:39:22 -04:00
yellows8
41aefdc5ee ssl/socket: Added socketSslConnectionSetSocketDescriptor/socketSslConnectionGetSocketDescriptor wrappers, and updated ssl for this. 2020-04-24 16:39:22 -04:00
yellows8
613fa855da ssl: Implemented the remaining ISslConnection cmds. Expose the total_out param for sslGetCertificates. Various improvements / updated docs. 2020-04-24 16:39:22 -04:00
yellows8
60e4ee04b0 Added initial support for the ssl service. 2020-04-24 16:39:22 -04:00
HookedBehemoth
8e245a0ba8
add capssc 1201-1203 debug calls (#408) 2020-04-24 22:10:42 +02:00
SciresM
8cbac97466
capssc: Add CaptureJpegScreenShot (#407) 2020-04-23 00:07:03 +02:00
yellows8
20fd5bb9a2
nacp: Updated the nacp struct, and added/updated structs for it. 2020-04-20 20:05:31 -04:00
yellows8
cc7fb493e1
hidsys: Added support for all of the [10.0.0+] ButtonConfig cmds, and the required enum/structs. 2020-04-20 18:46:42 -04:00
SciresM
06bebed819
caps: correct CapsScreenShotDecodeOption (#406) 2020-04-20 18:56:31 +02:00
Michael Scire
6fae441714 ns: fix appman getter funcs on 3.0.0-5.0.2 2020-04-20 12:36:50 +02:00
fincs
a1af4494bf
Add nvGpuChannelGetErrorInfo, see details:
- Rename NvError(Type) to NvNotification(Type)
- Introduce NvError struct (output of GetErrorInfo)
- Add nvioctlChannel_GetErrorInfo
2020-04-19 22:18:45 +02:00
fincs
f5e4615a40
nvChannelClose: cleanup fixes 2020-04-19 22:15:32 +02:00
fincs
dc20bf67e9
nvGpuChannelCreate: make channel priority configurable 2020-04-19 22:14:53 +02:00
yellows8
0de0dfdd8d
swkbd: Use appletHolderPresetLibraryAppletGpuTimeSliceZero on [10.0.0+] in _swkbdInlineLaunch. In _swkbdInlineLaunch, use appletHolderClose if needed when errors occur. 2020-04-18 13:25:21 -04:00
yellows8
1925e32c6d
applet: Added support for most of the [10.0.0+] cmds: appletCancelCpuBoostMode, appletActivateMigrationService, appletDeactivateMigrationService, appletCreateManagedDisplaySeparableLayer, appletSetManagedDisplayLayerSeparationMode, appletHolderPresetLibraryAppletGpuTimeSliceZero, appletRequestToSleep, appletApplicationRequestApplicationSoftReset, appletApplicationRestartApplicationTimer, appletSetApplicationMemoryReservation, appletShouldSetGpuTimeSliceManually, appletIsHealthWarningRequired, appletIsHomeButtonShortPressedBlocked. 2020-04-18 13:21:39 -04:00
shchmue
e79c8a2467
Add new 10.0.0 settings calls (#404) 2020-04-18 00:45:53 +02:00
yellows8
b1b80f5493
pdm: Updated for [10.0.0+]. 2020-04-17 14:17:30 -04:00
fincs
4b7921a221
Make nxlink stdio more flexible, see details:
- Added nxlinkConnectToHost with separate flags for redirecting stdout/err
- Added nxlinkStdioForDebug, which only redirects stderr
- (nxlinkStdio now just calls nxlinkConnectToHost)
2020-04-17 16:46:54 +02:00
fincs
4c9b2ac048
Separate debug console code from normal console code, see details:
- consoleDebugInit now lives in a separate source code file
- The devoptab for debugDevice_CONSOLE is now loaded weakly, so that
  normal console code isn't linked in by explicit means
- consoleInit no longer sets up stderr. If stderr to console is desired,
  explicitly use consoleDebugInit(debugDevice_CONSOLE)
- This change makes it possible to use debugDevice_SVC without linking
  in the entire console runtime, which in turn also enabled default
  native window handling (and this can be undesirable)
2020-04-17 16:46:40 +02:00
XorTroll
763b1694ec
Add mii and miiimg services (#402) 2020-04-17 01:28:53 +02:00
Michael Scire
0b93435a44 lr: add lrLrEraseProgramRedirection 2020-04-16 21:24:49 +02:00
Michael Scire
d4c278cf00 pm: rename EnableApplicationExtraThread 2020-04-16 21:24:49 +02:00
Michael Scire
f86dc2ceba pgl: implement full api 2020-04-16 21:24:49 +02:00
yellows8
db14e06fb2
Added a sysver-check for appletOpenMainApplication, it was removed with [10.0.0+]. Added a required-sysver comment for ldrPmSetEnabledProgramVerification. 2020-04-16 13:54:44 -04:00
yellows8
ab715a9a49
bpc: Added a required-sysver check for bpcGetSleepButtonState which was missing. 2020-04-16 13:46:55 -04:00
yellows8
3a22332630
ns: Added/updated required-sysver checks as needed by [10.0.0+], and added nsdevLaunchApplicationFromHost. 2020-04-16 12:38:46 -04:00
HookedBehemoth
a272fa75b9
make pl:s accessible (#400) 2020-04-15 18:18:14 +02:00
Michael Scire
7e581f6110 fix if spacing 2020-04-14 21:29:38 +02:00
Michael Scire
e09ce419ac svc: real definition for 10.x QueryIoMapping 2020-04-14 21:29:38 +02:00
Michael Scire
cb7c1f87a8 svc: QueryIoMapping ABI change in 10.x 2020-04-14 21:29:38 +02:00
Michael Scire
02e4aad9dc pgl: add pglTerminateProcess 2020-04-14 21:29:38 +02:00
Michael Scire
27b34533ac ldr: add ldrPmSetEnabledProgramVerification 2020-04-14 21:29:38 +02:00
Michael Scire
af051c8301 fsp-pr: SetEnabledProgramVerification removed in 10.0.0 2020-04-14 21:29:38 +02:00
Michael Scire
fa0234efff fsldr: update for 10.0.0 2020-04-14 21:29:38 +02:00
yellows8
ca6a48d2b6
irs: Fixed the sysver handling in _irsInitialize(), previously only the values for [4.0.0+] would be used when running on [4.0.0+]. 2020-04-11 23:16:20 -04:00
SciresM
966edb1f0f
set: fix SetRegion, setsysGetSerialNumber (#397) 2020-04-12 03:14:36 +02:00
yellows8
0a9f8261cb
svc: Fixed off-by-one in syscall-number docs. 2020-04-11 15:25:00 -04:00
yellows8
f4c3b288fd
nifm: Added nifmGetCurrentNetworkProfile, nifmGetNetworkProfile, nifmSetNetworkProfile, nifmGetCurrentIpConfigInfo. Internal nifmGetCurrentIpAddress improvements. Added structs: NifmIpV4Address, NifmIpAddressSetting, NifmDnsSetting, NifmProxySetting, NifmIpSettingData, NifmWirelessSettingData, NifmSfWirelessSettingData, NifmSfNetworkProfileData, NifmNetworkProfileData. Various improvements / improved docs. 2020-04-11 13:00:06 -04:00
fincs
fbd97a1fc3
time: minor cleanup in steady clock timepoint calculation 2020-04-11 00:20:21 +02:00
fincs
39629f5a67
timeGetCurrentTime: add shared memory support [6.0.0+] 2020-04-11 00:16:07 +02:00
fincs
b0d96342e8
time: Add timeGetStandardSteadyClockInternalOffset [3.0.0+] 2020-04-11 00:13:21 +02:00
fincs
b4db31e536
time: Expose TimeStandardSteadyClockTimePointType, correct TimeSystemClockContext 2020-04-11 00:08:12 +02:00
fincs
b18ae1c884
time: Add timeGetStandardSteadyClockTimePoint (uses sharedmem on 6.x+, ISteadyClock prior to 6.x) 2020-04-10 19:42:31 +02:00
fincs
2edfb7cc56
time: Retrieve and expose shared memory [6.0.0+] 2020-04-10 17:18:12 +02:00
fincs
bf5331d178
shmemMap: Fix invalid libnx result 2020-04-10 17:16:57 +02:00
yellows8
5e95507cbc
bsd/sockets: Added actual support for recvmsg/sendmsg and sendmmsg/recvmmsg, on [7.0.0+]. 2020-04-09 13:15:07 -04:00
SciresM
4746827513
thread: add threadGetSelf(), add main thread to thread list. (#392) 2020-04-07 01:47:06 +02:00
HookedBehemoth
7dbb90ee66
add remaining IAudioOut commands (#393) 2020-04-06 23:29:27 +02:00
XorTroll
77022a6d11
Fix nfp OpenApplicationArea command (#391) 2020-04-05 13:54:47 -04:00
fincs
d9c3593183
libnx v3.1.0 2020-04-04 23:43:23 +02:00
yellows8
0723df74dd
irs: Updated the IrsPointingProcessorMarkerState struct. 2020-04-04 14:12:26 -04:00
yellows8
c82c8b8760
fs/fs_dev: Added fsOpenReadOnlySaveDataFileSystem and fsOpen_SaveDataReadOnly/fsdevMountSaveDataReadOnly. Minor adjustments. 2020-04-03 19:58:40 -04:00
yellows8
fa52f9b046
fs/fs_dev: Added fsOpen_TemporaryStorage/fsOpen_CacheStorage and fsdevMountTemporaryStorage/fsdevMountCacheStorage. Minor adjustments. 2020-04-03 19:16:26 -04:00
yellows8
918fe2b4d6
fs/fs_dev: Added fsOpen_BcatSaveData/fsOpen_SystemBcatSaveData and fsdevMountBcatSaveData/fsdevMountSystemBcatSaveData. 2020-04-03 11:04:05 -04:00
yellows8
014b02db97
irs: Major overhaul, irs is now properly supported. Functionality for newer system-versions is now supported.
* Updated structs: IrsPackedMomentProcessorConfig, IrsImageTransferProcessorConfig, IrsPackedImageTransferProcessorConfig, IrsImageTransferProcessorState.

* The u32 IrCameraHandle was replaced with struct IrsIrCameraHandle.

* Added various enums/structs, etc. Improved docs.

* irsActivateIrsensor() and irsSuspendImageProcessor() are no longer exposed, these are now used automatically when needed.

* Added the following: irsGetIrCameraStatus, irsCheckFirmwareUpdateNecessity, irsGetImageProcessorStatus, irsStopImageProcessorAsync, irsRunMomentProcessor, irsGetMomentProcessorStates, irsCalculateMomentRegionStatistic, irsRunClusteringProcessor, irsGetClusteringProcessorStates, irsRunImageTransferExProcessor, irsRunPointingProcessor, irsGetPointingProcessorMarkerStates, irsGetPointingProcessorStates, irsRunTeraPluginProcessor, irsGetTeraPluginProcessorStates, irsRunIrLedProcessor, irsRunAdaptiveClusteringProcessor, irsRunHandAnalysis, irsGetMomentProcessorDefaultConfig, irsGetClusteringProcessorDefaultConfig, irsGetDefaultImageTransferProcessorExConfig, irsGetIrLedProcessorDefaultConfig.
2020-04-02 18:38:55 -04:00
yellows8
33425de627
Added UtilFloat3. 2020-04-02 14:42:51 -04:00
SciresM
75c3d2eca4
nim: add ListSystemUpdateTask/DestroySystemUpdateTask (#390) 2020-03-31 21:41:05 +02:00
Michael Scire
5d57c70a3e fix calls to svcSetThreadActivity 2020-03-29 18:42:19 +02:00
Michael Scire
43549f4596 svc: fix definitions to better match kernel 2020-03-29 18:42:19 +02:00
yellows8
b50ac5b322
Added ringcon. (#388)
* Added ringcon.
2020-03-24 22:18:56 -04:00
玻璃兔
3dbafe6183
More keyboard types (#387) 2020-03-20 17:43:44 +01:00
yellows8
f0f21507db
fs/fsdev: Added fsdevMountDeviceSaveData/fsOpen_DeviceSaveData, and minor other adjustments. 2020-03-18 22:33:15 -04:00
cathery
31f871a74f hid: Update the value for JOYSTICK_MIN 2020-03-16 21:02:05 +01:00
fincs
6535d6f871
Remove U64_MAX in favor of using UINT64_MAX 2020-03-16 16:21:33 +01:00
fincs
cacf8615a8
Remove arm/atomics.h (use C <stdatomic.h> or C++ <atomic> instead) 2020-03-16 12:51:07 +01:00
fincs
2c19f13f74
nvFence/nvGpu/nvMap: use service guard instead of unsafe atomic refcnt 2020-03-16 12:48:08 +01:00
yellows8
91b4efb6f5
hidbus: Updated HidbusBusType. 2020-03-14 16:24:29 -04:00
yellows8
83f406b5cb
Added hidbus. 2020-03-14 12:10:50 -04:00
CTCaer
d7e6207708 ts: Add temperature location comments
Avert some confusion about the locations.
HOS uses TMP451 IC's internal thermistor for PCB temp readings and external is connected to a thermistor to SoC's package temp pins, so SoC temp readings.
2020-03-11 16:05:21 +01:00
fincs
8421863c78
applet: appletSetFocusHandlingMode should only be used with Application 2020-03-10 17:42:00 +01:00
shchmue
7ce58f84e0
Complete and correct all Settings calls (#383) 2020-03-10 16:35:11 +01:00
fincs
ccb79ff4b6
NWindow: don't use bqDetachBuffer as it's unnecessary and in fact does nothing in the place it's called (reported by @Thog) 2020-03-10 00:07:04 +01:00
yellows8
bf8f6ae5f5
ns: Use 'static ... const' with servarray. 2020-03-08 17:42:25 -04:00
Michael Scire
afbf2c6f71 fs: be consistent about no stack temps in fsFs 2020-03-08 00:47:01 +01:00
SciresM
c3b0b63471
fs: add IsSignedSystemPartitionOnSdCardValid (#381) 2020-03-07 12:40:02 +01:00
3096
1b1620f7bb apm: add apmGetPerformanceMode 2020-03-06 18:12:10 +01:00
yellows8
44ec13169d
pl: Removed unneeded plExit call from _plInitialize on errors, which is not needed with new-ipc. 2020-03-05 10:39:29 -05:00
yellows8
c85dd5fe2f
ns: Added nsGetDynamicRightsInterface, nsGetReadOnlyApplicationRecordInterface, nsGetApplicationVersionInterface, nsGetAccountProxyInterface, nsGetDocumentInterface. 2020-03-03 16:27:44 -05:00
yellows8
f589c95214
ns: Added support for using the other services as fallback on [3.0.0+] when ns:am2 isn't available. 2020-03-03 14:47:22 -05:00
yellows8
af2b4ab7c3
ns: Added nsGetApplicationManagerInterface(), and removed automatic IApplicationManagerInterface init on [3.0.0+]. Updated all IApplicationManagerInterface cmds to use service-session IApplicationManagerInterface on pre-3.0.0, otherwise nsGetApplicationManagerInterface() is used. Apps which use nsGetServiceSession_ApplicationManagerInterface must now use nsGetApplicationManagerInterface if running on [3.0.0+]. 2020-03-01 15:06:15 -05:00
yellows8
763b32060a
ns: Added nsGetApplicationDesiredLanguage. 2020-02-29 22:39:43 -05:00
yellows8
7822accc22
ns: Added nsGetReadOnlyApplicationControlDataInterface. Use IReadOnlyApplicationControlDataInterface with nsGetApplicationControlData when needed. 2020-02-28 20:10:29 -05:00
yellows8
fdb6aa1f15
ns: Added nsGetECommerceInterface. Added cmds: nsRequestLinkDevice, nsRequestSyncRights, nsRequestUnlinkDevice. Minor adjustments. 2020-02-28 14:36:10 -05:00
HookedBehemoth
7e07d1edf0
add fan service (#376) 2020-02-28 19:23:10 +01:00
HookedBehemoth
abc3522724
lbl: more commands (#377) 2020-02-28 19:13:27 +01:00
HookedBehemoth
23852ad932
add tc (#378) 2020-02-28 17:59:31 +01:00
yellows8
3ff12e7337
ns: Added nsGetDownloadTaskInterface. Added NsDownloadTaskStatus. Added support for IDownloadTaskInterface. 2020-02-27 20:52:14 -05:00
yellows8
424cd0fefe
ns: Check sysver in nsGetFactoryResetInterface, and added nsGetContentManagementInterface. Use IContentManagementInterface with the relevant cmds when needed. Added struct NsApplicationOccupiedSize. Added cmds: nsCalculateApplicationOccupiedSize, nsCheckSdCardMountStatus, nsCountApplicationContentMeta, nsIsAnyApplicationRunning. 2020-02-26 22:38:13 -05:00
yellows8
8ae9b5e1a9
ns: Added nsGetFactoryResetInterface(). Added support for IFactoryResetInterface. Improved docs, etc. 2020-02-26 17:36:15 -05:00
yellows8
4a493775b4
ns: Added support for nsDeleteUserSaveDataAll()/NsProgressMonitorForDeleteUserSaveDataAll. Added struct NsProgressForDeleteUserSaveDataAll. 2020-02-25 15:07:47 -05:00
yellows8
524e910268
ns: Added nsListApplicationTitle and nsListApplicationIcon. 2020-02-22 23:58:27 -05:00
yellows8
129b3a95b8
Added support for NsProgressAsyncResult and nsRequestVerifyAddOnContentsRights/nsRequestVerifyApplication. Updated docs. 2020-02-20 22:17:13 -05:00
HookedBehemoth
d8a50a46cf
add caps:c (#375) 2020-02-19 23:32:01 +01:00
shchmue
86a5aa4466
Correct structs and finish adding all set:cal calls (#373) 2020-02-18 19:56:31 +01:00
yellows8
0db4f8a953
ns: Added structs: NsApplicationViewDeprecated, NsApplicationView, NsPromotionInfo, NsApplicationViewWithPromotionInfo. Added cmds: nsGetApplicationViewDeprecated, nsGetApplicationView, nsGetApplicationViewDownloadErrorContext, nsGetApplicationViewWithPromotionInfo, nsGetPromotionInfo. 2020-02-18 10:26:35 -05:00
Michael Scire
73047b09fd spl: fix rsa key accessors on >= 5.x 2020-02-17 23:20:45 +01:00
yellows8
c570cd0a2f
ns: Added NsApplicationRightsOnClient/nsGetApplicationRightsOnClient(). 2020-02-17 15:46:02 -05:00
yellows8
d8d931fe25
ns: Added support for the following cmds: nsRequestApplicationUpdateInfo, nsRequestUpdateApplication2, nsRequestDownloadApplicationControlData, nsRequestCheckGameCardRegistration, nsRequestGameCardRegistrationGoldPoint, nsRequestRegisterGameCard, nsRequestDownloadApplicationPrepurchasedRights, nsRequestNoDownloadRightsErrorResolution, nsRequestResolveNoDownloadRightsError. 2020-02-16 21:33:24 -05:00
yellows8
9bf745524d
nifm: Added NifmClientId and nifmGetClientId/nifmIsAnyInternetRequestAccepted. 2020-02-15 12:32:50 -05:00
fincs
c4ebdb4cd8
Fix #371 2020-02-12 00:47:03 +01:00
yellows8
68d6260d72
ns: Actually check the required sysver for nsListApplicationContentMetaStatus. Updated param types for nsGetTotalSpaceSize/nsGetFreeSpaceSize + minor other improvements. Added support for the following:
* NsRequestServerStopper/nsRequestServerStopperClose().
* nsGetApplicationRecordUpdateSystemEvent, nsDeleteApplicationEntity, nsDeleteApplicationCompletely, nsDeleteRedundantApplicationEntity, nsIsApplicationEntityMovable, nsMoveApplicationEntity, nsCancelApplicationDownload, nsResumeApplicationDownload, nsCheckApplicationLaunchVersion, nsCalculateApplicationDownloadRequiredSize, nsCleanupSdCard, nsGetSdCardMountStatusChangedEvent, nsGetGameCardUpdateDetectionEvent, nsDisableApplicationAutoDelete, nsEnableApplicationAutoDelete, nsSetApplicationTerminateResult, nsClearApplicationTerminateResult, nsGetLastSdCardMountUnexpectedResult.
* nsGetRequestServerStopper, nsCancelApplicationApplyDelta, nsResumeApplicationApplyDelta, nsCalculateApplicationApplyDeltaRequiredSize, nsResumeAll, nsGetStorageSize, nsDeleteUserSystemSaveData, nsDeleteSaveData, nsUnregisterNetworkServiceAccount, nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion, nsGetGameCardMountFailureEvent, nsIsGameCardInserted, nsEnsureGameCardAccess, nsGetLastGameCardMountFailureResult, nsListApplicationIdOnGameCard, nsTouchApplication, nsIsApplicationUpdateRequested, nsWithdrawApplicationUpdateRequest, nsIsAnyApplicationEntityInstalled, nsCleanupUnavailableAddOnContents, nsFormatSdCard, nsNeedsSystemUpdateToFormatSdCard, nsGetLastSdCardFormatUnexpectedResult, nsGetApplicationTerminateResult.
2020-02-10 12:14:40 -05:00
yellows8
52a892ca31
ns: Fixed cmd order. 2020-02-06 20:07:02 -05:00
HookedBehemoth
2486175f55
add jpegdec/caps:dc (#369) 2020-01-31 17:53:07 +01:00
HookedBehemoth
c28d736ff0 fs: add fsOpenImageDirectoryFileSystem and FsImageDirectoryId 2020-01-28 20:39:41 -05:00
yellows8
6c706d910f
set: Fixed the required sysver for setsysGetHomeMenuScheme. 2020-01-25 13:47:39 -05:00
yellows8
b83ddf8157
hid: Updated the value for JOYSTICK_MAX. 2020-01-23 18:54:51 -05:00
fincs
04214ea441
romfs_dev: fix reading into buffers with device mappable attribute 2020-01-22 00:56:34 +01:00
yellows8
5a751ea0c3
Fixed definitions for ldrShellFlushArguments/ldrDmntFlushArguments and spl*GetServiceSession. Removed fsldrSetCurrentProcess from the .h. Closes #366. 2020-01-21 16:09:28 -05:00
SciresM
e5c501e5b6 svc: Add all missing SVC stubs (#364) 2020-01-18 21:39:05 +01:00
HookedBehemoth
446aaf2a55 add capsa IAlbumAccessorSession and more capsa calls (#363)
* add capsa IAlbumAccessorSession

* add documentation for capsa and change parameter order and names for image loading

* add CapsLoadAlbumScreenShotImageOutput for caps:a

* add remaining LoadAlbumScreenShot- calls

* add more calls, add structs and add doc

* fix query and use count instead of size for listing
2020-01-16 19:29:28 -05:00
fincs
7e6ff7e486
Simplify appletGetAppletResourceUserId and related logic 2020-01-17 00:18:55 +01:00
yellows8
9c4ab7f09d
hid: Fixed cmd order. 2020-01-14 21:48:18 -05:00
yellows8
c8b8c7b0f0
hid: Added enum HidGyroscopeZeroDriftMode. Added hidSetGyroscopeZeroDriftMode, hidGetGyroscopeZeroDriftMode, and hidResetGyroscopeZeroDriftMode. 2020-01-14 21:45:04 -05:00
yellows8
583d6bb92d
hid: Fixed vibration, toggling vibration-enable off->on is no longer needed. Properly closes #148. 2020-01-12 12:25:16 -05:00
yellows8
cbe9fae600
hid: Added hidSetSixAxisSensorFusionParameters, hidGetSixAxisSensorFusionParameters, and hidResetSixAxisSensorFusionParameters. 2020-01-11 22:37:07 -05:00
yellows8
f040706743
In _hidActivateConsoleSixAxisSensor, use cmd ActivateConsoleSixAxisSensor instead of ActivateSevenSixAxisSensor. 2020-01-09 18:42:06 -05:00
HookedBehemoth
f34de8fb54 added caps:a (#358)
* added caps:a

* change struct names
2020-01-09 15:32:34 -05:00
Pablo Curiel
1719eda9fb Update documentation about fsdevMountDevice() to inform about trailing colons in device names. (#362) 2020-01-02 02:20:32 +01:00
yellows8
1bb1aef2f7
Only init/exit apm from applet with AppletType_Application. Closes #360. 2019-12-23 10:50:52 -05:00
yellows8
f043307e7f
In __libnx_init_time(), use 'NX' for the tzname instead of the actual timezone-name. Using the original tzname causes issues with certain timezones. Closes #353. 2019-12-19 16:22:45 -05:00
yellows8
fb01dd8196
psel: Removed TODO comment. 2019-12-19 16:16:58 -05:00
fincs
ce394330a8
svcSignalProcessWideKey doesn't actually return anything 2019-12-18 00:40:27 +01:00
ITotalJustice
0881fb9e0b Add set:cal service with a few cal functions. (#356)
* Add set:cal service with a few functions
* Added more cal structs`
2019-12-16 16:20:00 -05:00
yellows8
d25bcc486a
Properly fixed __nx_applet_exit_mode handling, previously appletExit() called by _appletExitProcess didn't run since refcount was already 0. Closes #355. 2019-12-14 11:52:40 -05:00
fincs
2f7d9bf026
Delete old IPC 🎉 2019-12-12 02:25:05 +01:00
fincs
d1e5a5d6c8
libnx v3.0.0 2019-12-11 00:40:38 +01:00
yellows8
15490b15f6
applet: Added support for using appletSetHandlingHomeButtonShortPressedEnabled with non-AppletType_OverlayApplet on [9.1.0+]. 2019-12-08 16:45:47 -05:00
yellows8
26876cec38
nacp: Updated field-name style to match rest of libnx. Added NacpSendReceiveConfiguration. Renamed version to display_version. Renamed reserved_x3141 to startup_user_account_option, and renamed reserved_x3142 to reserved_for_user_account_save_data_operation. Added fields send_data_configuration, receivable_data_configurations, jit_configuration_flag, and memory_size. 2019-12-07 18:00:17 -05:00
yellows8
6d75ce4f93
Updated docs for FsGameCardAttribute, and added FsGameCardAttribute_DifferentRegionCupToTerraDeviceFlag/FsGameCardAttribute_DifferentRegionCupToGlobalDeviceFlag. 2019-12-06 22:48:34 -05:00
yellows8
6900a0241c
applet/time/set: Added TimeSteadyClockTimePoint. Updated appletSetDesirableKeyboardLayout/appletGetDesirableKeyboardLayout for using TimeSteadyClockTimePoint.
* Added SetSysUserSelectorFlag, SetSysEulaVersionClockType, SetSysNotificationVolume, SetSysFriendPresenceOverlayPermission, SetSysPrimaryAlbumStorage, SetSysHandheldSleepPlan, SetSysConsoleSleepPlan, SetSysErrorReportSharePermission, SetKeyboardLayout, and SetChineseTraditionalInputMethod.

* Added SetBatteryLot, SetSysUserSelectorSettings, SetSysAccountSettings, SetSysEulaVersion, SetSysNotificationTime, SetSysNotificationSettings, SetSysAccountNotificationSettings, SetSysTvSettings, SetSysDataDeletionSettings, SetSysSleepSettings, SetSysInitialLaunchSettings, and SetSysRebootlessSystemUpdateVersion.

* Added setsysSetLanguageCode, setsysGetAccountSettings/setsysSetAccountSettings, setsysGetEulaVersions/setsysSetEulaVersions, setsysGetNotificationSettings/setsysSetNotificationSettings, setsysGetAccountNotificationSettings/setsysSetAccountNotificationSettings, setsysGetTvSettings/setsysSetTvSettings, setsysGetDataDeletionSettings/setsysSetDataDeletionSettings, setsysGetWirelessCertificationFileSize/setsysGetWirelessCertificationFile, setsysSetRegionCode, setsysGetPrimaryAlbumStorage/setsysSetPrimaryAlbumStorage, setsysGetBatteryLot, setsysGetSleepSettings/setsysSetSleepSettings, setsysGetInitialLaunchSettings/setsysSetInitialLaunchSettings, setsysGetProductModel, setsysGetMiiAuthorId, setsysGetErrorReportSharePermission/setsysSetErrorReportSharePermission, setsysGetAppletLaunchFlags/setsysSetAppletLaunchFlags, setsysGetKeyboardLayout/setsysSetKeyboardLayout, setsysGetRebootlessSystemUpdateVersion, and setsysGetChineseTraditionalInputMethod/setsysSetChineseTraditionalInputMethod.
2019-12-06 21:13:43 -05:00
yellows8
c4bc7b24a0
Added type Uuid and use it where needed. Renamed the c field in NcmPlaceHolderId to uuid. Removed PACKED from WebWifiPageArg/WebWifiReturnValue. 2019-12-03 23:31:01 -05:00
SciresM
afe030f08b rwlock: revamp completely (#350)
Implements rwlockTryReadLock and rwlockTryWriteLock.
Also implements rwlockIsWriteLockHeldByCurrentThread and
rwlockIsOwnedByCurrentThread.

Also re-designs RwLock to have semantics identical to
Nintendo's (nn::os::ReaderWriterLock). The upshot is mostly
that the lock is now fully recursive/write-preferring.
2019-12-03 23:16:40 +01:00
yellows8
4626b50341
ncm_types: Replaced the typedef for NcmContentMetaInfo with an actual struct. Closes #351. 2019-12-03 15:05:29 -05:00
yellows8
bbcabee29f
psel: Number of improvements. Added PselUiMode_NintendoAccountAuthorizationRequestContext. Various naming adjustments. Implemented pselShowUserSelector properly, and added pselShowUserSelectorForSystem/pselShowUserSelectorForLauncher. Use accountIsUserRegistrationRequestPermitted and accountTrySelectUserWithoutInteraction. Added PselUserSelectionPurpose, PselNintendoAccountStartupDialogType, PselUserSelectionSettings, and PselUserSelectionSettingsForSystemService. 2019-12-03 13:34:27 -05:00
yellows8
bd04667eda
Added LibnxError_ShouldNotHappen. 2019-12-03 13:13:32 -05:00
yellows8
42aa0800f7
account: Added accountIsUserRegistrationRequestPermitted and accountTrySelectUserWithoutInteraction. 2019-12-03 13:13:11 -05:00
yellows8
4078de1eff
psel: Various improvements, including proper version handling. Updated names. Renamed/added modes, with sysver docs. Don't use ptrs for input AccountUids. Added pselShowUserCreatorForStarter and pselShowNintendoAccountNnidLinker. Directly return the Result from PselUiReturnArg. Removed the output user param from pselShowUserCreator. 2019-12-01 18:34:50 -05:00
yellows8
5182b57a1d
fs/fs_dev: Added FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard, fsFsIsValidSignedSystemPartitionOnSdCard, and fsdevIsValidSignedSystemPartitionOnSdCard. Improved docs. 2019-11-28 18:51:52 -05:00
yellows8
dea3f140f1
Minor hidLa docs improvement. 2019-11-28 18:47:00 -05:00
yellows8
f00898c4d8
Improved hidLa docs. 2019-11-28 16:11:06 -05:00
yellows8
9f28d0002a
Added support for hidLa (controller libapplet). 2019-11-28 16:04:46 -05:00
yellows8
c9f6100e1c
hid: Added hidGetNpadJoyHoldType. 2019-11-28 15:01:42 -05:00
yellows8
8fe48e8eac
fs/fs_dev/romfs_dev: Updated various types to use s64. Removed the inval param from fsDirRead since it doesn't exist. Renamed fileSize in FsDirectoryEntry to file_size and updated the type. Renamed FsFileSystemQueryType to FsFileSystemQueryId, and renamed FsFileSystemQueryType_SetArchiveBit to FsFileSystemQueryId_SetConcatenationFileAttribute. Renamed fsFsSetArchiveBit to fsFsSetConcatenationFileAttribute. Renamed fsdevSetArchiveBit to fsdevSetConcatenationFileAttribute. Minor other changes. 2019-11-28 14:58:55 -05:00
XorTroll
3925e92828 Add psel (playerSelect) support (#335)
* Add psel (playerSelect) support
2019-11-27 12:50:34 -05:00
yellows8
d94be49cb3
Moved common includes for libapplets into a dedicated internal header + minor other changes. 2019-11-27 11:18:58 -05:00
yellows8
9029e9f38d
Added NcmPackagedContentInfo. 2019-11-23 20:22:29 -05:00
shchmue
1c883145a8 Add FsSaveDataFlag for BIT(3) 2019-11-24 02:17:55 +01:00
fincs
324a3624ac
new-ipc: Introduce serviceCreateNonDomainSubservice in order to avoid calling cmifQueryPointerBufferSize during response parsing and corrupting output data as a result [bug found by @SciresM] 2019-11-21 16:27:36 +01:00
The Dax
cd9f29fc8e Add support for setting/getting the Internet time sync flag.
(IsUserSystemClockAutomaticCorrectionEnabled and 	SetUserSystemClockAutomaticCorrectionEnabled.)
2019-11-20 01:16:23 +01:00
yellows8
bcac85852a
Added InfoType_IsApplication. 2019-11-18 22:30:19 -05:00
yellows8
170942a781
Updated docs for nssuControlSetupToReceiveSystemUpdate. 2019-11-18 16:50:12 -05:00
yellows8
2b6197a51a
hid: Use _hidActivateConsoleSixAxisSensor instead of _hidActivateSevenSixAxisSensor, and moved the code using this to near the start of hidInitializeSevenSixAxisSensor. 2019-11-18 12:38:12 -05:00
yellows8
167bd9e110
hid: Use ActivateNpadWithRevision with the sysver-specific revision value in _hidActivateNpad(), on [5.0.0+]. 2019-11-18 12:25:48 -05:00
yellows8
70ddae58ff
acc/nfc/nifm: Removed *SetServiceType and moved the service_type param into the actual {service}Initialize() funcs. Removed *ServiceType_NotInitialized and updated the *ServiceType enum values. Minor other changes / improved nifm docs. 2019-11-18 10:52:46 -05:00
yellows8
d4c0c2dfeb
Updated notif docs. 2019-11-17 18:40:37 -05:00
yellows8
fcd7e36a9d
Added actual support for notif + improved docs. 2019-11-17 18:25:57 -05:00
yellows8
f181807215
fs/fs_dev: Updated names to match wiki. Updated param names. Renamed FS_SAVEDATA_CURRENT_PROGRAMID to FS_SAVEDATA_CURRENT_APPLICATIONID. Updated field names in FsSaveDataAttribute, FsSaveDataExtraData, FsSaveDataCreationInfo, and FsSaveDataInfo. Updated names for the enum values for FsSaveDataSpaceId, FsSaveDataType, FsSaveDataFlags, and FsGameCardAttribute. Added FsSaveDataSpaceId_SdUser and FsSaveDataSpaceId_SafeMode. Added FsSaveDataType_SystemBcat. Added FsSaveDataRank. Fixed the name for FsGameCardPartition and added FsGameCardPartition_Logo. Renamed FsBisStorageId to FsBisPartitionId, updated the enum value names for it, and added FsBisPartitionId_SignedSystemPartitionOnSafeMode. Improved docs / minor other changes. 2019-11-16 16:07:10 -05:00
yellows8
8216043ea1
applet: Fixed the prefix for *PushToFriendInvitationStorageChannel/*PushToNotificationStorageChannel. Added support for all [9.0.0+] IDebugFunctions cmds. Minor internal changes + improved docs. 2019-11-15 18:08:46 -05:00
yellows8
1e58385bd5
Added appletGetFriendInvitationStorageChannelEvent, appletTryPopFromFriendInvitationStorageChannel, appletGetNotificationStorageChannelEvent, and appletTryPopFromNotificationStorageChannel. Added appletPushToFriendInvitationStorageChannel/appletPushToNotificationStorageChannel. Added friendsGetFriendInvitationNotificationEvent/friendsTryPopFriendInvitationNotificationInfo. Added notif, for adding notifGetNotificationSystemEvent/notifTryPopNotifiedApplicationParameter. 2019-11-15 14:26:29 -05:00
fincs
83649c9768
Fix #346 - sessionmgrClose did not actually close the extra sessions 2019-11-14 17:35:35 +01:00
yellows8
dda6194d0b
Added appletIsForceTerminateApplicationDisabledForDebug. Updated docs. 2019-11-14 11:34:41 -05:00
yellows8
c0115edca1
Added appletSetHealthWarningShowingState and appletGetHealthWarningDisappearedSystemEvent. 2019-11-13 23:41:43 -05:00
yellows8
d24f1ca611
Added appletSetInputDetectionPolicy and AppletInputDetectionPolicy. 2019-11-13 20:53:40 -05:00
yellows8
297e9d97a0
Added appletGetSettingsPlatformRegion/appletSetHdcpAuthenticationActivated and improved docs. 2019-11-13 20:07:26 -05:00
yellows8
d88f67fe30
Added appletPushToAppletBoundChannel and appletTryPopFromAppletBoundChannel. 2019-11-13 18:25:34 -05:00
yellows8
8fc57a4795
Added support for using appletSetTerminateResult via IAppletCommonFunctions, and for using appletGetLaunchStorageInfoForDebug/appletGetGpuErrorDetectedSystemEvent with AppletType_LibraryApplet, on [9.0.0+]. Moved these to a new section in the .h/.c. 2019-11-13 17:52:56 -05:00
yellows8
689430e578
fs: Updated names to match wiki. FsSave->FsSaveDataAttribute, FsSaveCreate->FsSaveDataCreationInfo, and renamed the save field in FsSaveDataExtraData to attr. Updated names for enum values in: FsContentStorageId, FsCustomStorageId, and FsSaveDataSpaceId. Added FsSaveDataSpaceId_ProperSystem and FsFileSystemType_RegisteredUpdate. Various improvements and improved docs. 2019-11-13 14:34:49 -05:00
yellows8
c40f8ecac6
Removed includes which are unneeded due to being included elsewhere, etc. Minor improvements. 2019-11-12 12:45:58 -05:00
yellows8
67eacc8034
Added support for the [9.0.0+] friendsLa functionality. Added AccountNetworkServiceAccountId (and updated friendsLa for this). Added FriendsFriendInvitationGameModeDescription, FriendsFriendInvitationId, and FriendsFriendInvitationGroupId. 2019-11-12 10:24:27 -05:00
yellows8
9ca626fd82
Improved docs. 2019-11-11 19:18:44 -05:00
yellows8
9888df18da
Moved most ncm types into ncm_types.h. Renamed FsStorageId to NcmStorageId, with updated names for some values (now located in ncm_types.h). Various improvements + improved docs. 2019-11-11 18:19:45 -05:00
yellows8
ce570a70f1
romfs_dev: Replaced the romFS_dir()/romFS_file() macros with funcs which have actual bounds-checking, this fixes crashes/hangs when the romfs tables are corrupted. Updated relevant code to handle this / various improvements, and return ENOENT instead of EEXIST where required. 2019-11-11 11:07:46 -05:00
yellows8
cc64ec7236
Added NsReceiveApplicationProgress/NsSendApplicationProgress, updated NsApplicationDeliveryInfo, and improved docs. Added the following: nsSelectLatestSystemDeliveryInfo, nsVerifyDeliveryProtocolVersion, nsHasAllContentsToDeliver, nsCompareApplicationDeliveryInfo, nsCanDeliverApplication, nsListContentMetaKeyToDeliverApplication, nsNeedsSystemUpdateToDeliverApplication, nsEstimateRequiredSize, nsRequestReceiveApplication, nsCommitReceiveApplication, nsGetReceiveApplicationProgress, nsRequestSendApplication, nsGetSendApplicationProgress, nsCompareSystemDeliveryInfo, nsListNotCommittedContentMeta, and nsGetApplicationDeliveryInfoHash. 2019-11-09 21:13:23 -05:00
yellows8
24f77642c9
Updated the NsSystemDeliveryInfo struct. Added nsGetApplicationDeliveryInfo and NsApplicationDeliveryInfo. 2019-11-08 16:11:05 -05:00
cathery
d4c5fbdf0f hiddbg: Add hiddbgIsHdlsVirtualDeviceAttached (#345) 2019-11-07 19:27:13 +01:00
yellows8
5a7f14409e
Updated nssu docs. 2019-11-05 22:34:08 -05:00
yellows8
09423066b0
Updated the type for the size param for ncmContentStorageCreatePlaceHolder. 2019-11-03 22:04:52 -05:00
yellows8
6c7ad3095c
Added setsysGetPctlReadyFlag/setsysSetPctlReadyFlag. Fixed ordering. 2019-11-03 16:39:29 -05:00
yellows8
454244602c
Added setsysGetTouchScreenMode/setsysSetTouchScreenMode and SetSysTouchScreenMode. Minor adjustment. 2019-11-02 16:32:12 -04:00
yellows8
8ee7afca99
Added setsysGetMemoryUsageRateFlag. 2019-11-02 16:08:08 -04:00
yellows8
e5dd8a741d
Added setsysGetHomeMenuScheme and setsysGetHomeMenuSchemeModel. Added SetSysHomeMenuScheme. Minor adjustment. 2019-11-02 15:29:38 -04:00
yellows8
ddafdbd2ac
Minor style adjustment. 2019-11-01 23:00:12 -04:00
yellows8
e6d687990c
Added setsysGetPlatformRegion/setsysSetPlatformRegion and SetSysPlatformRegion. 2019-11-01 22:57:29 -04:00
yellows8
df4bbcf2d7
Use const for various hid vibration funcs. 2019-11-01 19:11:18 -04:00
yellows8
e2b9b09b61
Added hidIsVibrationDeviceMounted. 2019-11-01 19:04:14 -04:00
yellows8
fa27331045
Initialize time by using TimeServiceType/__nx_time_service_type, with the default now being User. 2019-11-01 13:20:55 -04:00
yellows8
1f792cd92f
Various improvements/fixes and improved docs. Added nvGetServiceSession. Return an actual error when the value for determing which service to init is invalid, for services which use *ServiceType/AppletType. Improved cleanup handling. Fixed inverted logic in the spl cleanup define. 2019-10-31 22:53:42 -04:00
yellows8
4981ea02c0
Updated docs to use the updated name of a define. 2019-10-30 10:50:58 -04:00
yellows8
4ab50e3752
Use official naming instead of 'title(ID)'. Use 'uid(s)' instead of 'userID(s)'. Updated various struct field names. Improved docs + minor other improvements. 2019-10-30 10:38:05 -04:00
HookedBehemoth
4f72bc5342 Actually return values for ncmContentMetaDatabaseList and ncmContentMetaDatabaseListApplication (#344) 2019-10-30 02:16:19 +01:00
yellows8
28e06a94ec
usbhs: Swapped the INPUT/OUTPUT endpoint descriptors in UsbHsInterfaceInfo to support [8.0.0+], and convert that struct to the new layout internally when running on pre-8.0.0. Closes #341. 2019-10-29 16:48:20 -04:00
yellows8
ccea53c837
ns: Updated param names for nssuRequestSendSystemUpdate/nssuControlRequestReceiveSystemUpdate and improved docs. 2019-10-29 12:09:10 -04:00
fincs
f062c6ecab
resolver: Clean up and simplify gethostbyname/gethostbyaddr/getnameinfo 2019-10-28 14:04:25 +01:00
fincs
af4a025e9b
sfdnsres: Correct some more parameter names 2019-10-28 13:27:55 +01:00
fincs
0378d553e0
resolver: Minor codestyle fixes 2019-10-28 13:00:07 +01:00
fincs
1e0bcfbf87
resolver: Add commands to configure behavior (most not implemented) 2019-10-28 12:36:43 +01:00
fincs
a2c35fb2e7
sfdnsres: timeout parameter is actually cancel_handle 2019-10-28 12:36:43 +01:00
fincs
26f620dc0e
Split up socket.c + work in progress changes:
- DNS stuff moved to runtime/resolver.c & .h
- Address manipulation functions moved to runtime/util/inet_addr.c
- Removed sfdnsres/nifm handling in runtime/devices/socket.c
- Renamed socketGetLastBsdResult to socketGetLastResult
- Renamed socketGetLastSfdnsresResult to resolverGetLastResult
- gethostid now inits/deinits nifm as needed
- sfdnsres related configuration gone from SocketInitConfig
- Fixed bug in addrinfo deserialization
- getaddrinfo rewritten, hints can now be NULL
- TODO: add back a way to control service discovery/cancel handle
2019-10-28 12:36:29 +01:00
Michael Scire
989893721f ro: rename GetProcessModuleInfo 2019-10-28 12:18:14 +01:00
Michael Scire
8394986e19 ldr: update names 2019-10-28 12:18:14 +01:00
Michael Scire
07ad046acf svc: change TitleId to ProgramId 2019-10-28 12:17:55 +01:00
yellows8
4ecc597d0d
ncm: Renamed the titleID field in NcmProgramLocation to program_id. Minor docs adjustment. 2019-10-28 02:21:23 -04:00
yellows8
9d7f968773
NcmContentMetaKey title_id field renamed to id. 2019-10-27 21:19:49 -04:00
yellows8
622c0509a5
ncm: Added alignas within the NcmContentId struct, and added NcmPlaceHolderId. Use NcmPlaceHolderId instead of NcmContentId where needed. 2019-10-27 19:19:16 -04:00
yellows8
01133f7f6d
Use const for the location param with pmshellLaunchProgram. 2019-10-27 18:22:54 -04:00
fincs
1592b2892f
sfdnsres: Major rewrite using new-ipc, fixed numerous IPC bugs, removed phantom commands 2019-10-27 17:25:53 +01:00
yellows8
b6af00d908
Updated the NsSystemDeliveryInfo struct and added nsGetSystemDeliveryInfo. 2019-10-26 23:40:53 -04:00
yellows8
b0980e4c9f
Fixed the type for key_generation in NcmRightsId. 2019-10-26 22:15:23 -04:00
fincs
5340c7d7dc
Add multithreaded BSD/socket support; revise BSD service type handling so that bsd:u is the default (since it has 22 worker threads as opposed to bsd:s's 11) 2019-10-26 17:26:04 +02:00
fincs
bc13692938
Introduce SessionMgr for managing multiplexed services; change fs to use it 2019-10-26 16:44:32 +02:00
yellows8
051ad2dc60
Improved bool handling, clear IPC in-struct padding, and use serviceAssumeDomain prior to serviceClose in non-_{name}Cleanup funcs. Removed PACKED from the _usbHsIfCtrlXferAsync IPC in-struct. Fixed the code setting the IPC in-struct for _nsCmdRequestSendReceiveSystemUpdate, which is used by nssuRequestSendSystemUpdate/nssuControlRequestReceiveSystemUpdate. Minor other changes. Updated a param name for capsscCaptureRawImageWithTimeout. 2019-10-25 20:29:43 -04:00
yellows8
b4a003e176
fs: Minor improvements. Fixed cmd order. IPC improvements + clear padding in IPC in-struct. Improved bool handling. 2019-10-25 19:35:59 -04:00
yellows8
e833257b65
applet: Minor internal improvements. Updated param type for appletRequestLaunchApplicationWithUserAndArgumentForDebug. Clear IPC in-struct padding, improved bool handling, and use serviceAssumeDomain when closing Service objects outside of _appletCleanup. 2019-10-25 19:24:56 -04:00
yellows8
04179b286d
nfc: Replaced the handle within NfcDeviceHandle with an u8-array. Removed PACKED from the nfpCreateApplicationArea in-struct. Improved bool handling. 2019-10-25 19:11:03 -04:00
yellows8
5700b8f347
fsldr/ldr/spl: Improved bool handling and minor other changes. Fixed IPC input for _ldrAddTitleToLaunchQueue. 2019-10-25 18:56:41 -04:00
fincs
58e1e7e5b6
bsd: Update for new-ipc 2019-10-25 17:19:30 +02:00
yellows8
e5c1e35ede
vi: Renamed viGetDisplayMinimumZ to viGetZOrderCountMin, and renamed viGetDisplayMaximumZ to viGetZOrderCountMax. Updated param types. Clear IPC in-struct padding + minor other changes. 2019-10-24 18:06:33 -04:00
fincs
4ab2384449
fatal: Rename functions/types to match official names more closely 2019-10-24 23:25:07 +02:00
yellows8
a808c53efc
ncm/pm: Added NcmProgramLocation, which is now used by pmshellLaunchProgram (which was renamed). Updated pm names to match wiki. Adjusted order in pm.c/pm.h / minor changes. 2019-10-24 16:42:52 -04:00
yellows8
0d5e51757d
grc: Renamed grcdRead to grcdTransfer and updated the param names for it. 2019-10-23 23:32:33 -04:00
yellows8
e81b63ac00
ncm: Moved the cmd_id param for the internal IPC helper funcs to the last param. 2019-10-23 20:01:27 -04:00
yellows8
ea5dcfddfa
ncm: Renamed NcmNcaId to NcmContentId. Added NcmRightsId struct, which is now used by the RightsId funcs. Updated params / params types, this includes replacing array buf-byte-sizes with entry-count. Fixed handling for ncmContentStorageGetPath/ncmContentStorageGetPlaceHolderPath. Improved bool handling + clear IPC in-struct padding. Minor improvements. 2019-10-23 19:14:04 -04:00
yellows8
e4657c15ce
fspr: Use domains. Clear padding for the fsprRegisterProgram in-struct. 2019-10-23 18:41:01 -04:00
yellows8
42b6af8e07
lr: Use SfBufferAttr_FixedSize in _lrResolvePath(). 2019-10-22 18:53:20 -04:00
fincs
d025041e3d
sm: Introduce and use SmServiceName struct (with better codegen) 2019-10-22 20:10:52 +02:00
yellows8
7103b08740
sm: Minor improvements + IPC input improvements. Minor param type adjustment for smRegisterService. 2019-10-22 10:20:21 -04:00
fincs
e9e392bbe2
binder: Update for new-ipc 2019-10-22 16:11:10 +02:00
Michael Scire
145ad1ba87 virtmem: fix incorrect bounds check 2019-10-22 12:42:07 +02:00
fincs
9e83f82a62
Enhance fsOpen_SystemSaveData/fsdevMountSystemSaveData 2019-10-21 21:15:40 +02:00
fincs
47b0403333
Pass plain AccountUid inputs by value instead of by non-const pointer 2019-10-21 16:57:01 +02:00
fincs
13fbde91b0
fsdev: Added fsdevMountSaveData/SystemSaveData wrappers 2019-10-21 12:38:18 +02:00
fincs
54f6fa5420
fs: Use official method names, document min sysver, correct a few parameters 2019-10-21 12:37:38 +02:00
fincs
c77b88d868
Major cleanup and refactor of fsdev and romfsdev, see details:
fsdev:
- Removed fsdevGetDefaultFileSystem and default-fs handling
- Refactored CWD support to have (dynamically allocated) per-device CWDs
  (CWD support as a whole can be turned off with __nx_fsdev_support_cwd)
- Optimized calls by passing pointer to device through r->deviceData
- Use the per-thread path buffer directly as the argument to FS functions
- Removed redundant cross-device check in fsdev_rename
- Fixed string comparison logic in fsdevFindDevice
- fsdev_fixpath now accepts an input device in order to skip device
  lookup (extensively used along with r->deviceData)
- Mounting a filesystem now automatically sets the default device
  if there wasn't any previous default device (or if it's stdnull)
- fsdevMountSdmc no longer sets cwd to the folder containing the
  executable - this logic was moved to a new internal function
  called on startup by default (and it is now disabled for NSOs)
- Other miscellaneous optimizations

romfsdev:
- Cleaned up romfsMount* functions, removed unused/unnecessary logic
- Changed romfsMount* functions to return real result codes
- Renamed romfsMount to romfsMountSelf and improved documentation
- Removed romfsInitFromFile and romfsInitFromStorage (use Mount instead)
- Added documentation for romfsInit and romfsExit
2019-10-20 22:22:04 +02:00
yellows8
0403c988ba
hidsys: Fixed cmd order. Fixed output size for hidsysGetUniquePadSerialNumber. 2019-10-20 02:35:30 -04:00
fincs
26a0ee4af3
fsdev/romfsdev: Reduce TLS usage by sharing the path buffer 2019-10-20 02:48:04 +02:00
yellows8
a774fb81cc
Added hidsysSetNotificationLedPatternWithTimeout. Updated docs with sysver requirements which were previously missing. 2019-10-19 19:51:51 -04:00
Michael Scire
2e2d227ac7
vi: update for new-ipc 2019-10-20 01:13:40 +02:00
Michael Scire
23950cc10e
lr: update for new-ipc 2019-10-20 01:13:40 +02:00
Michael Scire
9e2df3ad53
ldr: update for new-ipc 2019-10-20 01:13:40 +02:00
Michael Scire
a3e7b1affb
smm: update for new-ipc 2019-10-20 01:13:40 +02:00
Michael Scire
71b44cfb02
psc: update for new-ipc 2019-10-20 01:13:39 +02:00
Michael Scire
61fabbe1bc
i2c: update for new-ipc 2019-10-20 01:13:39 +02:00
Michael Scire
861e9d7c3d
fsldr: assume domain 2019-10-20 01:13:23 +02:00
Michael Scire
7292ddfcd8
fspr: update for new-ipc 2019-10-20 01:11:27 +02:00
Michael Scire
77563f027a
bpc: update for new-ipc 2019-10-20 01:11:26 +02:00
Michael Scire
040767ce57
clkrst: update for new-ipc 2019-10-20 01:11:25 +02:00
Michael Scire
960f99e7a2
pcv: update for new-ipc 2019-10-20 01:11:24 +02:00
Michael Scire
16fde00323
spsm: update for new-ipc 2019-10-20 01:11:23 +02:00
Michael Scire
48905d70d2
gpio: update for new-ipc 2019-10-20 01:11:23 +02:00
yellows8
edcd25bdae
Added hiddbgWriteSerialFlash. 2019-10-19 18:42:45 -04:00
yellows8
ecd6cd73ca
Fixed hiddbgReadSerialFlash. Added hiddbgAcquireOperationEventHandle and hiddbgGetOperationResult. 2019-10-19 12:19:23 -04:00
yellows8
9b44261767
Fixed memset in usbHsEpClose() which was using sizeof() with the wrong struct. Closes #337. 2019-10-18 22:29:20 -04:00
SciresM
415adf5b93 threads: support using existing mem as stack (#336) 2019-10-19 04:25:23 +02:00
fincs
69a63bbee8
fsdev: Reduce TLS footprint for rarely used codepaths 2019-10-19 04:00:50 +02:00
yellows8
5f5d4c9785
pdm: Renamed PdmApplicationEvent to PdmAppletEvent, and renamed pdmqryQueryApplicationEvent to pdmqryQueryAppletEvent. Renamed *entryindex fields in various structs to *entry_index. Updated param types and minor param name adjustments. 2019-10-18 16:53:26 -04:00
fincs
3c610fb2cb
fsdev: Allow directory entry cache size to be configured dynamically 2019-10-18 21:23:11 +02:00
yellows8
d1c045f745
usbhs: Updated for new-ipc. Minor improvements and improved docs. 2019-10-17 23:23:06 -04:00
yellows8
e82819d8a4
usbds: Updated for new-ipc. Added sysver checking. Updated the intf_num param type for usbDsRegisterInterfaceEx, likewise with intf_num fields used elsewhere. Renamed the Service 'h' field in UsbDsInterface/UsbDsEndpoint to 's'. Minor improvements + improved docs.
usbComms: Fixed locking issue which caused a hang in usbCommsInitialize*() when init fails.
2019-10-17 17:34:36 -04:00
yellows8
45bf08bf8d
audren: Updated for new-ipc. Renamed audrenGetServiceSession to audrenGetServiceSession_AudioRenderer. Use the [3.0.0+] *Auto cmd with audrenRequestUpdateAudioRenderer when available. Minor adjustments + improved docs. 2019-10-16 10:14:57 -04:00
yellows8
d40cc55833
audin: Updated for new-ipc. Use the [3.0.0+] *Auto cmds when available. Added count param to audinListAudioIns. Added audinGetServiceSession and audinGetServiceSession_AudioIn. 2019-10-15 19:58:12 -04:00
yellows8
6fb5806d51
audout: Minor internal adjustment. 2019-10-15 19:07:55 -04:00
yellows8
80cc0bb86a
audout: Added audoutGetServiceSession and audoutGetServiceSession_AudioOut. Improved docs. 2019-10-15 18:13:22 -04:00
yellows8
dcafcd0d94
audout: Use the [3.0.0+] *Auto cmds when available. 2019-10-15 17:27:26 -04:00
yellows8
39a67c6c31
audout: Updated for new-ipc. Added count param to audoutListAudioOuts. 2019-10-15 14:07:28 -04:00
yellows8
1526e8e98e
Updated hwopus for new-ipc. Added types.h include to auddev.h/hwopus.h. 2019-10-14 21:07:38 -04:00
yellows8
f4ce807b1b
auddev: Updated for new-ipc and improved docs. 2019-10-14 19:59:04 -04:00
yellows8
98968b45f3
nfc: Replaced HidControllerID usage with struct NfcDeviceHandle. Updated params for nfpListDevices. Minor internal changes. 2019-10-14 17:21:38 -04:00
yellows8
a14cd3a70c
set: Replaced SetSysFlag/setsysGetFlag/setsysSetFlag with dedicated funcs for each flag, which also handles checking sysver now when needed. Fixed cmd order. Improved docs. 2019-10-14 14:31:22 -04:00
yellows8
a489a123c2
grc: Updated for new-ipc and fixed cmd order. 2019-10-13 22:49:06 -04:00
yellows8
67ccc66f15
Changed the nfpu prefix to nfp. Changed the nfcu prefix to nfc. Renamed nfpuIsNfcEnabled to nfcIsNfcEnabled. Added nfpSetServiceType/nfcSetServiceType and the enums for it. Moved nfc service init/exit into seperate funcs nfcInitialize/nfcExit. Renamed NfpuInitConfig to NfcRequiredMcuVersionData, removed it from nfpInitialize() input, and handle it properly as an array. Minor other changes. 2019-10-13 19:38:24 -04:00
yellows8
1a0b5569ab
nfc: Updated for new-ipc. Added sysver check for nfpuAttachAvailabilityChangeEvent which was missing. Fixed the order of cmds. Renamed nfpuGetInterface to nfpuGetServiceSession_Interface. Added nfpuGetServiceSession, nfcuGetServiceSession, and nfcuGetServiceSession_Interface. Various minor changes and improved docs. 2019-10-13 13:36:51 -04:00
yellows8
16e4e9e2b3
hid: Updated for new-ipc. Updated param types. Minor improvements and improved docs. 2019-10-12 12:29:51 -04:00
yellows8
58346564f7
irs: Updated for new-ipc. Improved docs. 2019-10-11 22:35:56 -04:00
yellows8
5b51efe4a8
hiddbg: Updated for new-ipc. Improved docs. 2019-10-11 21:27:32 -04:00
yellows8
55f769e0b8
hidsys: Updated for new-ipc. Updated param types. Fixed cmd order. Fixed _hidsysGetMaskedSupportedNpadStyleSet to actually use the input AppletResourceUserId, not g_hidsysAppletResourceUserId. Added hidsysAcquireSleepButtonEventHandle to the .h, which was previously missing. Minor changes + improved docs. 2019-10-11 15:34:34 -04:00
yellows8
d3376aa816
lbl: Updated for new-ipc and improved docs. 2019-10-11 11:18:51 -04:00
yellows8
d25144afbd
pl: Updated for new-ipc. Updated param types for plGetSharedFontByType and plGetSharedFont. Improved docs and minor other changes. 2019-10-11 01:47:23 -04:00
yellows8
44c45555cd
pctl: Updated for new-ipc. Added pctlGetServiceSession and pctlGetServiceSession_Service. 2019-10-10 22:03:22 -04:00
yellows8
1b610070f5
pdmqry: Updated for new-ipc and updated for using AccountUid. Renamed pdmqryGetUserPlayedApplications to pdmqryQueryRecentlyPlayedApplication. Renamed pdmqryGetUserAccountEvent to pdmqryGetRecentlyPlayedApplicationUpdateEvent. Minor param name adjustment. 2019-10-10 21:06:14 -04:00
yellows8
39288a832e
capssc: Updated for new-ipc. 2019-10-10 13:01:25 -04:00
yellows8
21e35ede7c
capsu: Updated for new-ipc. Updated param types for capsuGetAlbumFileList*(), and updated for using AccountUid. Improved docs. 2019-10-10 12:44:21 -04:00
yellows8
2940833a1b
caps(su): Updated for new-ipc. Updated for using AccountUid. 2019-10-08 22:01:37 -04:00
yellows8
3a1459cf4c
applet: Updated for using AccountUid and improved docs. 2019-10-08 21:05:00 -04:00
yellows8
3e5c129431
fs: Updated for using AccountUid and removed FS_SAVEDATA_USERID_COMMONSAVE. 2019-10-08 18:05:25 -04:00
yellows8
929990b7c8
web/friendsLa: Updated for using AccountUid. Renamed webConfigSetUserID to webConfigSetUid, and renamed WebArgType_UserID to WebArgType_Uid. 2019-10-08 17:44:53 -04:00
yellows8
95f91c431c
account: Updated for new-ipc. Renamed the username field in AccountProfileBase to nickname. Fixed various param types, and also removed the output bool from accountGetLastOpenedUser. Added struct AccountUid for proper userIDs, which replaces u128-userIDs. Added accountUidIsValid. Added accountSetServiceType()/AccountServiceType. Improved docs and minor improvements.
env: Updated UserIdStorage handling for using AccountUid.
2019-10-08 15:41:18 -04:00
yellows8
040b33c457
time: Updated for new-ipc. Renamed _timeGetClockSession to timeGetServiceSession_SystemClock, and added it to the .h. Added timeGetServiceSession_TimeZoneService. Fixed the order of cmds. Fixed param types for timeGetTotalLocationNameCount, timeLoadLocationNameList, timeToPosixTime, and timeToPosixTimeWithMyRule. The location_name_size param for timeLoadLocationNameList was replaced with location_name_max, which is max entries instead of buffer byte-size. Internal improvements and improved docs. 2019-10-06 22:06:22 -04:00
yellows8
ae582d8cb4
Changed the output of appletGetOperationMode/appletGetPerformanceMode to enums AppletOperationMode/ApmPerformanceMode. 2019-10-06 19:05:58 -04:00
yellows8
71e249e6a4
apm: Updated for new-ipc. Added enum ApmPerformanceMode. Added apmGetServiceSession_Session. Improved docs. 2019-10-06 19:02:05 -04:00
yellows8
ed2d72b9ff
csrng: Updated for new-ipc. Removed copyright comment-header in the .c (other .c don't have it and the .h has one anyway). 2019-10-06 15:49:36 -04:00
yellows8
e320f3cdf1
psm: Updated for new-ipc and minor internal improvements. 2019-10-06 12:24:29 -04:00
yellows8
f58c7fe786
Fixed includes in nifm.h/wlaninf.h. 2019-10-05 20:47:24 -04:00
yellows8
75795933a7
nifm: Updated for new-ipc. Added nifmGetServiceSession_StaticService and nifmGetServiceSession_GeneralService. Fixed order of cmds and improved docs. Improved _nifmCreateGeneralService. 2019-10-05 12:38:42 -04:00
yellows8
be2cb63722
wlaninf: Updated for new-ipc. 2019-10-04 20:36:51 -04:00
yellows8
1c334bafb9
set: Updated for new-ipc. Changed the type of the Language param for setMakeLanguage*() from s32 to SetLanguage. Added size_out param to setsysGetSettingsItemValue which was previously missing. Minor param name adjustment for setsysBindFatalDirtyFlagEvent. Improved docs. 2019-10-04 14:41:10 -04:00
yellows8
c8550c378b
Include sf/service.h instead of sm.h, in the service/ headers for services which were previously updated for new-ipc. 2019-10-04 10:20:15 -04:00
yellows8
62192cac0a
Removed sm.h include from applet.c which is no longer needed. 2019-10-03 21:48:36 -04:00
yellows8
c4b1a68269
applet: Added macros in applet.c for defining cmds' impl in a single line, using the ipc helper funcs. Some cmds which previously didn't have NotInitialized checks now do so via the macros. Fixed the order of some cmds. 2019-10-03 20:03:45 -04:00
XorTroll
9eb4bfca20 Add missing hidsys function in header 2019-10-03 17:28:35 +02:00
Adubbz
0395a4190e Adjust NcmApplicationMetaExtendedHeader for 9.0.0 2019-10-03 16:09:33 +02:00
yellows8
9916fe93a0
applet: Updated for new-ipc, various internal improvements, and changed the transfer_size param type for appletReadThemeStorage to u64. 2019-10-02 19:02:20 -04:00
yellows8
f17773c64f
Check for nullptr before copying to out_data in serviceDispatchImpl. 2019-10-01 20:50:09 -04:00
yellows8
127408a1f7
Fixed ipc output/etc for ncmContentStorageListPlaceHolder, nsvmGetSafeSystemVersion, and nsdevPrepareLaunchProgramFromHost (caused by new-ipc changes). 2019-10-01 20:43:03 -04:00
yellows8
2e56959916
Updated ts for new IPC. 2019-09-30 20:04:51 -04:00
yellows8
08272ed12e
Improved docs. Added nsGetServiceSession_GetterInterface, nsGetServiceSession_ApplicationManagerInterface, nsvmGetServiceSession, nsdevGetServiceSession, and nssuGetServiceSession. 2019-09-30 19:23:36 -04:00
Adubbz
33d8c83ddc ncm: Use u8 rather than actual types to ensure correct struct sizes 2019-09-30 16:11:55 +02:00
yellows8
e02f3a82b8
Minor docs fix. 2019-09-30 01:49:32 -04:00
yellows8
80880728e5
Updated NsSystemUpdateProgress docs. 2019-09-30 01:44:34 -04:00
yellows8
fe836e2145
Updated NsSystemDeliveryInfo docs. 2019-09-27 00:18:54 -04:00
yellows8
e0c72684c5
Minor comments alignment adjustment. 2019-09-26 23:48:25 -04:00
yellows8
ab1903e382
Updated the NsSystemUpdateProgress struct. 2019-09-26 23:47:08 -04:00
yellows8
ae9bd198a7
Updated the NsSystemDeliveryInfo struct. 2019-09-26 19:53:55 -04:00
yellows8
e483dc87a0
Added NsApplicationControlSource for use with nsGetApplicationControlData. Fixed actual_size handling for nsGetApplicationControlData. 2019-09-26 18:42:47 -04:00
yellows8
653a1a6b9a
Fixed the param and sysver-check for nsvmGetSafeSystemVersion, and updated docs. 2019-09-26 17:21:54 -04:00
yellows8
075a743cfb
Added support for nssu, and added the structs/enums for it. Added NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT. Moved cmd_id param in the ns helper funcs to the last param. Improved docs. 2019-09-26 17:07:26 -04:00
yellows8
0749dfd67f
Added services/async. 2019-09-26 16:57:39 -04:00
Adubbz
8330f23d20 Updated ncm to new libnx ipc (#331)
* Updated to new libnx ipc
* Improved docs
* Added firmware req comments
* Improved ncmContentMetaDatabaseGetContentIdByType
* Fix ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset
2019-09-25 21:52:51 -04:00
yellows8
f9eb0c88ee
Use new IPC with ns. Updated the params for nsListApplicationRecord/nsListApplicationContentMetaStatus. Updated docs. 2019-09-23 21:01:10 -04:00
yellows8
c93fab39c8
Added ncm docs. 2019-09-23 17:00:16 -04:00
yellows8
66a4db694b
Added docs for FsStorageId. 2019-09-23 16:58:58 -04:00
fincs
b30b567228
fsdev: Convert time into proper POSIX UTC timestamps (FS reports local time instead) 2019-09-22 18:14:10 +02:00
fincs
c3f0210cf6
time: Correct timeToPosixTime(WithMyRule) to accept number of timestamps instead of raw byte size 2019-09-22 18:12:28 +02:00
fincs
ecbc77840e
fs: Update names of enum/flag types for style consistency and correctness 2019-09-21 19:54:21 +02:00
fincs
77888f8b1f
fs: Use new IPC interface + fixes, see details:
- Argument types corrected to better reflect their actual types
  (mostly several incorrect instances of size_t were changed to u64)
- Const correctness fixes
- fsEventNotifierGetEventHandle changed to output an Event (with
  user configurable autoclear) instead of a raw Handle
2019-09-21 16:27:15 +02:00
fincs
21d15b5a8e
cmif: Fix C++ warnings and errors 2019-09-21 14:15:19 +02:00
fincs
62d795a3c6
fs: Add support for setting priority through IPC context [5.0.0+] 2019-09-21 03:31:08 +02:00
fincs
8a0aef8824
Fix new compiler warnings raised by GCC 9.x 2019-09-21 00:58:33 +02:00
Michael Scire
76daefae78 ro: update to use new-ipc 2019-09-20 12:17:57 -07:00
Michael Scire
f5f768ea5c fsldr: update to use new-ipc 2019-09-20 12:17:46 -07:00
Michael Scire
aafbc310c2 spl: update to use new-ipc 2019-09-20 12:17:27 -07:00
Michael Scire
f465206082 pm: update to use new-ipc 2019-09-20 12:16:54 -07:00
fincs
10d07f3a8a
fs: Implement skeleton required for new IPC and multi-session support (no actual cmds converted yet to new IPC) 2019-09-20 19:39:32 +02:00
fincs
d7564ce80d
Add serviceAssumeDomain + minor codegen optimization in serviceDispatch* 2019-09-20 19:27:24 +02:00
fincs
96fc7dd8cd
Minor style fixes in new IPC code 2019-09-20 14:54:45 +02:00
fincs
5ab1219f40
Add internal service guard helper, needed for proper thread safe service init/exit 2019-09-20 02:28:46 +02:00
fincs
c3b920d210
cmif/service: Support passing optional 5.0.0+ context data to requests 2019-09-20 01:48:10 +02:00
fincs
4eda677b93
Add compiler optimization hint to remove unused domain handling code 2019-09-20 01:36:22 +02:00
fincs
2224be3f88
Add cmifCloneCurrentObject and serviceClone (i.e. non-Ex variants) 2019-09-20 00:11:44 +02:00
fincs
dedd29b431
sm: Remove smHasInitialized (use Initialize+GetService+Exit instead) 2019-09-19 23:47:37 +02:00
fincs
43ad77e8d2
nv: Use new IPC interface 2019-09-19 13:23:16 +02:00
fincs
20b26296af
Replace serviceClone with serviceCloneEx 2019-09-19 13:21:21 +02:00
fincs
99c325ed5b
Further cleanup in SM code; smEncodeName is now constexpr 2019-09-19 12:56:21 +02:00
fincs
51db782e7a
fatal: Use new IPC interface 2019-09-19 04:23:00 +02:00
fincs
6ad0042147
Introduce new IPC interface wrapper code, see details:
- Service object moved away from sm.h and into its own file (sf/service.h)
- Service object completely redesigned, but a (mostly)
  backwards compatible API was kept
- New low level HIPC request/response code
- New CMIF client-oriented code
- New service IPC dispatch functions
- Pointer buffer size automatically retrieved for all sessions
- Removed previous manual pointer buffer size query code
- SM rewritten with new IPC code
- All other services are still pending IPC rewrite
2019-09-19 03:50:28 +02:00
fincs
0a3592d4dd
Deprecate current IPC interface 2019-09-19 02:58:12 +02:00
fincs
02b5d3b474
Introduce NX_INLINE and NX_CONSTEXPR 2019-09-19 02:46:13 +02:00
yellows8
f4fe3376bd
Fixed the names for nsdevLaunchApplication, nsdevLaunchApplicationWithStorageId, nsdevGetRunningApplicationProcessId, and nsdevSetCurrentApplicationRightsEnvironmentCanBeActive. Updated the sysver checks for nsdevIsSystemMemoryResourceLimitBoosted since it was removed with [9.0.0+]. 2019-09-17 13:19:29 -04:00
yellows8
87332e2685
Added SetLanguage_ZHHANS/SetLanguage_ZHHANT. Added SetRegion_CHN, SetRegion_KOR, and SetRegion_TWN. 2019-09-15 23:39:42 -04:00
yellows8
ceab0a693c
Updated docs. 2019-09-14 22:55:25 -04:00
yellows8
b1317d3ff8
Added ts. 2019-09-14 20:46:37 -04:00
yellows8
fa25df27d0
Added support for friendsLa. Added friends.h. 2019-09-14 19:26:07 -04:00
fincs
3d682b6748
Release v2.5.0 2019-09-14 19:23:09 +02:00
yellows8
4ce9c0b038
Updated hdls to support [9.0.0+]. Added hiddbgGetUniquePadDeviceTypeSetInternal. Actually load the output rc from resp in AbstractedPad/VirtualPad funcs. 2019-09-14 11:13:56 -04:00
yellows8
042c756d72
Added HidDeviceTypeBits and HidDeviceType. Updated docs. 2019-09-14 11:05:16 -04:00
fincs
c10e70df3a
Fix typo 2019-09-13 13:16:54 +02:00
SciresM
c55383c973 lr: fix 9.x RedirectApplication* commands (#326)
* lr: fix 9.x RedirectApplication* commands

* lr: correct LegalInformation->ApplicationLegalInformation
2019-09-13 12:34:21 +02:00
yellows8
9d632b856d
Added HidNpadInterfaceType enum. 2019-09-13 02:47:53 -04:00
yellows8
326619c271
Added hidGetNpadInterfaceType. 2019-09-13 00:05:43 -04:00
yellows8
81781f0782
Use hidControllerIDToOfficial for the input id, with hidSetNpadJoyAssignmentModeSingleByDefault, hidSetNpadJoyAssignmentModeDual, and hidMergeSingleJoyAsDualJoy. 2019-09-12 23:28:07 -04:00
Michael Scire
1a676a68f5 hid: set SYSTEM/SYSTEM_EXT as supported styles.
Starting in 9.0.0, HID shared memory no longer populates
the SystemExt controller (which libnx calls LAYOUT_DEFAULT) unless
it is explicitly set as supported. This changes hidInitialize() to
set it and System as supported.
2019-09-12 12:48:27 +02:00
yellows8
b06a6ff29f
Updated sysver checks for the AbstractedPad cmds which were removed in [9.0.0+]. 2019-09-11 16:36:08 -04:00
yellows8
b89191c435
Added support for launching the Album applet via albumLa. 2019-09-09 11:10:33 -04:00
yellows8
76e86a9a80
Updated the AlbumReportOption enum. 2019-09-08 20:11:56 -04:00
yellows8
297f84c912
Updated docs. 2019-09-08 19:23:29 -04:00
yellows8
b7311b6ab1
Added support for capsu. Updated caps.h. Improved docs. Added enum CapsContentType. Added structs CapsScreenShotAttributeForApplication, CapsScreenShotDecodeOption, CapsApplicationAlbumFileEntry, and CapsLoadAlbumScreenShotImageOutputForApplication. Added capsGetDefaultStartDateTime, capsGetDefaultEndDateTime, capsConvertApplicationAlbumFileEntryToApplicationAlbumEntry, and capsConvertApplicationAlbumEntryToApplicationAlbumFileEntry. 2019-09-08 19:20:17 -04:00
yellows8
7d71d4f3a1
Use BufferType_Type1 in _capssuSaveScreenShotEx0, instead of a constant. 2019-09-02 16:46:21 -04:00
friedkeenan
fdb1605fc5 Require whole mount name to match when finding a romfs (#324) 2019-09-02 21:22:49 +02:00
yellows8
4f74aa1ad1
Updated docs for OffscreenRecordingParameter. Updated param names for grcMovieMakerFinish. 2019-08-31 19:07:11 -04:00
yellows8
7d08c7cc7c
Updated CapsAlbumFileDateTime. Updated docs. 2019-08-31 11:53:15 -04:00
yellows8
eeabd3bed0
Added capssuSaveScreenShotWithUserData, capssuSaveScreenShotWithUserIds, capssuSaveScreenShotEx1, and capssuSaveScreenShotEx2. Updated params for capssuSaveScreenShot and capssuSaveScreenShotEx0. Added enum AlbumReportOption, and structs CapsApplicationData/CapsUserIdList. Updated CapsScreenShotAttribute. Updated docs. 2019-08-30 23:17:58 -04:00
yellows8
5dc2fc0b7e
Removed AlbumFileEntry and reverted grcMovieMakerFinish back to using CapsApplicationAlbumEntry, since AlbumFileEntry is a duplicate of multiple other structs. 2019-08-30 12:55:50 -04:00
yellows8
7515bb4466
Use SetShimLibraryVersion with capssu. 2019-08-29 21:19:58 -04:00
yellows8
6d7d96a751
Added struct AlbumFileEntry, which grcMovieMakerFinish now uses. Updated CapsApplicationAlbumEntry. 2019-08-28 22:56:20 -04:00
yellows8
b269f58f8f
Renamed capsscCaptureScreenshot to capsscCaptureRawImageWithTimeout. 2019-08-28 22:38:12 -04:00
yellows8
318f2b33b6
Added appletCreateMovieMaker. Added support for grc MovieMaker. Improved grc docs. 2019-08-28 18:41:43 -04:00
yellows8
e7209bbcf5
Fixed the name of setsysGetServiceSession in the .c, so that it matches the .h. 2019-08-28 17:14:40 -04:00
yellows8
c790aa0fab
Added capsGetShimLibraryVersion. Added comments to audio.h. 2019-08-27 19:14:18 -04:00
yellows8
3999ec147e
Use serviceIpcPrepareHeader/serviceIpcParse with binder to support using domains. 2019-08-27 18:32:53 -04:00
yellows8
4177031ebe
Use the same style for all system-versions. 2019-08-26 13:05:49 -04:00
yellows8
6246f56305
Changed the type for NacpStruct.ratingAge to s8. 2019-08-26 11:56:24 -04:00
yellows8
0569ca7588
Updated docs. Use proper doxygen sections instead of plain comments, and use same style for all system-versions in applet docs. Internal applet.c improvements. Added appletGetServiceSession_*() funcs. 2019-08-26 10:40:24 -04:00
yellows8
bde3ae5a77
Added binder_session param to nwindowCreate(), which is now used with the binderInitSession() call instead of a hard-coded Service. Moved the viGetSession_IHOSBinderDriverRelay() call into nwindowCreateFromLayer(), for this new param. 2019-08-25 20:08:22 -04:00
yellows8
5e535bc2eb
Added support for grcd. 2019-08-24 23:30:30 -04:00
yellows8
c8b9120ba4
Updated docs. 2019-08-24 11:00:26 -04:00
yellows8
86ab999ee2
Added grc, for trimming videos. Added appletCreateGameMovieTrimmer, appletReserveResourceForMovieOperation, and appletUnreserveResourceForMovieOperation. Added structs CapsAlbumFileDateTime/CapsAlbumEntryId and updated CapsAlbumEntry. 2019-08-24 10:55:43 -04:00
yellows8
7c18df6d4c
Added appletRequestFlushGamePlayingMovieForDebug. 2019-08-22 10:27:49 -04:00
yellows8
c7cab0351c
Added appletExecuteProgram, appletJumpToSubApplicationProgramForDevelopment, appletRestartProgram, and appletGetPreviousProgramIndex. Added AppletProgramSpecifyKind. 2019-08-21 17:38:35 -04:00
yellows8
79e6db16be
Added appletPrepareForJit. 2019-08-21 12:14:29 -04:00
yellows8
c3b32581c9
Added appletGetLaunchStorageInfoForDebug. 2019-08-20 18:16:45 -04:00
yellows8
8135d6cbc5
Updated applet docs. 2019-08-20 15:17:41 -04:00
yellows8
487aed9a59
Added appletTerminateAllLibraryApplets/appletAreAnyLibraryAppletsLeft and appletApplicationTerminateAllLibraryApplets/appletApplicationAreAnyLibraryAppletsLeft. 2019-08-20 14:33:56 -04:00
yellows8
e069da4320
Added appletHolderTerminate. 2019-08-20 11:44:55 -04:00
yellows8
0f8e18573d
Added appletLaunchDevMenu. 2019-08-20 11:19:49 -04:00
yellows8
447ca35c29
Added appletPopRequestLaunchApplicationForDebug. 2019-08-19 22:08:19 -04:00
yellows8
579a5203b6
Added appletBeginToObserveHidInputForDevelop. 2019-08-19 21:19:47 -04:00
yellows8
7bcea54a65
Updated applet docs. 2019-08-19 19:11:22 -04:00
yellows8
ecd9127bed
Added appletHolderRequestExitOrTerminate and appletApplicationRequestExitLibraryAppletOrTerminate. Minor internal improvements. 2019-08-18 23:15:41 -04:00
yellows8
c34bea8d4c
Improved infinite-sleep-loop handling, and use it for appletStartShutdownSequenceForOverlay/appletStartRebootSequenceForOverlay. 2019-08-18 19:40:17 -04:00
WerWolv
ac75527491 Filled in missing NacpStruct fields (#322)
* Filled in missing NacpStruct fields
2019-08-18 19:23:41 -04:00
yellows8
f1dfb2c23b
Added support for AppletApplication. Added AppletApplicationExitReason. Added AppletApplicationLaunchProperty and AppletApplicationLaunchRequestInfo. Added appletCreateApplication, appletPopLaunchRequestedApplication, appletCreateSystemApplication, appletPopFloatingApplicationForDevelopment, and appletOpenMainApplication. Minor internal changes + updated docs. 2019-08-18 17:30:11 -04:00
Alex Barney
758db03ca4 Add some FS commands (#321)
* Implement fsOpenCustomStorageFileSystem
* Add more FS commands
fsExtendSaveDataFileSystem
fsSetGlobalAccessLogMode
fsGetGlobalAccessLogMode

* Savedata sizes are signed.
2019-08-17 11:36:43 -04:00
yellows8
e7a09f7be7
Added appletGetAppletResourceUsageInfo. Added struct AppletResourceUsageInfo. 2019-08-17 00:34:46 -04:00
yellows8
19741cb103
Added appletRequestLaunchApplicationWithUserAndArgumentForDebug. 2019-08-16 23:56:29 -04:00
yellows8
2f3fa0030e
Renamed AppletLaunchParameterKind_Application to AppletLaunchParameterKind_UserChannel. 2019-08-16 22:42:10 -04:00
yellows8
7cc9295684
Added appletInvalidateTransitionLayer. 2019-08-16 22:31:01 -04:00
yellows8
fc09340a42
Added appletPerformSystemButtonPressing and the enum types for it. Updated docs. 2019-08-16 22:05:34 -04:00
yellows8
b20147eeb7
Added appletExitAndRequestToShowThanksMessage. 2019-08-16 21:10:35 -04:00
yellows8
287bb00981
Enter an infinite-sleep-loop in _appletExitProcess when the exit cmds were successful, this is used with __nx_applet_exit_mode handling. Minor other changes. 2019-08-16 20:33:09 -04:00
yellows8
10e2e71ea2
Enter infinite-sleep-loop in appletRequestToShutdown/appletRequestToReboot. Minor change in appletHolderJump. 2019-08-16 20:19:50 -04:00
yellows8
112da06f37
Renamed AppletNotificationMessage to AppletMessage. Updated docs. 2019-08-16 15:42:04 -04:00
yellows8
eeaa63aa28
Added appletPushContext/appletPopContext. Added appletHolderJump. Added appletGetAppletInfo. Added libappletSetJumpFlag. Added structs AppletProcessLaunchReason and AppletInfo. 2019-08-15 21:43:09 -04:00
yellows8
8db92d48a5
Added libappletArgsPop. Improved docs. 2019-08-14 21:55:07 -04:00
yellows8
77961c6ede
Added appletPopInData, appletPushOutData, appletPopInteractiveInData, appletPushInteractiveOutData, appletGetPopInDataEvent, appletGetPopInteractiveInDataEvent, appletPopExtraStorage, appletGetPopExtraStorageEvent, appletUnpopInData, and appletUnpopExtraStorage. Improved docs. 2019-08-14 18:23:11 -04:00
fincs
067492ee17
nvAddressSpaceCreate: call InitializeEx with the proper page size value... 2019-08-14 21:02:56 +02:00
yellows8
5090c54654
Added appletGetMainAppletAvailableUsers. 2019-08-13 21:26:50 -04:00
yellows8
a17c73e783
Added appletGetMainAppletStorageId, appletGetDesirableKeyboardLayout, appletGetIndirectLayerProducerHandle, and appletGetCurrentApplicationId. 2019-08-13 19:06:39 -04:00
yellows8
b09b2deb2d
Added appletRequestExitToSelf. 2019-08-13 17:18:22 -04:00
yellows8
6017cba043
Added comment for NacpStruct. 2019-08-13 12:48:07 -04:00
yellows8
c516388ba0
Added appletCanUseApplicationCore, appletGetMainAppletApplicationControlProperty, and appletGetMainAppletApplicationDesiredLanguage. Added docs for appletGetDesiredLanguage. 2019-08-13 12:46:49 -04:00
yellows8
0137f582da
Added struct AppletAttribute. Use cmd OpenLibraryAppletProxy on [3.0.0+] when running appletInitialize for AppletType_LibraryApplet. 2019-08-12 11:14:58 -04:00
Robin Lambertz
37fdcb5726 svcGetInfo id0 should be an u32
svcGetInfo uses an u32 for id0 in the kernel (which moves W1 and not X1).
2019-08-09 21:18:57 +02:00
fincs
11e3bfd5ac
Release v2.4.0 2019-08-09 02:19:10 +02:00
yellows8
15b3181c93
Fixed docs. 2019-08-08 13:39:07 -04:00
yellows8
f9ccfb79d2
Added appletGetApplicationIdForLogo, appletSetGpuTimeSliceBoost, appletSetAutoSleepTimeAndDimmingTimeEnabled, appletTerminateApplicationAndSetReason, appletSetScreenShotPermissionGlobally, appletStartShutdownSequenceForOverlay, appletStartRebootSequenceForOverlay, and appletSetHandlingHomeButtonShortPressedEnabled. 2019-08-08 13:35:16 -04:00
yellows8
f5b24bd244
Added appletStartSleepSequence, appletStartShutdownSequence, appletStartRebootSequence, appletIsAutoPowerDownRequested, appletLoadAndApplyIdlePolicySettings, appletNotifyCecSettingsChanged, appletSetDefaultHomeButtonLongPressTime, appletUpdateDefaultDisplayResolution, appletShouldSleepOnBoot, and appletGetHdcpAuthenticationFailedEvent. 2019-08-08 11:32:27 -04:00
averne
f13d9ba6cc Added viDestroyManagedLayer (#316) 2019-08-08 12:41:10 +02:00
yellows8
3bbc181531
Added appletRequestToGetForeground, appletLockForeground, appletUnlockForeground, appletPopFromGeneralChannel, and appletGetPopFromGeneralChannelEvent. 2019-08-07 19:57:03 -04:00
SciresM
9049a12209 vi: add ViPowerState_On_Deprecated enum entry (#318) 2019-08-07 21:13:57 +02:00
yellows8
75c79e8d5e
Replaced appletHomeButtonReaderLockAccessorGetEvent with appletGetHomeButtonReaderLockAccessor. Added appletGetReaderLockAccessorEx, appletGetWriterLockAccessorEx, and appletGetHomeButtonWriterLockAccessor. Added support for AppletLockAccessor. 2019-08-05 22:40:14 -04:00
fincs
21de119c68
Run TLS destructor after clearing TLS value, as per standard 2019-08-04 21:03:04 +02:00
yellows8
6c194fc6a6
Added appletRequestToAcquireSleepLock, appletReleaseSleepLock, and appletReleaseSleepLockTransiently. 2019-08-03 20:53:42 -04:00
yellows8
d73e1a09b5
Minor docs change. 2019-08-02 14:28:02 -04:00
yellows8
1bb777afe7
Added support for IAppletCommonFunctions. Added appletReadThemeStorage, appletWriteThemeStorage, appletGetDisplayLogicalResolution, appletSetDisplayMagnification, appletSetHomeButtonDoubleClickEnabled, and appletGetHomeButtonDoubleClickEnabled. Minor other changes. 2019-08-02 14:16:59 -04:00
yellows8
98fbadc778
Added appletUpdateLastForegroundCaptureImage, appletUpdateCallerAppletCaptureImage, appletGetLastForegroundCaptureImageEx, appletGetLastApplicationCaptureImageEx, appletGetCallerAppletCaptureImageEx, appletTakeScreenShotOfOwnLayer, appletCopyBetweenCaptureBuffers, appletClearCaptureBuffer, appletClearAppletTransitionBuffer, appletAcquireLastApplicationCaptureSharedBuffer, appletReleaseLastApplicationCaptureSharedBuffer, appletAcquireLastForegroundCaptureSharedBuffer, appletReleaseLastForegroundCaptureSharedBuffer, appletAcquireCallerAppletCaptureSharedBuffer, appletReleaseCallerAppletCaptureSharedBuffer, and appletTakeScreenShotOfOwnLayerEx. 2019-08-01 12:24:22 -04:00
yellows8
f49e8cb217
Added struct LibAppletInfo. Added appletHolderGetLibraryAppletInfo and appletGetLibraryAppletInfo. 2019-07-30 20:03:24 -04:00
yellows8
64783b7cc2
Updated unk_x8 in the PdmPlayEvent struct. 2019-07-30 18:37:08 -04:00
yellows8
2257e3ccf4
Updated LibAppletMode enum and added appletHolderSetOutOfFocusApplicationSuspendingEnabled. 2019-07-30 17:34:05 -04:00
fincs
b3dd512253 Fix typo in nvAddressSpaceModify 2019-07-30 16:35:35 +02:00
yellows8
6df890c47b
Added appletSetExpectedMasterVolume, appletGetExpectedMasterVolume, appletChangeMainAppletMasterVolume, and appletSetTransparentVolumeRate. 2019-07-29 22:05:32 -04:00
yellows8
773111b3f2
Cache the preselected user in accountInitialize. Get/set the preselected userID in env, so that accountGetPreselectedUser() is usable multiple times. Renamed accountGetActiveUser to accountGetLastOpenedUser. Improved docs. 2019-07-29 19:00:52 -04:00
yellows8
4fa878f4b1
Added hidGetSupportedNpadStyleSet. Moved hidSetSupportedNpadStyleSet to match cmd order. Added hidsysGetSupportedNpadStyleSetOfCallerApplet. 2019-07-29 18:22:46 -04:00
yellows8
7310c8f880
Added appletGetAppletResourceUserIdOfCallerApplet, appletSetAppletWindowVisibility, and appletSetAppletGpuTimeSlice. Minor other change. 2019-07-29 18:18:19 -04:00
fincs
01d648e7ed Add support for new homebrew ABI keys + loader info 2019-07-29 21:17:09 +02:00
yellows8
409957c432
Added appletGetCradleFwVersion, appletIsInControllerFirmwareUpdateSection, appletSetPerformanceConfigurationChangedNotification, and appletGetOperationModeSystemInfo. Moved appletHomeButtonReaderLockAccessorGetEvent to match cmd order. Fixed a check in appletGetDefaultDisplayResolution. 2019-07-28 20:52:37 -04:00
yellows8
93eaa74131
Added appletGetCradleStatus and appletGetBootMode. Added _appletCmdNoInOutU8 for internal use, which _appletCmdNoInOutBool now uses. Fixed docs. 2019-07-27 12:33:56 -04:00
yellows8
79fa22fdbd
Improved pm docs. 2019-07-27 12:30:06 -04:00
yellows8
aeca9041d5
Added appletGetApplicationIdByContentActionName. 2019-07-25 23:47:03 -04:00
yellows8
31d34a6915
Added AppletTvPowerStateMatchingMode and AppletSystemButtonType. Added appletSetLcdBacklightOffEnabled, appletGetDefaultDisplayResolution, appletGetDefaultDisplayResolutionChangeEvent, appletGetHdcpAuthenticationState, appletGetHdcpAuthenticationStateChangeEvent, appletSetTvPowerStateMatchingMode, and appletPerformSystemButtonPressingIfInFocus. Minor other changes. 2019-07-25 21:40:42 -04:00
yellows8
3b2e484d88
Minor appletNotifyRunning improvements and added docs. 2019-07-25 20:26:34 -04:00
yellows8
493abc7703
Moved sections in applet.c/.h to match the order of the get-session cmds. Improved docs/comments. 2019-07-25 16:23:35 -04:00
yellows8
ed2f4a68f7
Added appletIsSystemBufferSharingEnabled, appletGetSystemSharedLayerHandle, and appletGetSystemSharedBufferHandle. 2019-07-24 19:45:39 -04:00
yellows8
974f5b9a1b
Added AppletIdentityInfo and AppletId_application. Moved sections in applet.h to match the applet.c order. Added/updated comments/docs. Check applet-type in _appletExitProcessAndReturn. Added appletSetScreenShotAppletIdentityInfo, appletGetMainAppletIdentityInfo, appletGetCallerAppletIdentityInfo, appletGetCallerAppletIdentityInfoStack, and appletGetNextReturnDestinationAppletIdentityInfo. 2019-07-24 16:20:52 -04:00
Adubbz
b59682652d Implement various SaveDataExtraData commands (#315)
* Implement fsReadSaveDataFileSystemExtraData

* Implement fsReadSaveDataFileSystemExtraDataBySaveDataSpaceId and fsWriteSaveDataFileSystemExtraData
2019-07-24 11:28:05 -04:00
yellows8
a5e4609be3
Added appletGetProgramTotalActiveTime. 2019-07-23 10:57:35 -04:00
averne
2b84eaeaed Fix nfc:user command ids 2019-07-22 22:13:32 +02:00
Adubbz
bc5d01400f Implement fsOpenGameCardFileSystem 2019-07-22 22:09:22 +02:00
yellows8
6942c8db75
Added AppletHookType_RequestToDisplay, AppletNotificationMessage_RequestToDisplay, and AlbumImageOrientation. Added appletSetControllerFirmwareUpdateSection, appletSetDesirableKeyboardLayout, appletSetHandlesRequestToDisplay, appletApproveToDisplay, appletOverrideAutoSleepTimeAndDimmingTime, appletSetIdleTimeDetectionExtension, appletGetIdleTimeDetectionExtension, appletSetInputDetectionSourceSet, appletReportUserIsActive, appletSetAutoSleepDisabled, appletIsAutoSleepDisabled, and appletSetWirelessPriorityMode. Improved docs. 2019-07-20 13:18:58 -04:00
XorTroll
c07a637e2c Fix typo in pdm GetServiceSession command 2019-07-19 19:56:54 +02:00
fincs
bf7479c2a5 Release v2.3.0 2019-07-19 16:06:44 +02:00
Thomas Guillemard
3f6cf66243 Make it possible to use the binder API with an arbitrary service (#309)
This is useful if you want to connect to "dispdrv" for example.
2019-07-18 19:12:03 +02:00
Thog
c73b8ceeb9 fix parcelReadData size checking 2019-07-18 19:11:48 +02:00
yellows8
74337842a0
Added AppletNotificationMessage enum and improved docs. Added support for appletSetRestartMessageEnabled, appletSetRequiresCaptureButtonShortPressedMessage, and appletSetAlbumImageTakenNotificationEnabled. Renamed appletSetScreenShotImageOrientation to appletSetAlbumImageOrientation. 2019-07-17 19:15:53 -04:00
yellows8
f760be337e
Minor internal applet.c improvements. 2019-07-17 17:27:01 -04:00
yellows8
c484b33995
Use InitializeApplicationInfo in accountInitialize when initializing with acc:u0. Handle cleanup on failure in accountInitialize. 2019-07-16 18:20:29 -04:00
yellows8
b896b33e3e
Added appletEnterFatalSection/appletLeaveFatalSection. 2019-07-16 15:47:47 -04:00
yellows8
f13b75d87c
Added appletGetPseudoDeviceId and appletSetApplicationAlbumUserData. Use ipcQueryPointerBufferSize for ISelfController in appletInitialize. Moved appletIsIlluminanceAvailable in applet.h to match cmd order. 2019-07-16 12:27:46 -04:00
Michael Scire
463c0f3379 vi: fix manager/system service init 2019-07-16 00:08:54 +02:00
yellows8
933cfb543d
Added support for applet ApplicationCopyright. Fixed a comment. 2019-07-14 17:42:46 -04:00
yellows8
333de18494
Added appletRequestToShutdown and appletRequestToReboot. 2019-07-13 20:04:26 -04:00
yellows8
3270bf3996
Reordered applet funcs to match cmdid order, improved docs, etc. Added appletBeginBlockingHomeButtonShortAndLongPressed and appletEndBlockingHomeButtonShortAndLongPressed. 2019-07-13 19:45:53 -04:00
yellows8
2262259984
Added appletGetDisplayVersion. 2019-07-13 18:57:37 -04:00
friedkeenan
da4c060278 Add a bunch of GetServiceSession functions (#305)
* Add a bunch of GetServiceSession functions
2019-07-13 15:09:28 -04:00
yellows8
40d7e0de51
Use an enum for appletSetScreenShotPermission with info from wiki. Improved applet docs. Use _appletIsApplication() instead of _appletIsRegularApplication() in appletQueryApplicationPlayStatistics/appletQueryApplicationPlayStatisticsByUid. Added appletGetGpuErrorDetectedSystemEvent. Added support for the [7.0.0+] CreateApplication*ToStartForQuest cmds. 2019-07-13 10:45:40 -04:00
Adubbz
0e724040ad Added fsDeleteSaveDataFileSystemBySaveDataSpaceId (#304) 2019-07-13 14:21:16 +02:00
yellows8
26544cba43
Uodated docs + the PdmAccountEvent struct. 2019-07-09 21:31:01 -04:00
yellows8
f418536e37
Added support for pdmqry. 2019-07-09 21:18:42 -04:00
Adubbz
4f441a4f28 Implement fsCreateSaveDataFileSystemBySystemSaveDataId (and wrappers) + fsDisableAutoSaveDataCreation (#302)
Also fixes everal cases of weird naming in fs
2019-07-05 03:56:52 +02:00
friedkeenan
61c0f4b2d9 Add hidsysGetUniquePadSerialNumber (#303) 2019-07-05 03:55:22 +02:00
Thomas Guillemard
2c1763c692 Add more ITimeZoneService related commands (#300)
This commit adds timeGetDeviceLocationName, timeSetDeviceLocationName, timeGetTotalLocationNameCount, timeLoadLocationNameList, timeLoadTimeZoneRule, timeToPosixTime, timeToPosixTimeWithMyRule, and timeToCalendarTime.
2019-07-03 21:29:24 +02:00
yellows8
9a607a369e
Properly convert the input id in irsGetIrCameraHandle(). 2019-07-01 22:04:48 -04:00
yellows8
ee7b30a7b4
Added KEY_HOME and KEY_CAPTURE for use with HiddbgHdlsState::buttons. 2019-07-01 20:08:10 -04:00
yellows8
015ca9652c
Filled in the PdmApplicationPlayStatistics struct. 2019-06-30 10:46:54 -04:00
yellows8
7f7ba17802
Fixed appletQueryApplicationPlayStatistics and added appletQueryApplicationPlayStatisticsByUid. Renamed AppletApplicationPlayStatistics to PdmApplicationPlayStatistics, updated it, and moved it to new file pdm.h. 2019-06-29 20:44:55 -04:00
yellows8
8147dca2a4
Updated the HiddbgHdlsNpadAssignment struct. 2019-06-28 23:02:39 -04:00
yellows8
b938016a67
Minor hiddbg fixes. 2019-06-28 21:39:33 -04:00
yellows8
156410b549
Added support for AbstractedPad. Improved hiddbgInitialize(). Updated hiddbg docs. 2019-06-28 21:36:53 -04:00
SciresM
950e1ec5ed pm: add bm cmds, BoostSystemThreadResourceLimit (#299) 2019-06-29 00:35:22 +02:00
Michael Scire
a7522f1d4c Mark arguments to svcCreateProcess as const. 2019-06-28 02:35:44 +02:00
yellows8
e1e2a05a34
Added hiddbgUpdateControllerColor and hiddbgUpdateDesignInfo. 2019-06-26 15:05:11 -04:00
Michael Scire
a065244e4b ldr: fix getter error 2019-06-26 19:16:10 +02:00
Michael Scire
48133f72ce ldr: add getters for shell/dmnt/pm 2019-06-26 17:33:10 +02:00
yellows8
74c102ed3f
Added hiddbgReadSerialFlash. 2019-06-25 22:40:49 -04:00
yellows8
a9c35dceb8
Updated comments for HiddbgHdlsDeviceInfo. 2019-06-25 18:41:11 -04:00
yellows8
cebc1bed33
Updated HiddbgHdlsDeviceInfo struct. 2019-06-25 11:33:35 -04:00
Michael Scire
18f977aa76 pm: add getters for pminfo, pmshell 2019-06-25 16:13:52 +02:00
yellows8
65e2e791a3
Updated Hdls structs. 2019-06-24 21:50:17 -04:00
Michael Scire
6978003c42 sm/smm: Add GetServiceSession 2019-06-24 21:43:45 +02:00
SciresM
e1a6a463c2 Add enums for GetInfo/GetSystemInfo (#292) 2019-06-22 00:05:56 +02:00
averne
9c887a13b4 Clear finalized field upon hmac context creation 2019-06-15 16:29:49 -04:00
yellows8
006ebc0633
Fixed romfsUnmount RemoveDevice handling. 2019-06-13 19:41:35 -04:00
yellows8
0d17c53d00
Updated HiddbgHdlsState struct. 2019-06-12 15:43:33 -04:00
yellows8
5a3eb542b2
Updated Hdls structs and docs. Added hidGetControllerDeviceType, hidGetControllerFlags, and hidGetControllerPowerInfo. Added/updated hid structs. 2019-06-08 21:51:46 -04:00
Pablo Curiel
e3d7b12c96 Remove RomFS devoptab device on unmount. 2019-06-08 17:16:55 +02:00
fincs
77f1d357e5 Fix stupid mistake in binderInitSession error cleanup code 2019-06-07 03:14:41 +02:00
yellows8
3e39f97fe5
Added support for hiddbg Hdls. 2019-06-06 20:52:33 -04:00
yellows8
9947048f8b
Added support for [8.0.0+] swkbd functionality: swkbdConfigSetUnkFlag, swkbdConfigSetTrigger, swkbdInlineSetChangedStringV2Callback, and swkbdInlineSetMovedCursorV2Callback. Added swkbdInlineLaunchForLibraryApplet and swkbdInlineSetDecidedCancelCallback. Moved initArg setup into swkbdInlineLaunch*. 2019-06-04 19:13:36 -04:00
thedax
133ffe92fd Implement setsys GetDeviceNickname/SetDeviceNickname (#289)
* Implement setsys(Get/Set)DeviceNickname.

Thanks to @shchmue & @thog for tips on the send/recv buffers!
2019-06-04 10:22:51 -04:00
Adubbz
8cf419802a Implement fsOpenContentStorageFileSystem, fsGetRightsIdByPath & fsGetRightsIdAndKeyGenerationByPath (#288)
* Implement fsOpenContentStorageFileSystem, fsGetRightsIdByPath & fsGetRightsIdAndKeyGenerationByPath
2019-06-03 14:51:21 -04:00
Michael Scire
3afc9ae371 Add FsBisStorageId enum 2019-06-03 14:48:45 -04:00
Michael Scire
4d049ee7c4 enum alignment fixes 2019-06-03 14:48:45 -04:00
Michael Scire
b68441e36f style fixes, note 4.0.0+ 2019-06-03 14:48:45 -04:00
Michael Scire
ac9d76f373 fs: fix file/storage API, add fsdevCreateFile, add fsOpenFileSystemWithPatch. 2019-06-03 14:48:45 -04:00
Ac_K
a3381d3d64 hidsysSetNotificationLedPattern cleanup
Fix a copy/paste issue in hidsysSetNotificationLedPattern
2019-06-01 16:00:28 -04:00
Alex Barney
bd1f9258b2 Fix fsFsCreateFile command parameters 2019-05-31 09:56:03 -04:00
yellows8
d2bfc032f8
Added support for the additional web [8.0.0+] functionality: webConfigSetMediaPlayerUi and webReplyGetMediaPlayerAutoClosedByCompletion. Various other changes. 2019-05-19 15:15:00 -04:00
yellows8
cf8bb1e045
Actually use the commonargs version for [6.0.0+] with web. 2019-05-17 21:35:33 -04:00
Thomas Guillemard
977bb9d7e8 i2c: add ReceiveAudo and ExecuteCommandList
Also make buf const in SendAuto.
2019-05-17 19:38:47 -04:00
fincs
d966bee9fa Const correctness in nvGpuZbcAddColor (and fix comment typo) 2019-05-17 21:20:11 +02:00
fincs
320b054f6e Added nvGpu* wrapper functions for zcull/zbc/tpc ioctls 2019-05-17 21:15:57 +02:00
fincs
f13c3cface Add/correct /dev/nvhost-ctrl-gpu ioctls 2019-05-17 20:03:05 +02:00
yellows8
90620daf05
Added romfsMountFromCurrentProcess(). 2019-05-17 11:15:43 -04:00
yellows8
f6f6adf1cb
Use the proper IPC buffer type for _usbHsEpGetXferReport with [3.0.0+]. 2019-05-16 18:48:19 -04:00
XorTroll
5452a4bd5f Fix ro services 2019-05-11 20:25:06 +02:00
yellows8
836bb367aa
Renamed ipc_buffer_size to pointer_buffer_size for ipcAddSendSmart/ipcAddRecvSmart. 2019-05-11 11:17:33 -04:00
Michael Scire
f92852fbe5 ncm: add NcmContentMetaType, NcmContentMetaAttribute enums 2019-05-09 12:42:50 +02:00
Michael Scire
a1861509f5 ncm: add ncmContentMetaDatabaseGetAttributes 2019-05-09 12:42:50 +02:00
Michael Scire
39db25c81d romfs_dev: fix unmounting/corruption when mounting multiple. 2019-05-09 12:42:15 +02:00
SciresM
e114a361be fsdev: add way of getting last returned result. (#276)
Adds fsdevGetLastResult, which returns a thread local Result updated by every call to fsdev_translate_error.

Also changes fsdev_translate_error to return EIO instead of raw results, when not translatable.
2019-05-08 16:44:17 +02:00
yellows8
e359010e75
Improved fs_dev docs. 2019-05-05 17:17:08 -04:00
Adubbz
1d3e208807 Added fsdevDeleteDirectoryRecursively 2019-05-05 18:26:08 +02:00
yellows8
afaa33df2e
Added partial support for SevenSixAxisSensor. 2019-05-03 18:38:37 -04:00
fincs
d911c47d2e Miscellaneous documentation fixes 2019-05-03 14:32:02 +02:00
Michael Scire
4094c014ff spl: fix BootReason command names 2019-05-03 03:33:56 +02:00
SciresM
c6e115fd1f i2c: flesh out I2cDevice enum (#273)
* i2c: flesh out I2cDevice enum
2019-05-02 17:38:10 -04:00
fincs
a346185801 Release v2.2.0 2019-05-01 19:26:45 +02:00
fincs
42878b603a Use eventActive instead of manually checking Event::revent 2019-04-30 02:31:47 +02:00
CTCaer
67cd70c00c [hid] Update NotificationLed structs (#272)
* [hid] Update NotificationLed structs
2019-04-27 18:11:01 -04:00
yellows8
aad6b55793
Filled in the HidsysNotificationLedPattern struct and added HidsysNotificationLedPatternCycle. Closes #240. 2019-04-26 21:47:02 -04:00
yellows8
46d5771312
const for hidsysSetNotificationLedPattern input pattern. 2019-04-25 19:30:10 -04:00
yellows8
bed9213f41
Added hidsysSetNotificationLedPattern and the struct for it. 2019-04-25 19:27:45 -04:00
yellows8
d4789c37c9
Added hidsysGetUniquePadsFromNpad and hidsysGetUniquePadIds. 2019-04-25 14:31:00 -04:00
SciresM
d6ba6d9625 sm: add retry loop in smInitialize (#270) 2019-04-25 17:43:39 +02:00
Michael Scire
0666e4651e spl: fix cryptAesCtr definition 2019-04-25 14:39:10 +02:00
SciresM
ee34c620f7 pcv: add pcvGetModuleId (#269)
* pcv: add pcvGetModuleId
2019-04-24 19:44:13 -04:00
Samuel P
bc1786b7b0 pcv Set/GetClockRate changes in 8.0.0 (#266)
* version check on pre-8.0.0 pcv funcs
* clkrst API
* Add PcvModuleId enum
2019-04-24 13:36:19 -04:00
yellows8
1dd057ac09
Added pctlConfirmStereoVisionPermission and pctlResetConfirmedStereoVisionPermission. 2019-04-22 12:33:01 -04:00
Michael Scire
9884ce0462 ldr: change ldrDmntGetModuleInfos to match roDmnt 2019-04-22 16:57:03 +02:00
Michael Scire
50db74a15b Implement ro:1 2019-04-22 16:57:03 +02:00
Michael Scire
23bd10f6db ro: add ldrRoLoadNrrEx, fix roDmnt 2019-04-22 16:57:03 +02:00
yellows8
76b6f521fe
Added appletIsVrModeEnabled and appletSetVrModeEnabled. 2019-04-21 13:45:49 -04:00
Michael Scire
6b50fddd9b Implement svcQueryProcessMemory 2019-04-21 13:48:59 +02:00
Michael Scire
4448b354dd loader: fix LoaderModuleInfo definition 2019-04-21 12:15:03 +02:00
yellows8
3b0f2014e3
Added appletGetCurrentIlluminance, appletGetCurrentIlluminanceEx, and appletIsIlluminanceAvailable. 2019-04-20 16:11:05 -04:00
yellows8
2916bd631a
Added pctlIsStereoVisionPermitted. 2019-04-20 16:09:35 -04:00
fincs
1c832bebd6 Avoid overwriting TLS[0x100] and TLS[0x102] as per 8.0.0 2019-04-20 19:19:34 +02:00
fincs
2f70ee6a92 Remove apm:p support as per 8.0.0 2019-04-16 17:45:12 +02:00
Lioncash
896c81246e kernel/ipc: Resolve missing initializer warnings
In C++ projects with higher warning levels, this header can cause some
missing initializer warnings to leak over. This silences those from
occurring.
2019-04-16 00:54:20 +02:00
yellows8
3dde2148cc
Added appletSetCpuBoostMode, appletGetCurrentPerformanceConfiguration, and ApmCpuBoostMode enum. Updated comments / various minor changes. 2019-04-14 12:16:37 -04:00
yellows8
d4de738dfd
Added support for [6.0.0+] web functionality. Various minor changes. 2019-04-12 21:37:53 -04:00
Ezekiel Bethel
26458fc1e8 add 0x402 (path exists) => EEXIST mapping in fs_dev 2019-04-09 22:16:34 -04:00
yellows8
57b028fec5
Added support for swkbd [6.0.0+] functionality. Added swkbdConfigSet*() funcs which should now be used instead of accessing the arg structs directly. Added version checking for some swkbdInlineSet*() funcs. Various other changes. 2019-04-09 18:32:54 -04:00
fincs
a469a68b20 Add custom extension to MOD0 header & a few other useful symbols 2019-04-08 16:36:45 +02:00
yellows8
31dee5072a
Sync FsSave/FsSaveDataInfo with wiki. 2019-04-04 22:31:02 -04:00
yellows8
8a3f105bab
Removed PACKED from FsSaveDataInfo/FsTimeStampRaw and fixed FsSave alignment. 2019-04-04 18:32:45 -04:00
Michael Scire
d2e2c15937 fix makefile arch 2019-04-04 20:13:36 +02:00
Michael Scire
16f8255fd5 crypto: guard #defines with #ifndef 2019-04-04 20:13:36 +02:00
Michael Scire
c3a94f5bce crc: fix -Wsign-compare warning 2019-04-04 20:13:36 +02:00
Michael Scire
408ae95120 cleanup headers, add crc32 acceleration 2019-04-04 20:13:36 +02:00
Michael Scire
e4481e12cb Implement AES-(128, 192, 256)-CMAC 2019-04-04 20:13:36 +02:00
Michael Scire
13a690a5a8 hmac: expose HMAC_*_KEY_MAX defines 2019-04-04 20:13:36 +02:00
Michael Scire
048a0508bf sha1: unroll all the loops inside processing block 2019-04-04 20:13:36 +02:00
Michael Scire
21a704f0b6 Implement accelerated sha1 + hmac-sha1 2019-04-04 20:13:36 +02:00
Michael Scire
0dde100135 Implement accelerated SHA256, HMAC-SHA256 2019-04-04 20:13:36 +02:00
Michael Scire
e4dda8fa46 minor style fixes 2019-04-04 20:13:36 +02:00
Michael Scire
017b47151d Implement accelerated AES-XTS 2019-04-04 20:13:36 +02:00
Michael Scire
82ae0f0c9e cbc/ctr: expose iv/ctr reset 2019-04-04 20:13:36 +02:00
Michael Scire
3eb6dd45a6 Implement accelerated AES-CTR 2019-04-04 20:13:36 +02:00
Michael Scire
9eb74bc9e0 crypto: fix style in aes_cbc, mark handlers inline. 2019-04-04 20:13:36 +02:00
Michael Scire
9c7adf0c44 crypto: add aes-cbc apis. 2019-04-04 20:13:36 +02:00
Michael Scire
f8375c46c0 crypto: add aes-ecb block enc/dec 2019-04-04 20:13:36 +02:00
yellows8
4f0aa0a589
Updated pctlauth docs. 2019-04-01 21:31:46 -04:00
yellows8
39f40b26ae
Added pctl. 2019-04-01 21:29:51 -04:00
yellows8
7b25d55342
Added pctlauth. 2019-03-31 22:01:48 -04:00
yellows8
9bbcee9bcf
Added libappletStart and libappletLaunch. Updated comments. 2019-03-31 21:59:04 -04:00
yellows8
fd9e02b271
Added romfsMountFromFsdev and fsdevTranslatePath. Internal romfs_dev improvements. 2019-03-29 19:49:08 -04:00
fincs
b7a0aaef09 Release v2.1.0 2019-03-29 18:40:27 +01:00
fincs
1096d7ee8f Add --nx-module-name to linker flags 2019-03-29 18:40:27 +01:00
fincs
56471670ee Remove old C11 threads implementation 2019-03-29 18:40:26 +01:00
fincs
9d9b2efe29 devkitA64 r13 support changes, including pthread support 2019-03-29 18:40:26 +01:00
fincs
626b07fac8 Implement TLS slot support (with destructors) 2019-03-29 18:40:26 +01:00
yellows8
2729cafbe0
Updated ErrorContext struct. 2019-03-29 13:36:40 -04:00
yellows8
3a14e9094a
Fixed error handling with appletHolderPushInData() for tmem-storage in swkbdShow(). 2019-03-28 21:01:04 -04:00
yellows8
b463693094 Changed errorApplicationSetNumber to static inline. 2019-03-28 20:19:38 -04:00
yellows8
8b5a4d580d Various minor changes + changed some error* funcs to static inline. Removed errorResultBacktraceClose, errorSystemClose, and errorApplicationClose. 2019-03-28 20:19:38 -04:00
yellows8
b91bc09c57 Added ErrorType enum. errorCode* funcs are now static inline + minor changes. Updated docs. 2019-03-28 20:19:38 -04:00
yellows8
505042bc73 Added ErrorCode and the funcs for it, funcs which use low/desc now use this instead. Updated docs. 2019-03-28 20:19:38 -04:00
yellows8
71a711e5d7 Updated ErrorContext. 2019-03-28 20:19:38 -04:00
yellows8
0ea16ae8c7 Added errorResultRecordShow/errorCodeRecordShow. 2019-03-28 20:19:38 -04:00
yellows8
f6287086d3 Added errorResultShow/errorCodeShow. Updated ErrorCommonHeader and added ErrorPctlArg. 2019-03-28 20:19:38 -04:00
yellows8
6be5ad949e In errorSystemSetContext(), return immediately on pre-4.0.0. 2019-03-28 20:19:38 -04:00
yellows8
68e3204a88 Added support for errorResultBacktrace*. Updated/added error structs. 2019-03-28 20:19:38 -04:00
yellows8
018441a1f6 Added support for errorEulaShow/errorSystemUpdateEulaShow. 2019-03-28 20:19:38 -04:00
yellows8
1ec8e3b29e Added support for error Application. Allow passing NULL to errorSystemCreate() for fullscreen_message, and minor other adjustments. 2019-03-28 20:19:38 -04:00
yellows8
3995447de7 Renamed error funcs and updated/added structs. Updated errorSystemCreate. Merged errorConfigSetShortDescription/errorConfigSetDetailedDescription into errorSystemCreate. Replaced errorConfigSetModule/errorConfigSetDescription with errorSystemSetCode, and added an errorSystemSetResult wrapper. Added errorSystemSetLanguageCode and errorSystemSetContext. 2019-03-28 20:19:38 -04:00
yellows8
9bf699f712 Improved error-applet launching handling. Updated ErrorConfig and added ErrorContext. 2019-03-28 20:19:38 -04:00
Liam Minopulos
ecfc8f8966 Added error LibraryApplet wrapper (#243)
* Implement error applet
2019-03-28 20:19:38 -04:00
plutoo
b7fe92f3a2 rwlock: Move over to condvar implementation. (#255)
This one is superior to the previous because it is write-preferring.
2019-03-28 23:53:04 +01:00
fincs
a4c23a0314 switch_rules: Make sure BUILD_EXEFS_SRC is non-empty before testing it 2019-03-26 13:28:49 +01:00
Michael Scire
5575966d0c fix fsdev bug 2019-03-25 00:02:18 +01:00
Michael Scire
1bea504732 Added fsOpenDataStorageByDataId and romfsMountFromDataArchive 2019-03-25 00:02:18 +01:00
Michael Scire
43128b613b romfs: refactor to allow specifying mount name 2019-03-25 00:02:18 +01:00
yellows8
b897c3a650 Updated web docs. 2019-03-22 20:51:09 -04:00
yellows8
afdd8d07e8 Updated usbhs docs regarding 7.0.0+. 2019-03-21 11:19:20 -04:00
natinusala
9c016a4cee Implemented nifmGetInternetConnectionStatus 2019-03-19 12:35:52 -04:00
Michael Theall
b49cb8a1a6 const params for usbDs 2019-03-16 00:07:39 +01:00
exelix
093471609d Change nifm initialization mode and add SetWirelessCommunicationEnabled (#247)
* Init nifm in the proper context, add SetWirelessCommunicationEnabled
* add nifmSetServiceType to set which nifm service to init
2019-03-15 17:11:40 -04:00
natinusala
a7facade0a Implement wlaninfGetState and wlaninfGetRSSI 2019-03-15 11:35:02 -04:00
yellows8
5d121a20b9 Changed types for fields in MousePosition to s32. 2019-03-12 16:21:22 -04:00
yellows8
c542d3ab8a Added hidMouseMultiRead + mouse handling adjustments. Closes #235. 2019-03-11 23:34:58 -04:00
Lioncash
03143cbadc hwopus: Document second member of HwopusHeader
This second member indicates the Opus encoder's entropy coder's final
range. While nothing in the service actually does anything with the
final range as far as I can tell, this is specified within RFC 6716
(https://tools.ietf.org/html/rfc6716, see section "6. Conformance") as a
means of ensuring decoder conformance. States as follows:

"In addition, a compliant decoder implementation MUST have
 the same final range decoder state as that of the reference decoder."

So what is likely done when performing compliance testing is the data is
encoded, and then the final range of the encoder is sent via this
header, then during decoding, the final range would be checked against
to ensure that it's valid.
2019-03-10 21:34:54 -04:00
yellows8
ef370fd33a Fixed WebWifi docs. 2019-03-09 21:51:32 -05:00
yellows8
275a61a2e2 Improved WebWifi, including handling for NULL conntest_url. 2019-03-09 16:18:10 -05:00
rsn8887
1135047a3a Fixed ifr_flags type by introducing ifr_flagshigh (fixes #248) 2019-03-09 16:37:33 +01:00
yellows8
bf3673c19f Added WebFooterFixedKind enum. Actually check sysver in webConfigSetFooterFixedKind. Updated web docs. 2019-03-07 21:36:48 -05:00
yellows8
c193337d9b Added WebExitReason_ErrorDialog. 2019-03-06 23:57:47 -05:00
yellows8
4160622165 Support passing NULL for webConfigShow out. Minor docs adjustment. 2019-03-06 23:46:46 -05:00
yellows8
9e52d7c4df Check for sysver [3.0.0+] for viSetDisplayMagnification. 2019-03-06 13:56:36 -05:00
yellows8
9d0603845a Updated WebBootDisplayKind and added WebBackgroundKind + WebLeftStickMode. Improved web docs. 2019-03-05 23:33:54 -05:00
exelix
2d1116743e Add wrappers for brightness-related functions (#246)
* Add wrappers for brightness-related functions
2019-03-04 21:37:33 -05:00
yellows8
966d554e7d Use PACKED for raw in _binderTransactParcelAuto. 2019-03-04 20:21:38 -05:00
yellows8
18a4351330 Use the actual enum for webConfigSetBootDisplayKind instead of u32. Improved web docs. 2019-03-04 17:20:18 -05:00
yellows8
7479be4256 Added WebShimKind_Shop and removed a comment. 2019-03-04 12:26:54 -05:00
yellows8
a897b9a836 Moved web common AppletHolder into WebCommonConfig, _webShow now takes AppletHolder as a param. Added webConfigRequestExit. Renamed WebExitReason_Unknown2 to WebExitReason_Requested. 2019-03-04 10:46:19 -05:00
yellows8
d353213d72 Added appletHolderRequestExit. 2019-03-04 10:42:07 -05:00
yellows8
c10508d95e Added WebExitReason enum and improved LastUrl/CallbackUrl docs. 2019-03-03 23:30:06 -05:00
yellows8
142811f943 Improved web docs. 2019-03-03 21:50:26 -05:00
yellows8
ded540e5f1 Implemented full support for web Offline-applet + minor other changes. Improved web docs. 2019-03-03 20:37:14 -05:00
yellows8
b19c35fe2c Added webReplyGet* funcs. Added WebReplyType enum and _webTLVReadVarSize. 2019-03-02 20:44:22 -05:00
yellows8
2ed160624a webConfigShow now uses new struct WebCommonReply as the output, for supporting WebCommonTLVStorage reply data. 2019-03-02 11:11:39 -05:00
yellows8
e55dfd69c7 Mention capssu.h in the webConfigSetApplicationAlbumEntry docs. 2019-03-01 23:04:28 -05:00
yellows8
bc7b178036 Added webConfigSetAdditionalCommentText, webConfigSetAdditionalMediaData, and webConfigSetMediaCreatorApplicationRatingAge. Improved web docs. 2019-03-01 22:49:01 -05:00
yellows8
166652a0eb Removed version check from webShareCreate. 2019-03-01 22:25:23 -05:00
yellows8
dc3cf7084e Added webConfigSetAlbumEntry and webConfigSetApplicationAlbumEntry. 2019-03-01 22:17:11 -05:00
yellows8
bbd0dcbd2b Added CapsAlbumEntry + comments. 2019-03-01 22:16:05 -05:00
yellows8
fbf1aab792 Initial support for web ShareApplet. Check shim-kind in webConfigSetDisplayUrlKind. 2019-03-01 21:54:45 -05:00
yellows8
6211510b21 In webConfigSetBootAsMediaPlayer with News on 3.0.0+, set WebArgType_BootAsMediaPlayerInverted. Added _webTLVRead/_webConfigGet*. Improved web docs. 2019-03-01 16:33:13 -05:00
yellows8
ff3a4f9844 Renamed usbDsEndpoint_StallCtrl to *Stall. 2019-03-01 12:40:23 -05:00
yellows8
121f2cf868 Added webConfigSetScreenShot, and minor other web changes. 2019-02-28 22:15:18 -05:00
yellows8
4ef0dd09f0 Added webConfigSetMediaPlayerUserGestureRestriction, webConfigSetJsExtension, webConfigSetTouchEnabledOnContents, webConfigSetPageCache, webConfigSetWebAudio, webConfigSetFooterFixedKind, webConfigSetPageFade, webConfigSetBootLoadingIcon, and webConfigSetPageScrollIndicator. Minor other changes. 2019-02-28 21:54:08 -05:00
yellows8
5f9264df16 Added webConfigSetFooter and webConfigSetKeyRepeatFrame. 2019-02-28 17:54:57 -05:00
yellows8
b58bc0a5dc Document what webConfigSetUserAgentAdditionalString is used for. 2019-02-28 16:50:45 -05:00
yellows8
344d87a3e4 Added support for web Lobby applet. Added webConfigSetBackgroundKind, webConfigSetPointer, and webConfigSetLeftStickMode. Fixed order of web funcs. Minor other web adjustments. 2019-02-28 13:07:56 -05:00
yellows8
6736053ae1 Added webConfigSetUserID, and internal web adjustments. 2019-02-27 22:48:48 -05:00
yellows8
526441a547 Added webYouTubeVideoCreate and improved web docs. 2019-02-27 20:44:11 -05:00
yellows8
81ce04eb7b In nxlinkStdio(), return sock on success instead of ret. 2019-02-27 19:15:31 -05:00
yellows8
6dea82a668 Moved applet notification-msg handling code into new funcs appletGetMessage and appletProcessMessage (with some improvements), which appletMainLoop now calls. 2019-02-27 19:03:35 -05:00
yellows8
eb750b641b Added webNewsCreate, webConfigSetEcClientCert, and webConfigSetShopJump. Improved web docs. 2019-02-27 17:52:00 -05:00
exelix
ad5b8c019f Add some functions from IOverlayAppletProxy and hid:sys (#242) 2019-02-27 16:17:03 +01:00
Michael Scire
d2c24bbe10 pm: Add pmdmntGetServiceSession() 2019-02-27 12:44:44 +01:00
yellows8
ef71282f31 Added webConfigSetBootAsMediaPlayer and webConfigSetMediaPlayerAutoClose. Updated WebBootDisplayKind. Removed 'Enabled' from WebArgType enums. 2019-02-26 21:54:47 -05:00
yellows8
a48f7c3502 Added webConfigSetBootDisplayKind and enum WebBootDisplayKind. Added enum WebShimKind_Offline. Minor other web adjustments. 2019-02-26 19:40:20 -05:00
yellows8
9e11dd1bd7 Added error handling for web TLVs. webPageCreate and webConfigSet* now return Result. Moved webWifiCreate/webWifiShow immediately after _webShow in web.c. 2019-02-26 17:55:16 -05:00
yellows8
904deeec10 Updated @brief in the web.h docs-header. 2019-02-26 15:23:01 -05:00
yellows8
2cd9825074 Added webConfigSetCallbackUrl, webConfigSetCallbackableUrl, and webConfigSetUserAgentAdditionalString. Improved web docs. 2019-02-26 15:16:26 -05:00
yellows8
6aa2640e4a Fixed comment alignment for WebArgType. 2019-02-25 23:24:29 -05:00
yellows8
50e2d43b70 Added WebArgType enum. 2019-02-25 23:22:49 -05:00
yellows8
91bf06653e Added webConfigSetDisplayUrlKind. Added more _webConfigSet* funcs. 2019-02-25 21:23:53 -05:00
yellows8
708ad83ead Renamed webShow to webConfigShow. Added webConfigSetWhitelist. 2019-02-25 20:12:36 -05:00
yellows8
7ccc29f397 Internal web arg handling improvements. 2019-02-25 19:38:15 -05:00
yellows8
ec5f1dc17f Renamed WebPageConfig to WebCommonConfig with more fields. Renamed webPageShow to webShow. Various web improvements including version handling. 2019-02-25 19:08:49 -05:00
yellows8
9f45bb4d7e Fixed IPC issues with bsdRead. 2019-02-24 22:17:27 -05:00
yellows8
4b8e501fdb Various web improvements, changed/added some structs. 2019-02-23 17:00:10 -05:00
fincs
bf13da990a Critical fix in new barrier impl 2019-02-23 21:09:41 +01:00
plutooo
e8f3964475 barrier: More efficient impl, maybe 2019-02-23 21:05:39 +01:00
yellows8
0a230bae65 Fixed issue in _webTLVWrite. Updated web docs. The url param for webPageCreate is no longer optional. 2019-02-21 00:15:09 -05:00
yellows8
601c76b508 Initial support for WebApplet/non-webWifi. 2019-02-20 23:42:17 -05:00
yellows8
425df41e7e Improved internal web applet launching/exit handling. 2019-02-20 18:34:16 -05:00
yellows8
d61c2d07b6 Added appletRequestLaunchApplication and appletRequestLaunchApplicationForQuest. 2019-02-19 23:12:29 -05:00
yellows8
d90893c566 Expose libappletCreateWriteStorage. 2019-02-19 21:46:53 -05:00
Luke Street
1415df75e4 Update svcSleepThread definition 2019-02-19 18:18:50 -05:00
yellows8
567828f44e Fixed doxygen issues / improved docs. Closes #230. 2019-02-19 16:56:33 -05:00
yellows8
e2f05654dd Moved web applet-exit handling into a dedicated func, which can optionally handle reading the applet reply storage. Added out param to webWifiShow for the applet reply data. 2019-02-18 22:32:18 -05:00
yellows8
f392dc0ce2 Added libappletReadStorage and libappletPopOutData. 2019-02-18 22:29:53 -05:00
yellows8
821c46539d Added 7.0.0+ support for _viCreateStrayLayer. 2019-02-18 22:26:22 -05:00
yellows8
e3f021bab3 Verify that the version is 2.0.0+ in swkbdInlineCreate. 2019-02-18 16:42:12 -05:00
fincs
11b7bece4a Change all services except fatal to use hosversion* instead of kernelAboveXYZ 2019-02-18 21:48:49 +01:00
fincs
61cc738730 Introduce hosversion.h - HOS version detection utilities
- Simplify kernel/detect.h logic; introduce detectKernelVersion()
- Use set:sys (if available) during __appInit in order to initialize
  the current HOS version
2019-02-18 21:48:41 +01:00
yellows8
6c3f72929d Fixed WebWifiPageArg struct, improved web-wifi handling and added docs. 2019-02-18 12:29:40 -05:00
fincs
ee2e19ce38 Improve names/documentation for jit kernel patch functions in detect.h/c + codestylefixes 2019-02-16 16:42:08 +01:00
yellows8
1cb2c18fa5 Added capssc. 2019-02-15 20:30:39 -05:00
averne
7d9601810d Added nfp:user services wrappers. (#237)
* hid: move official/libnx controller converters to hid.h
2019-02-15 19:06:41 +01:00
plutooo
17731d750e Add function to test OFW behavior under CFW 2019-02-14 22:03:47 +01:00
plutooo
fc557cbf2a Detect and use the CFW jit patch. 2019-02-13 22:40:00 +01:00
yellows8
16cbf1c9f6 Fixed minimum required sysver for capssu. 2019-02-11 20:36:41 -05:00
yellows8
e02b6c167a Added capssu and caps.h. 2019-02-08 19:47:13 -05:00
Lioncash
224ba8a87d hwopus: Provide a better name for the flag parameter of _hwopusDecodeInterleaved()
This is a flag that determines whether or not a request to reset the
decoder context should occur prior to decoding. This is an analogue to the
libopus ctl:

opus_decoder_ctl(decoder, OPUS_RESET_STATE);

which is generally used when switching streams to keep decoder state
consistent.
2019-01-30 18:00:48 +01:00
yellows8
b3b5816fd0 Added swkbdInlineAppearArgSetLeftButtonText and swkbdInlineAppearArgSetRightButtonText. 2019-01-28 21:15:45 -05:00
yellows8
2ebac06061 Updated swkbdInlineMakeAppearArg, this now just writes defaults and sets type to the input param. Added swkbdInlineAppearArgSetOkButtonText. 2019-01-28 16:54:38 -05:00
shibbs
131b92a8c8 Add in more NIFM functionality (#236) 2019-01-27 00:12:15 +01:00
yellows8
6b91ac26a5 Added swkbdInlineSetUserWordInfo/swkbdInlineUnsetUserWordInfo. Handle storage-tmem closing in _swkbdProcessReply. Better CustomizeDic handling. Other changes. 2019-01-22 22:29:48 -05:00
yellows8
4a119e4028 Added swkbdInlineSetCustomizeDic/swkbdInlineUnsetCustomizeDic. Updated SwkbdChangedStringArg struct. 2019-01-21 18:33:15 -05:00
yellows8
be8e196eb0 Moved state field from swkbdInlineUpdate into SwkbdInline, and added out_state param. Removed unused State param from _swkbdProcessReply. Added SwkbdState enum. 2019-01-18 23:48:31 -05:00
yellows8
dbadcd76ed Implemented _swkbdProcessReply() with actual handling. Added set-callback funcs. Automatically call swkbdInlineSetUtf8Mode in swkbdInlineCreate. 2019-01-18 22:11:41 -05:00
Samuel P
8360e561c5 Added WifiWebAuthApplet launching (#233)
* Added WifiWebAuthApplet launching
2019-01-18 20:00:34 -05:00
yellows8
40d5fb8587 Added SwkbdReplyType. Added initial impl for _swkbdProcessReply. 2019-01-17 21:31:18 -05:00
yellows8
4250fb3752 Updated SwkbdInlineCalcArg struct. Added: swkbdInlineSetKeytopBgAlpha, swkbdInlineSetFooterBgAlpha, swkbdInlineSetKeytopScale, and swkbdInlineSetKeytopTranslate. Implemented field updating in swkbdInlineUpdate. 2019-01-16 20:34:53 -05:00
yellows8
8cc321d0f1 Allocate tmp-buffers for swkbd-inline, for use in swkbdInlineUpdate. Moved code for writing bool flags into dedicated funcs. Added: swkbdInlineSetInputModeFadeType, swkbdInlineSetAlphaEnabledInInputMode, swkbdInlineSetKeytopAsFloating, swkbdInlineSetFooterScalable. Removed a comment. 2019-01-15 21:31:02 -05:00
yellows8
74683089a0 Fixed+updated swkbd-inline structs. Added: swkbdInlineSetVolume, swkbdInlineSetInputText, swkbdInlineSetCursorPos, swkbdInlineSetUtf8Mode, swkbdInlineSetTouchFlag, swkbdInlineSetUSBKeyboardFlag, swkbdInlineSetDirectionalButtonAssignFlag, swkbdInlineSetSeGroup, and swkbdInlineSetBackspaceFlag. Added some storage reading to swkbdInlineUpdate. 2019-01-15 16:51:19 -05:00
yellows8
1a91c10c19 Added SwkbdInlineMode enum. 2019-01-14 14:57:28 -05:00
yellows8
9d5127d37d Improved keySetDisableBitmask handling in swkbdInlineMakeAppearArg. 2019-01-14 11:14:50 -05:00
yellows8
203aa2b368 Added viGetIndirectLayerImageMap and viGetIndirectLayerImageRequiredMemoryInfo. 2019-01-14 11:12:49 -05:00
yellows8
a812587a31 Updated SwkbdAppearArg. Updated comments. 2019-01-13 19:51:01 -05:00
yellows8
8cd2808eff Added swkbdInlineAppear, swkbdInlineDisappear, and swkbdInlineMakeAppearArg. Updated SwkbdAppearArg. 2019-01-11 18:24:14 -05:00
Cpasjuste
855a719728 c11-threads: return thrd_timedout on cnd_timedwait timeout (#232) 2019-01-09 13:33:23 +01:00
yellows8
2e3fd9bd9f Use const for appletQueryApplicationPlayStatistics. 2019-01-05 14:47:42 -05:00
yellows8
2ccaa302a1 Added appletQueryApplicationPlayStatistics. Use BufferType_Normal instead of 0 in _appletGetSessionProxy. 2019-01-05 14:34:18 -05:00
yellows8
9aa0f901d1 Fixed doxygen for swkbd.h. 2019-01-04 22:07:10 -05:00
yellows8
2900622cb5 Initial SwkbdInline impl, minor swkbd adjustments. 2019-01-04 22:05:06 -05:00
fincs
06733c4750 Fix NvColorFormat enum 2019-01-04 22:30:52 +01:00
fincs
50baeeaa80 nwindowGetDefault: Explicitly initialize dimensions to 1280x720 because 1.x reports a default size of 1x1 2019-01-04 20:41:05 +01:00
yellows8
82e526c72f Added appletHolderActive and appletHolderCheckFinished. 2019-01-04 11:46:36 -05:00
XProger
f589310ef2 fix unusable touch by adding touch identifier into touchPosition 2019-01-03 21:16:06 +01:00
fincs
e708372dca Finally remove deprecated old gfx API 2019-01-03 21:13:20 +01:00
Andreas Smas
e04f311dd4 doozer: Adjust so docs-target is only trigged from Doozer's CD script 2019-01-03 11:32:30 -08:00
fincs
a182f3b496 Release v2.0.0 2019-01-02 00:16:49 +01:00
fincs
49efa74e70 Remove static_asserts from hid.h in order to avoid a hard dependency on C11 2019-01-01 03:27:43 +01:00
yellows8
e59036d4c8 Added PsmSession, which is now an additional param for: psmBindStateChangeEvent, psmWaitStateChangeEvent, and psmUnbindStateChangeEvent. Hence, the psm session is now handled with this object instead of libnx automatically handling it internally. psmBindStateChangeEvent no longer calls psmUnbindStateChangeEvent. Other adjustments. 2018-12-31 19:36:07 -05:00
yellows8
2c89aed2b9 Swapped the order of the buffers used in usbHsAcquireUsbIf on 3.0.0+. 2018-12-29 19:13:53 -05:00
yellows8
e9cc565e92 Fixed usbhs 3.0.0+ support with usbHsAcquireUsbIf. 2018-12-26 11:18:09 -05:00
yellows8
36a2404e4b Updated applet/swkbd comments. 2018-12-24 20:13:09 -05:00
yellows8
e03c23e126 Added comments for SwkbdTextDrawType_DownloadCode/unk_x3e0. 2018-12-24 20:03:23 -05:00
yellows8
584b856299 Removed typedef for SwkbdKeyDisableBitmask. Changed the type for SwkbdArgV0 type and textDrawType to the enums. 2018-12-24 11:23:30 -05:00
yellows8
653bcb27c9 Added SwkbdTextDrawType and replaced unk_x3b8 with textDrawType. 2018-12-24 01:00:39 -05:00
yellows8
21e01dfd68 Added SwkbdKeyDisableBitmask. 2018-12-23 22:55:19 -05:00
yellows8
715b597ef1 Removed comment from swkbdConfigSetInitialText, since the previous tmem commit fixed this. 2018-12-23 22:19:49 -05:00
yellows8
00d0174c0a Removed the buffer memset from tmemCreateFromMemory, tmemCreateFromMemory should not write to the user buffer. 2018-12-23 22:18:24 -05:00
yellows8
6355ead6d3 Fixed dicFlag type. 2018-12-23 01:47:11 -05:00
yellows8
477058d28a Added SwkbdType. Specifically set the type to SwkbdType_Normal in the Preset funcs which use it. Set type properly on 5.0.0+ for swkbdConfigMakePresetDownloadCode. Improved swkbd docs, including documenting what fields are set by the Preset funcs. 2018-12-23 01:26:00 -05:00
yellows8
56b767efbf Implemented actual swkbd TextCheck support. Moved strbuf alloc from _swkbdProcessOutput into swkbdShow(), so that it can be used for TextCheck. Added validation for the out_string* params in swkbdShow(). The out_string buffer is now cleared before calling _swkbdProcessOutput. 2018-12-23 00:39:06 -05:00
yellows8
e8482f7581 Improved SwkbdArgV0, and updated swkbd docs. 2018-12-22 19:26:38 -05:00
yellows8
e892e91360 Moved swkbd version init into swkbdCreate, and use the newer swkbd versions. Added swkbdConfigMakePreset*(). Changed unk_x3e0 to u32, and various other adjustments. 2018-12-22 16:50:20 -05:00
yellows8
901dc817e7 Handle <=3.0.0 swkbd versions, and filled in the arg struct. Handle the workbuf. Added a param to swkbdCreate and added swkbdClose. Added swkbdConfigSet*Text and swkbdConfigSet*OptionalSymbolKey. Various other changes. 2018-12-22 11:51:51 -05:00
yellows8
854e3058ba Replaced appletSetMediaPlaybackStateForApplication with appletSetMediaPlaybackState, which now supports non-Application. Added _appletCmdInU8/_appletCmdInBool, the latter is now used by appletSetMediaPlaybackState. 2018-12-21 11:33:56 -05:00
Cpasjuste
8be5cad7f8 Added appletSetMediaPlaybackStateForApplication 2018-12-21 10:30:28 -05:00
yellows8
59382cab1f Added LibnxError_LibAppletBadExit, which is now used in swkbd. 2018-12-20 21:08:36 -05:00
yellows8
58cbacc76f Handle the output swkbd storage. 2018-12-20 20:49:50 -05:00
yellows8
32f93bef5d Added initial swkbd impl. 2018-12-20 13:06:20 -05:00
yellows8
d821185e3d Added buffer param to appletCreateTransferMemoryStorage and appletCreateHandleStorageTmem, tmemCreateFromMemory will now be used with this when buffer is not NULL. 2018-12-20 12:59:59 -05:00
yellows8
2d5000ba57 Added libappletPushInData. Moved common storage creation+writing code into 1 func, in libapplet.c. 2018-12-20 12:57:35 -05:00
Dave Murphy
2405872b16 redirect sys/poll.h to poll.h for compatibility 2018-12-20 16:16:12 +01:00
fincs
252e8ef9ff Add tmemCreateFromMemory 2018-12-20 16:12:22 +01:00
yellows8
0bab302c3b Added libappletRequestHomeMenu and libappletRequestJumpToSystemUpdate. 2018-12-19 20:37:19 -05:00
yellows8
6e10568589 Added applets/libapplet. Added appletSetThemeColorType and appletGetThemeColorType. 2018-12-19 19:49:57 -05:00
fincs
f448b0fbad nvioctlMap_Param -> nvioctlNvmap_Param 2018-12-19 19:33:31 +01:00
fincs
5039c0815e console_sw: Switch to PIXEL_FORMAT_RGB_565, optimize scrollWindow 2018-12-19 19:33:31 +01:00
fincs
ccf85a134b Added more RGB*() helper macros & fixed a few typos 2018-12-19 19:33:31 +01:00
fincs
e7c58fe59e Deprecate old gfx API; scheduled for removal at a later date. 2018-12-19 19:33:31 +01:00
fincs
1b18a3b056 console_sw: Use Framebuffer object instead of old gfx api. Moved RGBA8/_MAXALPHA to framebuffer.h. 2018-12-19 19:33:31 +01:00
fincs
f37518d848 Add framebufferMakeLinear - linear shadow buffer support 2018-12-19 19:33:31 +01:00
fincs
dbc960a24f NWindow: Internal rework to fix resource leak in nwindowReleaseBuffers 2018-12-19 19:33:31 +01:00
fincs
3a77a7ace8 Introduce nwindowGetDefault 2018-12-19 19:33:31 +01:00
fincs
12af73e9d2 Document NWindow and Framebuffer objects 2018-12-19 19:33:31 +01:00
fincs
f381066a43 Add NvColorFormat enum 2018-12-19 19:33:31 +01:00
fincs
b1600c9add gfxGetFramebufferHandle: return id instead of handle 2018-12-19 19:33:31 +01:00
fincs
d87f9541d1 NvMap: added support for loading remote NvMap objects (from id) 2018-12-19 19:33:31 +01:00
fincs
72a48f6598 Add nvioctlMap_Param and NvMapParam enum 2018-12-19 19:33:31 +01:00
fincs
260f34fa4e NWindow: add several new functions:
- nwindowIsValid
- nwindowGetDimensions
- nwindowSetDimensions
- nwindowSetCrop
- nwindowSetTransform
- nwindowIsConsumerRunningBehind
2018-12-19 19:33:31 +01:00
fincs
bf43284c9f Misc code style fixes, rename NvGraphicBuffer::layers to planes 2018-12-19 19:33:31 +01:00
Michael Scire
7c01659953 vi: Improve ViScalingMode enum 2018-12-19 19:33:31 +01:00
Michael Scire
798d8ff50c Add vi wrappers for system StrayLayer usage. 2018-12-19 19:33:31 +01:00
fincs
4879937946 Introduce Framebuffer, experimental wrapper object around a framebuffer queue for use by software rendering clients 2018-12-19 19:33:31 +01:00
fincs
62aa8e8b23 NWindow: add nwindowReleaseBuffers, which is also done automatically on Close 2018-12-19 19:33:31 +01:00
fincs
412c84d5f9 Rename NvInfo to NvGpu 2018-12-19 19:33:31 +01:00
fincs
c5f8275978 Rename nvMapFree to nvMapClose for consistency reasons 2018-12-19 19:33:31 +01:00
fincs
a9cbd9116a Introduce NWindow, an experimental replacement for the GFX API 2018-12-19 19:33:31 +01:00
fincs
b188f5fb33 gfx.c: fix two single-line bugs 2018-12-19 19:33:31 +01:00
fincs
2af9531f5b Const correctness in bqCancelBuffer 2018-12-19 19:33:31 +01:00
fincs
ec6d878d12 Major buffer producer refactor, see details:
- Introduced NativeHandle (display/types.h)
- Introduced NvGraphicBuffer (nvidia/graphic_buffer.h)
- Renamed BqQueueBufferInput to BqBufferInput
- Renamed BqQueueBufferOutput to BqBufferOutput
- BqGraphicBuffer is now defined and marshalled in a way that matches
  official sw more closely, with a pointer to a NativeHandle instead of
  inline flattened data and other miscellaneous junk
- Const correctness fixes
- bqSetPreallocatedBuffer now has flattening logic for BqGraphicBuffer
- bqRequestBuffer doesn't have this logic for now, passing anything other
  than NULL will fail
- gfx.c updated to use the refactored buffer producer
2018-12-19 19:33:31 +01:00
fincs
d717507541 display/parcel.h: Const correctness fixes 2018-12-19 19:33:31 +01:00
fincs
ae77cbea97 gfx/hid/irs/nv/vi: changes related to sysmodule users, see details:
- Removed hard dependency on applet
- Allow appletGetAppletResourceUserId to fail (using default zero in that case)
- nvInitialize uses nvdrv:s for AppletType_None
- gfx now uses weak global __nx_gfx_vi_service_type for the ViServiceType passed to viInitialize
2018-12-19 19:33:31 +01:00
fincs
3a31df429e gfx: finally get rid of nvgfx, replaced with an NvMap object 2018-12-19 19:33:31 +01:00
fincs
5fe01c065a Major refactor and redesign of nvidia wrapper objects, see details:
- NvBuffer replaced with NvMap, which only manages the creation of
  raw nvmap objects. Users must map these objects manually to
  address spaces.
- nvAddressSpaceBindToChannel removed.
- nvChannelSetNvmapFd is now automatic and has been removed.
- Nv3DContext, NvCmdList, NvErrorNotifier, NvGpfifo, NvGpu and
  NvZcullContext have all been removed.
- Introduced NvGpuChannel, which provides all functionality that was
  part of said removed objects.
- Other miscellaneous changes and fixes.
2018-12-19 19:33:31 +01:00
fincs
85a20f43dc NvAddressSpace: major overhaul, see details:
- Now contains a 'page_size' field, used throughout the functions
- Removed NvPageSize
- Removed nvAddressSpaceReserveAlign/AtFixedAddr/Full
- Added nvAddressSpaceAlloc/AllocFixed/Free (replacing above functions)
- Removed nvAddressSpaceMapBuffer/UnmapBuffer
- Added nvAddressSpaceMap/MapFixed/Modify/Unmap (replacing above functions)
- Adapted NvBuffer/NvGpu to use the new functions
2018-12-19 19:33:31 +01:00
fincs
22499d8ddf nvhost-as-gpu.c: fix some mistakes, add nvioctlNvhostAsGpu_FreeSpace, add NvAllocSpaceFlags, add NvMapBufferFlags_Modify 2018-12-19 19:33:31 +01:00
fincs
f0de0c869d Added nvInfoGetGpuCharacteristics 2018-12-19 19:33:31 +01:00
yellows8
9f63f29988 Use eventActive for g_appletLibraryAppletLaunchableEvent. Fixed _appletWaitLibraryAppletLaunchableEvent, and set rc to eventWait ret in _appletWaitLibraryAppletLaunchableEvent. Added appletHolderWaitInteractiveOut. 2018-12-19 13:00:40 -05:00
yellows8
63e0e3502c Added eventActive(). 2018-12-19 12:56:01 -05:00
yellows8
ced4f16ee1 Fixed+enabled appletSetTerminateResult and added it to applet.h. 2018-12-18 21:45:13 -05:00
yellows8
d8683ea188 Added appletHolderPopOutData and appletHolderPopInteractiveOutData. 2018-12-18 20:07:29 -05:00
yellows8
a6e1413712 Added storage pushing for AppletHolder. Verify that the input storage is initialized in _appletCmdInStorage(). 2018-12-18 19:37:07 -05:00
yellows8
5874a272d0 Added appletHolderJoin and appletHolderGetExitReason. 2018-12-18 19:03:22 -05:00
yellows8
bca797afc2 Use LibraryAppletLaunchableEvent and handle LibraryApplet self-creation. Implemented LibraryApplet starting. 2018-12-17 20:23:43 -05:00
yellows8
8f22e9e213 Initial impl for LibraryApplet creation. 2018-12-17 12:16:46 -05:00
natinusala
c8f732fda8 Add missing applet focus states and handling modes 2018-12-17 11:03:49 -05:00
fincs
50d16023eb Fix typo 2018-12-17 16:18:28 +01:00
fincs
beeeb057d2 Finishing touches to user-mode synchronization primitives 2018-12-17 16:06:23 +01:00
fincs
8c786c610e Fix waitMulti/waitMultiHandle for C++ 2018-12-17 16:06:23 +01:00
fincs
21f69bfa57 Add, document, and use MAX_WAIT_OBJECTS 2018-12-17 16:06:23 +01:00
fincs
33dad9b893 UTimer: use an actual 'started' flag instead of a magic tick value 2018-12-17 16:06:23 +01:00
fincs
8d813ee666 Generalize Waitable, moving UEvent/UTimer specific code into a vtable. 2018-12-17 16:06:23 +01:00
fincs
1d14cad1cf Separate WaiterNode initialization again, which is now done in waitImpl 2018-12-17 16:06:23 +01:00
fincs
a23d38ac77 Move waiterForXyz() functions to Xyz's header file. Implement waiter for (kernel mode) Event, and use it instead. 2018-12-17 16:06:23 +01:00
fincs
c9ee12ce20 Simplify WaiterNode, make it private. Improve UEvent autoclear logic. 2018-12-17 16:06:23 +01:00
fincs
47b786bcea Synchronize eventWait and _waitLoop code 2018-12-17 16:06:23 +01:00
fincs
2e76b2b150 waitN: Fix index bug when there are handles before UEvents in the array 2018-12-17 16:06:23 +01:00
fincs
3c9a84fe68 wait.c: Fix no-timeout handling; use new kernel error result codes 2018-12-17 16:06:23 +01:00
fincs
9144d78031 Stylefixes, part 1 2018-12-17 16:06:23 +01:00
plutooo
eb7d835a79 wait: Rename UsermodeEvent and UsermodeTimer 2018-12-17 16:06:23 +01:00
plutooo
376add30a4 wait: Introduce wait for raw handles too 2018-12-17 16:06:23 +01:00
plutooo
68b4d323a0 utimer: Add TimerType_OneShot 2018-12-17 16:06:23 +01:00
plutooo
0c0261bf2f wait: Improve timer calculation, thanks derrek 2018-12-17 16:06:23 +01:00
plutooo
b38983c1b7 wait: Fix a race 2018-12-17 16:06:23 +01:00
plutooo
eb01ccd097 wait: Doxygen 2018-12-17 16:06:23 +01:00
plutooo
6a6f654526 wait: Final implementation 2018-12-17 16:06:23 +01:00
plutooo
03ddd464a0 arm: Rename armTickToNs(), etc 2018-12-17 16:06:23 +01:00
plutooo
26b17cdae5 kernel: Review comments (move to private interface to private headers, atomics) 2018-12-17 16:06:23 +01:00
plutooo
9da123f916 wait: Check for disabled timer 2018-12-17 16:06:23 +01:00
plutooo
c6fc6a41e5 wait: Bug-fixes and lock-free utimer stop/start 2018-12-17 16:06:23 +01:00
plutooo
370d78453e kernel: Introduce utimer, uevent, and waitN 2018-12-17 16:06:23 +01:00
yellows8
42e7cf44cb Implemented applet IPC code for pushing storages/objects. Added appletPushToGeneralChannel(). 2018-12-16 18:16:01 -05:00
yellows8
3dce07d78c Fixed broken object sending in ipcPrepareHeaderForDomain(), and added serviceSendObject(). 2018-12-16 18:10:37 -05:00
yellows8
f61e9237e6 Added accountGetPreselectedUser. 2018-12-15 21:50:27 -05:00
yellows8
41e75d0b7d Removed AppletStorage.isHandleStorage since it's not usable for storages not created by the current process. Hence, appletStorageGetSize no longer supports HandleStorage. 2018-12-15 18:11:21 -05:00
yellows8
10826dda13 Added appletPopLaunchParameter. 2018-12-15 17:31:36 -05:00
yellows8
3af857575c Added comment to appletStorageMap. 2018-12-15 16:43:53 -05:00
yellows8
d65c2ec94b Added support for tmem with AppletStorage, and added HandleStorage support. applet IPC improvements. 2018-12-15 16:34:23 -05:00
fincs
f5682b267e Add more kernel error result codes 2018-12-14 14:36:36 +01:00
yellows8
1077cc2b46 Implemented AppletStorage. Various IPC improvements in applet.c, etc. 2018-12-13 22:48:48 -05:00
yellows8
8b86e4ecb8 Use domains for applet. 2018-12-12 21:13:01 -05:00
Michael Scire
3cff199b42 Add remaining pm:shell services, address issues 2018-12-10 00:12:46 +01:00
Michael Scire
0fad4244da Add ro:dmnt, ldr:ro. 2018-12-10 00:12:46 +01:00
Michael Scire
8e1ba23b83 pm: Add remaining pm:dmnt services 2018-12-10 00:12:46 +01:00
Michael Scire
0a92b0eb07 ns: Implement all of ns:dev 2018-12-10 00:12:46 +01:00
plutooo
bfad4d4557 Fix whitespace 2018-12-09 19:07:39 +01:00
plutooo
d3da66e418 Fix const specifier 2018-12-09 17:06:58 +01:00
plutooo
c328a74f71 Add fsIsExFatSupported() 2018-12-09 17:06:47 +01:00
Lioncash
69a98dc0cb kernel/svc: Correct SVC instruction values for svcMapPhysicalMemory and svcUnmapPhysicalMemory
0x2A corresponds to svcFlushEntireDataCache, while 0x2B corresponds to
svcFlushDataCache.
2018-12-07 12:19:16 +01:00
Michael Scire
40bccd7838 Add svcTerminateDebugProcess 2018-12-06 13:18:06 +01:00
yellows8
bc2dff0361 Added hidAcquireNpadStyleSetUpdateEventHandle. 2018-12-02 16:48:59 -05:00
Michael Scire
2a831c6196 Fix struct definition for splSetConfig 2018-12-01 21:29:41 +01:00
yellows8
b7b64858a6 Added usb_standard_request from libusb. 2018-11-30 20:13:58 -05:00
yellows8
e986799784 Updated usbhs comments and added usbHsIfIsActive/usbHsIfGetID. 2018-11-30 20:13:58 -05:00
yellows8
ee066a27ee Implemented usbhs endpoints, other adjustments. Updated field name in UsbHsXferReport. Added defines in usb.h from libusb. 2018-11-30 20:13:58 -05:00
yellows8
31cea3a6b6 Implemented usbhs control transfers. Fixed eventCtrlXfer init. Updated a field name in UsbHsXferReport. 2018-11-30 20:13:58 -05:00
yellows8
2049ff081d Updated usbhs comments and store the interface ID in UsbHsClientIfSession. Added: usbHsIfSetInterface, usbHsIfGetInterface, usbHsIfGetAlternateInterface, usbHsIfGetCurrentFrame, and usbHsIfResetDevice. 2018-11-30 20:13:58 -05:00
yellows8
83dfc58adb Moved interface-specific data from UsbHsInterface into UsbHsInterfaceInfo. Added usbHsAcquireUsbIf/usbHsIfClose and the related structs. 2018-11-30 20:13:58 -05:00
yellows8
f1ba199d1c Initial usbhs support. 2018-11-30 20:13:58 -05:00
yellows8
ba68e198db Use PACKED for usb_endpoint_descriptor and usb_config_descriptor. 2018-11-29 17:25:46 -05:00
rsn8887
b2bee550ff Improve documentation of hidMergeSingleJoyAsDualJoy 2018-11-29 11:09:14 -05:00
yellows8
f373b3ca23 Added usbds.h to switch.h. 2018-11-28 21:56:34 -05:00
yellows8
725ac9f00a Moved usb code specific to usbds into seperate .c/.h. 2018-11-28 17:34:53 -05:00
yellows8
528b17c9b5 Added usb_config_descriptor in usb.h. 2018-11-28 17:11:11 -05:00
yellows8
3726eb8950 Use PACKED for _usbDsGetSession resp, required for domains. Use domains for usbds, with changes from @SciresM. 2018-11-28 16:40:45 -05:00
yellows8
68846af044 Removed alignment for object_ids in ipcParseDomainResponse, since official sw doesn't have this. 2018-11-28 16:37:33 -05:00
yellows8
7ae659c2cb Handle the output u8 in _usbDsGetSession, without using it in the callers. 2018-11-28 15:03:06 -05:00
fincs
07cd134d24 Release v1.6.0 2018-11-28 02:09:20 +01:00
yellows8
36bed9f8fc Added support for getting file timestamps via 3.0.0+ fsFsGetFileTimeStampRaw, *stat() timestamps are now set when fsFsGetFileTimeStampRaw is successful. This is now used in fsdev_open() for supporting fstat. The sysver is now checked in fsFsCleanDirectoryRecursively(). Closes #204. 2018-11-20 14:22:19 -05:00
pixel-stuck
a7577f7b56 Add pcvSetVoltageEnabled and pcvGetVoltageEnabled (#208)
* Add pcvSetVoltageEnabled and pcvGetVoltageEnabled
2018-11-19 10:37:59 -05:00
yellows8
8767ea798b Determine whether to use AUDREN_REVISION_1-4 via the sysver, instead of hard-coding it for the 3.0+ rev. Updated comments and added AUDREN_REVISION_5/AUDREN_REVISION_6 defines. 2018-11-17 11:43:24 -05:00
yellows8
e7117a7903 Added enum for hidSetNpadJoyHoldType. Improved hid docs. Use hidSetNpadJoyHoldType during hid init/exit. Closes #206. 2018-11-15 21:36:34 -05:00
rsn8887
33364a8271 support SL/SR buttons on right JoyCons 2018-11-16 00:18:19 +01:00
yellows8
12ee6e502e Fixed register corruption in crt0 introduced by the exception commit. Only handle exceptions when __libnx_exception_handler is defined by the user, and updated comments. 2018-11-14 20:55:17 -05:00
Michael Scire
4e4d5ef320 fatal: Implement fatalWithContext 2018-11-14 19:52:40 -05:00
Michael Scire
e943eb6ea5 Add fs gamecard attribute retrieve commands 2018-11-14 19:52:40 -05:00
Michael Scire
4581e597c0 Add SetSysFlag_RequiresRunRepairTimeReviser 2018-11-14 19:52:40 -05:00
Michael Scire
8bef0e6298 Add GpioPadName_ButtonVol[UpDown] 2018-11-14 19:52:40 -05:00
Michael Scire
7b7bd9dd9d Add setsys fatal commands 2018-11-14 19:52:40 -05:00
Michael Scire
5386edef4f Add gpio wrapper 2018-11-14 19:52:40 -05:00
Michael Scire
dec6f1ffe1 Add i2cOpenSession, i2csessionSendAuto 2018-11-14 19:52:40 -05:00
Michael Scire
3ba8a5aa87 Add lblSwitchBacklightOn and lblSwitchBacklightOff 2018-11-14 19:52:40 -05:00
Michael Scire
8cb9004a2f Add pcvGetClockRate/pcvSetClockRate 2018-11-14 19:52:40 -05:00
Michael Scire
27936900d0 Add enum for PsmBatteryVoltageState 2018-11-14 19:52:40 -05:00
Michael Scire
94dc8f75f9 Add bpcGetSleepButtonState 2018-11-14 19:52:40 -05:00
Michael Scire
ee55b63f79 Add spsm wrapper. 2018-11-14 19:52:40 -05:00
yellows8
5e69f760fb Added support for exception-handling. 2018-11-14 16:17:02 -05:00
SciresM
e19765445d fs: Add fsFsQueryEntry (and fsFsSetArchiveBit helper) (#202)
* fs: Add fsFsSetArchiveBit

* Add fsdevSetArchiveBit wrapper
2018-11-09 22:03:47 -05:00
natinusala
fd4afacb01 Expose appletSetFocusHandlingMode 2018-11-08 19:27:56 -05:00
yellows8
5a078b1205 Use 6.0.0+ _hwopusDecodeInterleaved cmds. 2018-11-06 23:02:40 -05:00
yellows8
6a8dba4eb4 Added support for hwopus multistream. Minor adjustments in hwopus.h. 2018-11-06 15:10:54 -05:00
yellows8
c99518643c Use _hwopusDecodeInterleavedWithPerfOld on 4.0.0+. Use the multistream cmdid when a bool flag is set in HwopusDecoder, which is currently not set. 2018-11-06 10:47:09 -05:00
yellows8
b25be27525 Use BufferType_Normal in auddev. 2018-11-05 11:34:30 -05:00
yellows8
c5d3f0dfb5 Added HwopusHeader struct. 2018-11-04 22:03:25 -05:00
yellows8
a6412e1e3a Fixed swapped output raw fields in hwopusDecodeInterleaved, and also swapped those in the params. 2018-11-04 20:29:38 -05:00
yellows8
34e99d53c2 Added hwopus. 2018-11-04 18:39:04 -05:00
SciresM
7c2d89dc71 psc: Add PmModule support (#200)
* psc: Add PmModule support
2018-11-03 21:40:15 -04:00
yellows8
576302444d Added auddev and AudioDeviceName. 2018-11-02 16:04:09 -04:00
fincs
480174753a Release v1.5.0 2018-10-27 17:42:06 +02:00
fincs
ede79862fb Add threadGetCurHandle 2018-10-27 17:34:44 +02:00
yellows8
ccfb1fd4d2 Use Event in applet instead of raw handles. 2018-10-26 14:00:13 -04:00
yellows8
3b0348654e Use Event in audout/audin instead of raw handles. 2018-10-26 13:41:26 -04:00
yellows8
5dc7505139 Fixed swapped params for svcCreateEvent in eventCreate. 2018-10-26 13:08:45 -04:00
yellows8
49e4e31fcc Added support for psm StateChangeEvent. Added psmGetBatteryVoltageState. Code style adjustments, use serviceIpc*, etc. 2018-10-26 13:07:10 -04:00
yellows8
de79614a12 Added info regarding timeout to the appletLockExit comments. 2018-10-25 12:34:33 -04:00
SciresM
ac853db5f0 set:sys: Add GetFirmwareVersion(2) (#190)
* set:sys: Add GetFirmwareVersion
2018-10-24 17:16:35 -04:00
yellows8
bcddc1ea35 Only allow using video-recording with regular-application, since it's not usable with SystemApplication. Added _appletIsRegularApplication() for this. 2018-10-23 16:23:14 -04:00
tatehaga
b130d96445 barrier implementation using semaphores (#186) 2018-10-23 21:19:26 +02:00
yellows8
318562d13b Init/exit nifm in socketInitialize/socketExit, the user app no longer has to manually handle this when using gethostid/gethostname. Use domains for nifm. Style adjustments in nifm.c. 2018-10-23 14:04:58 -04:00
plutooo
6977cb24f5 virtmem: Fix minor regression
We need to fetch alias region to make sure virtmemReserve() avoids returning addresses inside of it
2018-10-23 04:07:01 +02:00
Michael Scire
e942b9cc25 virtmem: Fix stack region mapping on 1.0.0 2018-10-22 22:34:11 +02:00
yellows8
a15c9945a7 Updated comments regarding requirements for using video-recording, etc. Changed appletInitializeGamePlayRecording to (void) since the sysmodule only supports a fixed size. 2018-10-22 13:37:25 -04:00
yellows8
0fb0f67d2e hidGetControllerConnected -> hidIsControllerConnected 2018-10-22 12:20:28 -04:00
yellows8
0370140c12 Added hidGetControllerConnected() and updated CONTROLLER_P1_AUTO comment. 2018-10-22 12:13:59 -04:00
yellows8
a62e29d5cf Added support for applet video-recording, currently not usable. In appletExit, only call appletSetFocusHandlingMode when g_appletExitProcessFlag is zero, so that it isn't called twice during proc-exit. 2018-10-21 22:24:54 -04:00
yellows8
cfbc3e9278 Added usbCommsSetErrorHandling, don't throw fatalSimple for usbComms by default. 2018-10-19 12:34:17 -04:00
Cpasjuste
493d433ac2 netinet: fix missing declarations (#187) 2018-10-19 17:15:24 +02:00
yellows8
319cc578ca Fixed swapped params for memalign in jitCreate(). 2018-10-17 14:47:14 -04:00
fincs
8e1736c480 Add RandomSeed (14) homebrew ABI key and related handling 2018-10-17 17:17:05 +02:00
yellows8
6a9d194fe3 Added hidGetControllerColors and HidControllerColors. Changed rightColorbuttons to rightColorButtons in HidControllerHeader. Updated CONTROLLER_P1_AUTO comment. 2018-10-16 22:45:44 -04:00
TuxSH
052fb34397 Reduce usage of malloc in select and poll. Fix poll not acceping -1 fds 2018-10-16 18:53:05 -04:00
fincs
fba43b0f10 nvBufferCreate: use separate is_cpu_cacheable/is_gpu_cacheable parameters 2018-10-17 00:32:47 +02:00
Michael Scire
86a25e1edd Make fsp-ldr use domains 2018-10-16 17:56:39 -04:00
Michael Scire
d67ae02bc5 Add domain support to fsp-srv 2018-10-16 17:56:39 -04:00
Michael Scire
40e0bf4db7 Refactor service IPC to support domains. 2018-10-16 17:56:39 -04:00
yellows8
cde495241c Added _hidActivateNpad/_hidDeactivateNpad for internal use in hidInitialize/hidExit. Added hidSetNpadJoyHoldType. Added _hidCmdWithInputU64 and _hidCmdWithNoInput. 2018-10-15 12:10:07 -04:00
yellows8
d4277b6d32 Added hidSetSupportedNpadIdType(), which is automatically called during init. Closes #148, however vibration disable+enable in system-settings is still needed. 2018-10-14 21:47:26 -04:00
yellows8
57ad3cc1d2 Clarified comments for appletLockExit. 2018-10-14 16:05:24 -04:00
yellows8
52686826d1 Added fsdevGetDeviceFileSystem(). 2018-10-12 22:13:14 -04:00
yellows8
c1b4b95bd7 Updated wiki URLs. 2018-10-11 21:44:51 -04:00
yellows8
42d3c32b37 Use FatalType_ErrorReportAndErrorScreen instead of FatalType_ErrorScreen, on pre-3.0.0. FatalType_ErrorScreen is only available with 3.0.0+, this fixes a regression where using fatalSimple on pre-3.0.0 caused a system hang. 2018-10-11 15:41:05 -04:00
SciresM
347e3b3156 Refactor usb:ds, add 5.0.0+ support to usbComms. (#181)
* Refactor usb:ds, add support for 5.0.0+. Closes #109.
2018-10-11 15:35:22 -04:00
yellows8
25052190d2 Added comment regarding PlSharedFontType_NintendoExt. 2018-10-09 11:25:25 -04:00
Samuel P
74ebf370dd add an exit request hook type, allow to delay exit (#183)
* add an exit request hook type, allow to delay exit
* appletMainLoop: return false on exit request msg
2018-10-09 11:04:33 -04:00
Thog
8178c0fa45 _socketDeserializeHostent: fix usage of uninitialized h_name 2018-10-08 21:44:30 -04:00
fincs
420d5d4e61 C11 thread support: address standard compilance issues
Also fixes #158
2018-10-06 22:00:31 +02:00
fincs
1563df3921 Refactor console device, see details:
- Added ConsoleRenderer interface, which abstracts all relevant
  operations needed to set up and write characters to a text mode display
- ConsoleFont now has tileWidth/tileHeight parameters
- PrintConsole now holds a pointer to a ConsoleRenderer
- Added consoleExit for deinitializing the console
- Added consoleUpdate for updating the display every frame
- Corrected lots of obsolete/outdated comments
- Separated console software renderer into its own file (console_sw.c)
- Added getDefaultConsoleRenderer weak function, for selecting the
  default console renderer when none (NULL) is specified in PrintConsole
- Software renderer now takes care of gfxInitDefault/gfxExit
- All these changes are backwards compatible with older programs because:
  - gfxInitDefault has double-init protection
  - Old programs don't call consoleUpdate/Exit, but their implementation
    in the software renderer is identical to what old programs were
    already doing anyway
2018-10-06 16:48:03 +02:00
fincs
cc70f19e61 nvservices: increase default tmem size to 8MB 2018-10-06 16:47:53 +02:00
fincs
20204e3c48 NvFence: fix regression on 1.x 2018-10-06 16:47:25 +02:00
yellows8
4fb364060c Added support for timezones, hence localtime() will now return actual localtime. Added timeToCalendarTimeWithMyRule and TimeCalendarTime/TimeCalendarAdditionalInfo, which are used for timezones support. 2018-10-05 19:59:24 -04:00
yellows8
dc011024f9 Call appletSetFocusHandlingMode in appletExit for AppletType_Application. 2018-10-04 22:19:58 -04:00
yellows8
6d2699b38d Added pmshellGetApplicationPid(). 2018-10-04 18:44:45 -04:00
yellows8
b4859873ec Added env AppletFlags handling. Don't enter the msg-loop for AppletType_Application when the output from _appletGetCurrentFocusState is already 1. This fixes the hang issue with AppletType_Application where applet init with AppletType_Application was previously done. Moved AppletType_*Application checks into a dedicated function which also checks for AppletType_SystemApplication, hence some of these funcs which didn't check for AppletType_SystemApplication now support it. 2018-10-04 18:06:00 -04:00
yellows8
96dce1a8b6 In __libnx_gtod set errno to EIO instead of EINVAL when __boottime is invalid due to timeGetCurrentTime() failing during time init, and added this to __libnx_clock_gettime. Set errno to ENOSYS in __libnx_clock_settime. 2018-10-03 20:55:58 -04:00
yellows8
0b1b7039ca Changed the value of TimeType_Default to TimeType_UserSystemClock. When timeGetCurrentTime fails where __nx_time_type isn't TimeType_Default, call it again with TimeType_Default. 2018-10-03 19:48:33 -04:00
yellows8
16bbf3411e Added automatic process exit handling with applet cmds, see __nx_applet_exit_mode. appletSelfExit is no longer user-accessible, see __nx_applet_exit_mode instead. Added envSetExitFuncPtr. Added disabled _appletSetTerminateResult func. 2018-10-03 19:04:48 -04:00
yellows8
beef09a27e Removed appletSelfExit and replaced it with the previously disabled _appletSelfExit, now renamed to appletSelfExit. 2018-10-01 18:35:49 -04:00
Vicki Pfau
7a952ab39b hid: Uncomment function that works now 2018-09-30 16:39:51 -04:00
Vicki Pfau
8add42378b hid: Add SixAxis sensor support 2018-09-30 16:39:51 -04:00
Vicki Pfau
68b2ad0c1e hid: Call SetSupportedNpadStyleSet to enable additional Npad features 2018-09-27 16:23:37 -04:00
fincs
eb11e25dc5 Add Module_HomebrewAbi/Loader. Reassign Module_LibnxBinder, as it inadvertently collided with Module_HomebrewLoader. 2018-09-27 21:03:29 +02:00
yellows8
1cc3547990 Removed TODO comment in _hidGetDeviceHandles(). 2018-09-27 12:01:58 -04:00
yellows8
1267019d83 Added partial support for hid SixAxisSensor. Moved some hid ipc code into a single func for using cmds with an input u32. Moved handle-generation code from hidInitializeVibrationDevices into a new func, with some improvements + support for SixAxisSensor. 2018-09-26 22:28:40 -04:00
TuxSH
3bd7ca5f7e Reword ProcessState enum fields 2018-09-26 21:11:02 +02:00
fincs
67886bb3df nvGpuClose: correct order of operations 2018-09-26 21:08:30 +02:00
leo60228
1c948e2d32 applet: Add appletSelfExit() 2018-09-21 15:55:06 -04:00
fincs
00b12b93fb Release v1.4.1 2018-09-18 17:56:11 +02:00
plutooo
00287b6a69 Fix pm:dmnt for 5.0.0+ 2018-09-18 09:38:17 +02:00
TuxSH
3ecd841ec2 Update svcGetDebugThreadContext, add svcSetDebugThreadContext, implement threadDumpContext 2018-09-18 01:13:55 +02:00
TuxSH
5498d3e0c7 Add ThreadContext, RegisterGroup, svcGetThreadContext3, threadDumpContext 2018-09-18 01:13:55 +02:00
Vicki Pfau
d9e3be27a2 Add psm:GetChargerType 2018-09-18 01:13:24 +02:00
Lioncash
a06bfb74a7 kernel/random: Avoid casting away const in the U8TO32_LITTLE macro
This macro is only ever used with const input data within chachaInit(),
which causes -Wcast-qual warnings. This is trivial enough to fix, by
preserving the qualifier within the cast.
2018-09-18 01:13:04 +02:00
fincs
4645ef7004 gfx: Add gfxAppendFence. Remove obsolete comments related to double buffering. 2018-09-16 18:03:35 +02:00
fincs
a50942509f NvGpfifo: Redesign API to allow for submitting multiple entries at once 2018-09-16 16:35:57 +02:00
fincs
91fb381461 CI: remove switch-examples from build 2018-09-15 21:04:58 +02:00
plutooo
4a13ee3e62 Fix function name to not cause linker problems due to symbol truncation issues 2018-09-15 08:42:32 +02:00
plutooo
7279ef0415 Fix signature of svcContinueDebugEvent for firmware 3.0.0 and forward 2018-09-15 08:14:09 +02:00
plutooo
f2c959b941 Fix compilation error on pre-14 C++ 2018-09-15 08:11:31 +02:00
Lioncash
9ff32e3260 Resolve trivial -Wmissing-prototypes warnings
Gets rid of trivial warnings caused by headers not being included into
the relevant .c file, empty parameter lists missing void, or functions
missing a prototype in the header.
2018-09-14 19:07:34 +02:00
fincs
e7ae7ea846 nv wrappers: Handle cacheability settings properly, more details:
- nvAddressSpaceMapBuffer now accepts a flags parameter instead of
  hardcoding NvMapBufferFlags_IsCacheable.
- NvBufferFlags was incorrect and was thus removed.
- nvBufferCreate/nvBufferCreateRw replaced with nvBufferCreate, with
  an extra 'is_cacheable' bool parameter. There's no such thing as a
  "read-only/read-write" buffer.
- nvBufferMakeCpuUncached/nvBufferMakeCpuCached were removed.
2018-09-14 18:09:58 +02:00
fincs
f469fa7458 Add nvioctlChannel_KickoffPb (uses Ioctl2) 2018-09-14 02:15:55 +02:00
fincs
cae1954ebc nv: add cloned session handle used with certain requests; add Ioctl2 2018-09-14 02:15:24 +02:00
fincs
ad17cb74c7 kernel/ipc.h: add ipcCloneSession 2018-09-14 01:35:24 +02:00
fincs
1cbc67e650 NvBuffer: actually unmap and free the buffer in nvBufferFree 2018-09-13 20:05:55 +02:00
fincs
23fa46a8ee Release v1.4.0 2018-09-09 20:00:55 +02:00
Rajko Stojadinovic
dcdb5c28a4 Fix fsOpenFileSystem (#153)
* Fix fsOpenFileSystem

* Make fsOpenFileSystem and fsOpenFileSystemWithId work on all firmware versions

* Add some comments for fsOpenFileSystem(WithId)
2018-09-09 19:56:38 +02:00
Random
122fec028c Added nsListApplicationRecord and nsListContentMetaStatus (#163) 2018-09-09 19:56:16 +02:00
neonsea
20a39ef86c Add appletBeginBlockingHomeButton() and appletEndBlockingHomeButton() (#165) 2018-09-09 19:55:53 +02:00
XorTroll
cd813ddb60 Add psm service and psmGetBatteryChargePercentage function (fixed) (#166) 2018-09-09 19:55:36 +02:00
Michael Scire
6ef26bff1a Implement kernelAbove600() 2018-09-09 19:55:12 +02:00
fincs
81d56a9e23 console: disable forced flush/swap/vblank due to performance reasons 2018-09-08 14:19:24 +02:00
fincs
52c0cee10c Add nvioctlChannel_SetTimeout & nvChannelSetTimeout 2018-09-08 14:17:54 +02:00
fincs
de664c5655 error_notifier.h: Add missing functions to header 2018-09-08 14:17:27 +02:00
fincs
999edaa8b2 Changes to NvCmdList and NvGpfifo, see details:
- NvCmdList:
  - Added 'offset' parameter: start of the cmdlist within the buffer
  - Added nvCmdListReset for resetting a cmdlist (offset/num_cmds cleared)
- NvGpfifo:
  - nvGpfifoCreate: disabled fence wait
  - nvGpfifoSubmit -> nvGpfifoSubmitCmdList:
    - Added fence_incr parameter
    - Cleaned up flags and gpfifo entry creation
    - Now advances cmdlist offset by the number of cmds submitted
      instead of going back to the beginning
2018-09-07 17:27:15 +02:00
fincs
7f4001bec2 Potentially fix race condition nvGpfifoCreate by waiting on the fence returned by nvioctlChannel_AllocGpfifoEx2 2018-09-05 14:00:28 +02:00
fincs
d718a8dd28 NvBufferFlags_Nintendo doesn't exist, it's a misreading of the alignment parameter 2018-09-05 13:59:50 +02:00
fincs
e3a7187973 gfx: Remove gfxSetDrawFlip. Make 0 the default transform instead of FLIP_V. 2018-08-31 20:14:50 +02:00
fincs
0d1b8bd723 BqQueueBufferInput: add swapInterval field (purpose currently unknown) 2018-08-31 20:11:53 +02:00
fincs
651dd72ac1 Add bqCancelBuffer and use it in gfx.c 2018-08-31 14:14:54 +02:00
fincs
c8ebe8a3b5 buffer_producer: convert Binder error codes to Result values 2018-08-31 14:05:04 +02:00
fincs
a62fae427b Introduce Module_LibnxBinder result codes (based on Android status_t) and binderConvertErrorCode 2018-08-31 13:59:18 +02:00
fincs
819a6f0d89 display/binder.h: refactoring and other changes:
- Removed session_handle/native_handle state
- Consequence of the above: simplified binderCreate/binderInitSession
- Now using viGetSession_IHOSBinderDriverRelay internally
- Changed binderGetNativeHandle to return an Event
- Added readable aliases for binderAdjustRefcount
- gfx: now using async bqDequeueBuffer when the binder event is available
2018-08-31 13:05:23 +02:00
fincs
60cbb68f46 gfx: use new NvFence waiting code 2018-08-31 13:05:23 +02:00
fincs
a70acdd445 Implement nvFence 2018-08-31 13:05:23 +02:00
fincs
57e1f5f4cb nvioctlNvhostCtrl: add EventWaitAsync, EventUnregister; fix EventRegister 2018-08-31 13:05:23 +02:00
fincs
99f37184fb nvQueryEvent: return an Event instead of a raw Handle 2018-08-31 13:05:23 +02:00
fincs
7f8b6af64c runtime/newlib.c: use armGetSystemTick instead of svcGetSystemTick 2018-08-31 13:05:23 +02:00
fincs
b26bb6ce76 viGetDisplayVsyncEvent: return an Event instead of a raw handle 2018-08-31 13:05:22 +02:00
fincs
88e9d3bb83 kernel/event.h: several fixes, including autoclear support 2018-08-31 13:05:22 +02:00
fincs
f2f59c75c0 display/gfx.h & buffer_producer.h: Start major refactor, highly WIP 2018-08-31 13:05:22 +02:00
fincs
10684e205a nvidia/fence.h: sketching on NvFence/NvMultiFence {not implemented} 2018-08-31 13:05:22 +02:00
fincs
30e2ca8ec3 Introduce nvidia/types.h & move NvBufferKind to it (renamed to NvKind) 2018-08-31 13:05:22 +02:00
fincs
27f5aecea8 nvgfx: Strip down to bare minimum - remove unused logic 2018-08-31 13:05:22 +02:00
fincs
ace0dea08b Move Android types to display/types.h; add PIXEL_FORMAT/GRALLOC_USAGE enums 2018-08-31 13:05:22 +02:00
fincs
4e7159ce02 VI service: major revamp, see details:
- Added viOpenDefaultDisplay.
- Replaced viOpenLayer with viCreateLayer.
- NativeWindow parcel data is now parsed by viCreateLayer, and the
  ViLayer struct contains a new igbp_binder_obj_id field.
- LayerFlags/LayerId parameters replaced by weak global variables
  __nx_vi_layer_id/__nx_vi_stray_layer_flags.
- The root vi:* session is closed on startup.
- Simplified corresponding gfx code.
- Misc style fixes
2018-08-31 13:05:22 +02:00
fincs
180cd9b550 display/parcel.h: publish ParcelHeader struct 2018-08-31 13:05:22 +02:00
fincs
a0b3d3e193 source/nvidia/: do NOT include <switch.h> 2018-08-31 13:05:22 +02:00
Jules Blok
e234129598 gfx: Add a buffer index to gfxGetFramebufferHandle(). 2018-08-31 13:05:22 +02:00
Jules Blok
4f331eb9f7 gfx: Add function to query framebuffer pitch. 2018-08-31 13:05:22 +02:00
Jules Blok
06e50f74ab gfx: Add a call to get the framebuffer nvmap handle. 2018-08-31 13:05:22 +02:00
Jules Blok
d93c45a18d gpfifo: Reset the command buffer after submission.
Don't forget to wait on the fence before re-using the buffer.
2018-08-31 13:05:22 +02:00
Jules Blok
9ce884f29e cmd_list: The number of entries is the number of ints. 2018-08-31 13:05:22 +02:00
Jules Blok
3a750138c5 buffer: Align the size based on the param. 2018-08-31 13:05:22 +02:00
Jules Blok
cd85610ebb Fix nvBuffer memory allocation failure 2018-08-31 13:05:22 +02:00
plutooo
de93886c56 Buildfix 2018-08-31 13:05:22 +02:00
plutooo
a3a2e57fc2 More updates to nvidia 2018-08-31 13:05:22 +02:00
plutooo
1c88d99131 Implement cmd list 2018-08-31 13:05:22 +02:00
plutooo
d6dbb59872 Change code style 2018-08-31 13:05:22 +02:00
plutooo
9c234d4d40 Started sketching on cmd lists 2018-08-31 13:05:22 +02:00
plutooo
50718ddccb Bad cleanup in gpu.c 2018-08-31 13:05:22 +02:00
plutooo
6d21700ff7 Get rid of flag todo 2018-08-31 13:05:22 +02:00
plutooo
28cac45af8 Completing error notifier 2018-08-31 13:05:22 +02:00
plutooo
267e4e509b Error notifier bringup 2018-08-31 13:05:22 +02:00
plutooo
d22bc791f4 Nv fixes 2018-08-31 13:05:22 +02:00
plutooo
d6f2e1118c Zcull context works 2018-08-31 13:05:22 +02:00
plutooo
420d445a84 Minor fixes, now gets to whitescreen 2018-08-31 13:05:22 +02:00
plutooo
577a76dc06 Minor fixes, adding custom flag to buffer allocation 2018-08-31 13:05:22 +02:00
plutooo
1a22b484f8 Implemented zcull_ctx, 3d_ctx, random fixes 2018-08-31 13:05:21 +02:00
plutooo
cff044f497 Implement 3d_ctx 2018-08-31 13:05:21 +02:00
plutooo
87d29bdeb3 gpu takes reference on singletons 2018-08-31 13:05:21 +02:00
plutooo
f62f6e8b54 Add refcounting to nvidia stuff 2018-08-31 13:05:21 +02:00
plutooo
e7daaf1e71 Hide nv tmem size from gfx 2018-08-31 13:05:21 +02:00
plutooo
74958c57ce Use reference counting across services 2018-08-31 13:05:21 +02:00
plutooo
194e335532 Let nv reference applet 2018-08-31 13:05:21 +02:00
plutooo
efacee6956 Simplify nv 2018-08-31 13:05:21 +02:00
plutooo
4b20f609a9 Stubbed 3d_ctx 2018-08-31 13:05:21 +02:00
plutooo
1660f99afe Stubbed gpfifo, zcull_ctx 2018-08-31 13:05:21 +02:00
plutooo
4bd1d3313c Fix nvgfx, add nvinfo 2018-08-31 13:05:21 +02:00
plutooo
f6aa4e3d52 Minimize nvgfx.c 2018-08-31 13:05:21 +02:00
plutooo
b24f6babbb Make compilable 2018-08-31 13:05:21 +02:00
plutooo
61ebd9ddfd Started implementing channels 2018-08-31 13:05:21 +02:00
plutooo
9a759c26f5 Rename nvmap->buffer 2018-08-31 13:05:21 +02:00
plutooo
04751087ca Stylechanges to binder, and implemented gpu address space 2018-08-31 13:05:21 +02:00
plutooo
cd753b1b58 Implemented nvmap.c 2018-08-31 13:05:21 +02:00
plutooo
112b2b5d8e Move nvidia driver to nvidia/ 2018-08-31 13:05:21 +02:00
plutooo
d8bb563546 Renamed gfx/ to display/ 2018-08-31 13:05:21 +02:00
plutooo
978c3f7f15 Style fixes, use structs for parsing parcels, renamed bufferProducer to bq 2018-08-31 13:05:21 +02:00
fincs
772c839c8c Add audio/ ("AudioDriver"), a high level wrapper around audren 2018-08-31 13:05:21 +02:00
fincs
6fbf25fb62 Add audren:u IPC service wrapper with structure definitions 2018-08-31 13:05:21 +02:00
fincs
80439a186b Add MOD0 header to crt0 2018-08-31 13:05:21 +02:00
fincs
ce23a139f4 arm/counter.h: add armGetSystemTickFreq 2018-08-31 13:05:21 +02:00
plutooo
68a77ac950 Close sm session properly 2018-08-28 21:29:55 +02:00
David Marcec
d91c315f77 Fixed nifm not initializing properly for < 3.0.0 2018-08-27 16:10:53 +02:00
fincs
866202feb7 Add switch/services/bpc.h to switch.h 2018-08-24 16:24:42 +02:00
fincs
915879a362 Fix #154 2018-08-24 16:24:24 +02:00
XorTroll
722450ae25 Add bpc service with ShutdownSystem and RebootSystem commands (#144) 2018-08-24 16:21:16 +02:00
Juan Antonio Hernández Cánovas
377683acd5 Add rwlockInit (#155) 2018-08-24 16:20:01 +02:00
yellows8
3513c91c3c Added the remaining init for AppletType_SystemApplet. 2018-08-17 21:55:37 -04:00
yellows8
a7ba75ea1a Added comment regarding the AppletType_Application double-init issue. 2018-08-15 16:32:11 -04:00
plutooo
fb42ebe53a Fix memory leak in tmemCreate 2018-08-11 15:01:12 +02:00
Lioncash
d3f388d2c8 socket: Correct missing break within _socketParseBsdResult() 2018-08-09 14:53:41 +02:00
Lioncash
12a473ecbe hid: Correct bitwise AND for pro controllers in hidInitializeVibrationDevices()
LAYOUT_PROCONTROLLER is a value of zero, so the bitwise AND condition
here would always be false (TYPE_PROCONTROLLER, on the other hand is a
value of 1)
2018-08-09 14:53:26 +02:00
fincs
f3b530cea3 C11 threads: enable preemptive scheduler and load balancing 2018-08-06 17:59:51 +02:00
fincs
9fa3873fc9 Fix comments in svc.h & thread.h 2018-08-06 17:58:31 +02:00
fincs
b181d725ac Use revised CondVar API in C11 threads impl 2018-08-05 14:32:10 +02:00
fincs
1e349b6ce8 Change CondVar API to have the mutex be passed to condvarWait* instead of condvarInit 2018-08-05 14:31:31 +02:00
fincs
062ef2b188 Add svcGetThreadCoreMask and svcSetThreadCoreMask 2018-08-05 14:30:08 +02:00
fincs
0589b39f7a Add arm/counter.h with armGetSystemTick (supersedes svcGetSystemTick) 2018-08-05 14:29:47 +02:00
fincs
d255fe730b Experimental partial C11 threads support 2018-08-05 13:23:08 +02:00
fincs
314050065a Remove ALIGN in favor of C11/C++11 alignas, guard other #defines against redefinition 2018-08-05 13:23:08 +02:00
plutooo
9fc5e85c88 Event bringup 2018-08-05 13:23:08 +02:00
Jakob Dietrich
8e19bb5b0d Fix semaphoreTryWait 2018-08-04 12:14:02 +02:00
fincs
93dabfab3f Release v1.3.2 2018-07-29 12:32:28 +02:00
Michael Scire
81e6972ae1 Fatal: fix marshalling 2018-07-28 18:24:19 -07:00
fincs
a6492e9888 Release v1.3.1 2018-07-28 18:15:01 +02:00
Rajko Stojadinovic
d726c7c55c Implement some missing fs functions (#141) 2018-07-28 17:49:14 +02:00
klockee
27b8868646 Wrapped and implemented fsOpenBisFilesystem() (#140) 2018-07-28 17:08:42 +02:00
Rajko Stojadinovic
01fb4218ba Add ncmContentStorageGetPlaceHolderPath and ncmContentStorageCleanupAllPlaceHolder 2018-07-27 18:14:43 +02:00
Rajko Stojadinovic
1b7acba590 add ncmContentStorageDisableForcibly and ncmContentMetaDatabaseDisableForcibly 2018-07-27 18:14:43 +02:00
Rajko Stojadinovic
c3278ffd34 Add ncmContentStorage functions needed for writing content 2018-07-27 18:14:43 +02:00
Jakob Dietrich
a180a36cb3 Fixed hid in sysmodules (#135) 2018-07-27 18:01:41 +02:00
Dave Murphy
be509f62ce return through libc exit rather than __libnx_exit directly (#139) 2018-07-26 18:01:40 +02:00
Rajko Stojadinovic
e1d50dc129 Fix signature of ncmContentMetaDatabaseSet/Get, add ncmContentMetaDatabaseList (#134)
* Fix ncmContentMetaDatabaseSet/ncmContentMetaDatabaseGet, add ncmContentMetaDatabaseList
2018-07-25 20:15:54 -04:00
fincs
37689b53b6 Add #pragma once to arm/atomics.h 2018-07-24 16:54:07 +02:00
Oliver Kuckertz
1eafa1b283 Fix data race by reordering in _CacheValues 2018-07-22 17:03:36 +02:00
Joel16
2bcede91ba Add fsFsCleanDirectoryRecursively 2018-07-19 11:33:56 -04:00
Dave Murphy
aa3c35e6e3 adjust fsdev_fixpath for cwd changes (#132)
* adjust fsdev_fixpath for cwd changes
2018-07-19 11:31:51 -04:00
Adubbz
d48cf6aa2e Added ncm to switch.h, fixed wrong order in ncmContentMetaDatabaseListApplication 2018-07-19 11:29:48 -04:00
tesnos
9530da3237 Add fsOpenBisStorage and fsStorageGetSize (#130)
* add fsOpenBisStorage and fsStorageGetSize
2018-07-19 11:16:38 -04:00
fincs
eb93b232ef Release v1.3.0 2018-07-08 17:36:43 +02:00
Adubbz
e4c3f7d3a2 Added ncm commands (#129) 2018-07-07 04:03:48 +02:00
Daniel Edwards
ffc404a7f6 Added accountGetUserCount and accountListAllUsers (#103)
* Added accountGetUserCount and accountListAllUsers
2018-07-01 16:34:21 -04:00
Kevoot
fbe2c1f2ce Add Semaphore (#125) 2018-07-01 00:45:41 +02:00
fincs
399a2ed21d Embed GNU build ID in compiled binaries for use by creport 2018-06-26 19:19:41 +02:00
SciresM
97b295acbc Fatal: Only exit process if required, exit cleanly. (#127)
* Fatal: Only exit process if required, exit cleanly.
2018-06-26 11:28:07 -04:00
fincs
a9c0b213ff Add missing #pragma once to kernel/condvar.h 2018-06-26 13:12:44 +02:00
Sajid Anwar
aee9ba4706 Re-introduce socklen_t definition to netdb.h 2018-06-25 23:39:02 +02:00
Dave Murphy
35be7ac772 allow user additions to init/exit code (#124)
* allow user additions to init/exit code
2018-06-25 12:42:52 -04:00
SciresM
dbbaf64ad3 ns:dev: Add TerminateProcess and TerminateProgram (#122)
* ns:dev: Add TerminateProcess and TerminateProgram
2018-06-25 12:02:08 -04:00
Michael Scire
9770f4bb18 Implement svcGetThreadList 2018-06-25 11:18:07 -04:00
Michael Scire
481d27d1f1 Implement svcGetDebugThreadParam 2018-06-25 11:18:07 -04:00
gdkchan
b55317511c Fix mutexUnlock 2018-06-25 11:12:45 -04:00
SciresM
773ff46543 Improve IpcParsedCommand domain message info. (#112)
* Improve IpcParsedCommand domain message info.
2018-06-25 11:08:48 -04:00
Michael Scire
c26e410ed8 Fatal: Make fatalSimple not create report, add FatalType enum 2018-06-25 12:33:15 +02:00
Dave Murphy
8b2b12b454 fix _IOC cast 2018-06-14 18:26:29 -04:00
Dave Murphy
4e4d2fe3c6 translate horizon errno to newlib errno 2018-06-14 18:25:52 -04:00
Dave Murphy
70cd9e017d fix ioctl 2018-06-14 01:51:36 +02:00
Joel16
eb3c264e88 Add setsysSetColorSetId and region codes 2018-06-13 19:34:20 -04:00
Dave Murphy
9860ad331c implement nanosleep 2018-06-14 00:49:20 +02:00
jarulo
8b793729fc Fix inet_pton4 2018-06-12 13:08:27 +02:00
Somebody Whoisbored
ad4af954c2 Added nifm service (#110)
* Added nifm service
* Properly implemented gethostid
* Implemented gethostname
2018-06-07 18:00:51 -04:00
Joel
3c6344d7f3 Add more set:sys Get*/Set* functions (#108)
* Use setsysGetFlag/setsysSetFlag instead of setsysGet*/setsysSet*.
* Added more setsys Flags (now handled via an enum).
2018-06-07 16:06:36 -04:00
Dave Murphy
3326d5e62d Time fixes (#102)
* provide microseconds to gettimeofday
* implement clock functions
2018-06-07 15:35:41 -04:00
Joel
1abfb02460 Add nsGetSpace commands (#111)
* Add nsGetSpace commands
2018-06-05 22:15:52 -04:00
Adubbz
d3889fb9ed Added a few misc IPC wrappers (#107)
* Added a few misc IPC wrappers
2018-06-04 22:05:51 -04:00
jarulo
a5381e43c0 Fix incorrect pointer reference in socketDeserializeAddrInfo 2018-05-29 15:29:39 -04:00
Dave Murphy
c597631c4d fix build, slight cleanup for doozer (#101) 2018-05-27 00:10:12 +02:00
Joel
deab92d486 Add some setsysGet* functions (#98)
* Add some setsysGet* functions
2018-05-22 11:33:45 -04:00
fincs
7223994aa6 Release v1.2.1 2018-05-22 00:49:24 +02:00
yellows8
b11288ea44 In jitTransitionToWritable() and jitTransitionToExecutable(), only run the JitType_CodeMemory handling code when it's actually needed. Actually free j->rx_addr in jitClose() for JitType_JitMemory. 2018-05-21 16:59:49 -04:00
yellows8
a12eb11eab Sync jit SVC names with wiki + updated the comment for JitType_JitMemory in jit.h. 2018-05-21 14:32:02 -04:00
yellows8
93957370a9 Disable using JitType_JitMemory on 5.0.0+, resulting in falling back to JitType_CodeMemory if available. 2018-05-21 14:04:20 -04:00
yellows8
726f8adfe3 Replaced the hard-coded timeout error constant in nvgfxEventWait() with the one from result.h. This fixes an issue caused by a past commit. 2018-05-19 21:45:18 -04:00
Dave Murphy
80d48425b9 remove sudo dep 2018-05-19 16:23:36 -04:00
Joel
3605e40dbd Add string.h to remove compile error (#96)
* Add string.h to remove compile error
2018-05-19 15:41:15 -04:00
Joel
c28cae95cd Add setGetSerialNumber (#95) 2018-05-19 16:50:00 +02:00
yellows8
df203f0697 Added hidMergeSingleJoyAsDualJoy(). 2018-05-18 18:42:48 -04:00
Dave Murphy
3d0cab8061 changelog for 1.2.0 (#92) 2018-05-17 00:25:07 +02:00
Dave Murphy
28ebb9ed0c implement nxlink stdio redirect (#94) 2018-05-17 00:22:47 +02:00
Dave Murphy
71036319a7 translate crlf eol markers to lf for consistency 2018-05-15 12:27:25 +02:00
yellows8
fdf0949562 Fixed parsing in _socketDeserializeHostent(). 2018-05-15 02:10:13 -04:00
Matthew Bell
61d4140773 Implement pm:info (#88)
* Added pm:info and GetTitleId
2018-05-14 21:09:43 -04:00
yellows8
05cde6649b Updated svcGetDebugEvent and svcContinueDebugEvent in svc.h. 2018-05-14 12:51:06 -04:00
yellows8
5ebe01191e Fixed hang in _socketDeserializeHostent(). 2018-05-14 12:37:56 -04:00
yellows8
ce718b3ac2 Set h_errno and errno for the socket.c 'Unimplementable functions'. 2018-05-14 12:32:07 -04:00
yellows8
3f75b79803 Copy the HidControllerHeader for each controller into hid state. Added disabled hidGetControllerType(). 2018-05-12 13:53:11 -04:00
Dave Murphy
d7cbc484ae use official devkitA64 docker image 2018-05-12 13:22:49 -04:00
yellows8
165932fbde Added a comment for fsdevCommitDevice(). 2018-05-12 11:56:04 -04:00
yellows8
02ff4915d9 Initialize cmdreq buf[1] in ipcCloseSession(). 2018-05-11 11:25:46 -04:00
yellows8
c548a76763 In select(), use pollinfo revents instead of events when processing poll() output. 2018-05-10 20:11:07 -04:00
yellows8
c8d68ae853 Fixed _socketOpen(). 2018-05-10 12:35:55 -04:00
yellows8
9c7ed03424 Fixed bsdGetSockOpt. 2018-05-09 22:07:54 -04:00
yellows8
2619142d78 Fixed bsdIoctl. 2018-05-09 12:57:07 -04:00
fincs
45c1dab733 Add rules for building .npdm, .nsp and .kip, see details:
- Now building .npdm from .json if specified
- .pfs0 now embeds previously built npdm if available
- .nsp accepted as an alternative file extension to .pfs0
- .kip can be built from elf and json descriptor (subset of .npdm)
2018-05-09 17:55:30 +02:00
yellows8
adad6f1c0c Fixed passing rawdata params in _sfdnsresDispatchDnsRequest(). 2018-05-08 22:52:32 -04:00
fincs
6bc917fae2 ipc.h: don't implicitly cast int to BufferType 2018-05-09 02:44:40 +02:00
Michael Scire
fd9378754d Fix asm error in svcGetResourceLimit*Value 2018-05-09 02:32:44 +02:00
yellows8
468924b730 Fixed static-buf-size issue with _bsdNameGetterCommand. 2018-05-08 16:22:18 -04:00
TuxSH
635599491c Add ipcAddSendSmart, ipcAddRecvSmart, use where applicable 2018-05-08 16:17:13 -04:00
Dave Murphy
e648524fa5 fix stringop-truncation warnings (#84)
avoid gcc 8.1.0 diagnostics as per https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html#index-Wstringop-truncation
2018-05-08 21:58:38 +02:00
Michael Scire
6f248b9b9e Add FS commands for SD card state change detection. 2018-05-08 13:29:56 +02:00
Dave Murphy
17bb2c1432 add DESTDIR for packaging 2018-05-08 03:01:56 +02:00
Michael Scire
dc133ab99f Implement all Loader Services. 2018-05-07 17:04:59 +02:00
Michael Scire
836ec09917 Implement CSRNG services 2018-05-07 17:04:59 +02:00
Michael Scire
24b42cb6a3 Implement SPL services 2018-05-07 17:04:59 +02:00
Michael Scire
1cc0ac7a94 Revise LR API to use actual LR function names 2018-05-07 17:04:59 +02:00
Michael Scire
65cca4bf13 Add support for fsp-pr. 2018-05-07 17:04:59 +02:00
Michael Scire
ef47389228 Implement svcMap/UnmapPhysicalMemory(Unsafe), svcSetUnsafeLimit 2018-05-07 14:03:27 +02:00
Michael Scire
8496264811 Fix definition for svcCreateEvent 2018-05-07 13:54:23 +02:00
yellows8
8fde3ec378 Added smm.h include to switch.h. 2018-05-04 01:55:29 -04:00
Michael Scire
7b5d1b1bf3 Implement sm:m. 2018-05-04 01:50:22 +02:00
SciresM
0ac5743c1f Add ResourceLimit SVCs, svcGetProcessInfo (#76) 2018-05-04 00:59:17 +02:00
fincs
e001318c42 Fix strncat vulnerabilities in fs_dev.c [reported by @TuxSH] 2018-05-02 16:09:11 +02:00
fincs
2818c99dea Revise fsdev initialization, see details:
- Removed fsdevInit/Exit
- Now automatically initializing fsdev state on first mount
- Added fsdevMountSdmc (replaces fsdevInit)
- Added fsdevUnmountAll (replaces fsdevExit)
2018-05-01 19:06:14 +02:00
hexkyz
b2b8e1ec67 Implement more SVCs (#74)
Implement svcSetThreadPriority.
Implement svcGetCurrentProcessorNumber.
Implement svcSignalEvent.
Implement svcSendSyncRequestWithUserBuffer.
Implement svcSendAsyncRequestWithUserBuffer.
Implement svcGetThreadId.
Implement svcReplyAndReceiveWithUserBuffer.
Implement svcCreateEvent.
Implement svcReadWriteRegister.
Implement svcCreateInterruptEvent.
Implement svcMapDeviceAddressSpaceByForce.
Implement svcTerminateProcess.
Fix svcMapDeviceAddressSpaceAligned.
Fix svcUnmapDeviceAddressSpace.
2018-04-30 00:43:52 +02:00
yellows8
c2b4f586f2 Merge branch 'master' of github.com:switchbrew/libnx 2018-04-25 12:49:10 -04:00
yellows8
6e1cc4dc1e Added plGetSharedFontByType(). Added _plRequestLoadWait which is used internally for both plGetSharedFontByType() and plGetSharedFont(). Moved offset/size validation code in pl into a dedicated func. 2018-04-25 12:49:01 -04:00
SciresM
d5bce6b0a6 Implement svcCreatePort. (#73)
* Implement svcCreatePort
* Implement svcConnectToPort
* Implement svcUnmapProcessMemory
* Implement svcGetSystemInfo
2018-04-24 18:33:46 -04:00
yellows8
9bb649b5e2 plFontData -> PlFontData and fixed @file in pl.h. 2018-04-24 14:08:12 -04:00
yellows8
07759f38d9 Added pl. 2018-04-23 21:15:32 -04:00
Michael Scire
938851df0a Add lr to <switch.h> 2018-04-22 01:15:28 +02:00
Michael Scire
cea3db77b1 Services: Add fsp-ldr, add lr/fsp-ldr to <switch.h> 2018-04-22 01:15:28 +02:00
SciresM
f40f544a07 IPC: Improve information available in IpcParsedCommand (#72)
* IPC: Add C descriptor support to IpcParsedCommand

* Add Command Type to IpcParsedCommand

* Replace constants with IpcCommandType where relevant.

* Add RawWithoutPadding pointer, required for serverside deserialization calculations.
2018-04-22 01:14:46 +02:00
Michael Scire
b18854555a IPC: Fix incorrect parsing of X descriptor addresses 2018-04-22 01:13:49 +02:00
yellows8
f727aa669a Added the remaining (pre-4.0.0) hid-serv vibration cmds. 2018-04-19 15:17:22 -04:00
yellows8
37bb9a6b7f Added nacpGetLanguageEntry and SetLanguage_Total. 2018-04-18 23:38:01 -04:00
Michael Scire
5e591d708a LR: Fix style for helper funcs, add comment 2018-04-18 14:06:15 +02:00
Michael Scire
d950853b4a LR: Implement wrappers for some commands 2018-04-18 14:06:15 +02:00
yellows8
a33fc64457 Implemented 3.0.0+ support for ns. 2018-04-15 22:13:07 -04:00
yellows8
7d28c35cb4 Fixed filename comment in nacp.h. 2018-04-15 17:43:21 -04:00
plutooo
daf819cb75 Stylefixes 2018-04-15 23:28:28 +02:00
yellows8
c5bc2ec77a Changed nsApplicationControlData to NsApplicationControlData. 2018-04-15 17:00:50 -04:00
yellows8
c82f2cea00 Added ns impl, and added nsGetApplicationControlData. Imported nacp.h from nx-hbmenu with adjustments. 2018-04-15 15:00:11 -04:00
yellows8
8091db8931 Added FsStorageId. Added pmshell init/exit and pmshellLaunchProcess. 2018-04-12 02:52:49 -04:00
yellows8
a3baa0eeb1 Allow using multiple interfaces with usbComms. Added usbComms Ex funcs. Use RwLock with usbComms. Various other usbComms changes. 2018-04-11 17:18:23 -04:00
yellows8
58835fae1a Use Service for AccountProfile. 2018-04-10 17:06:33 -04:00
yellows8
29211c1800 Use Service for all fs sessions. This fixes an issue with savedata commit. 2018-04-06 12:39:57 -04:00
Ezekiel Bethel
4786624781 Fix IN6_IS_ADDR macros in netinet/in.h (#68) 2018-03-30 15:19:34 -04:00
Dave Murphy
cd6c96ab99 add portlibs bin to path (#67) 2018-03-30 15:06:47 -04:00
yellows8
7f158396ad Added impl for accountProfile*. If the inital smGetService fails, attempt to use 'acc:u0'. 2018-03-28 19:31:36 -04:00
yellows8
26d2e6d7f4 Implemented FsSaveDataIterator (aka ISaveDataInfoReader). In fs*Close(), set the handle to INVALID_HANDLE after closing the handle. Changed ContentStorageId in FsSave to SaveDataType. Added enums FsSaveDataSpaceId and FsSaveDataType. Removed FS_MOUNTSAVEDATA_INVAL_DEFAULT/FS_MOUNTSYSTEMSAVEDATA_INVAL_DEFAULT. 2018-03-26 14:45:12 -04:00
Dave Murphy
45b36774e0 add socket flags translation 2018-03-25 17:51:09 +02:00
plutoo
d604976f08 Derp 2018-03-23 19:04:26 +01:00
plutoo
6c72bf8273 Detect 5.0.0 properly 2018-03-23 19:01:09 +01:00
yellows8
bf216aa667 Added mounting for SystemSaveData. 2018-03-22 22:56:38 -04:00
yellows8
51293c7fb0 In socket ioctl(), properly call fcntl-F_SETFL with the new flags. 2018-03-20 22:49:52 -04:00
Dave Murphy
21d27b935e modularise nxlink code 2018-03-18 20:51:49 +01:00
Dave Murphy
1394891509 better tag for nxlink host ip 2018-03-18 20:51:49 +01:00
Dave Murphy
0ef568b06c define nxlink ports 2018-03-18 20:51:49 +01:00
Dave Murphy
23f577576c more checking of NXLINKED arg 2018-03-18 20:51:49 +01:00
Dave Murphy
e8fdd73561 add support for finding nxlink host 2018-03-18 20:51:49 +01:00
yellows8
213676c5f8 Added hidGetHandheldMode(). 2018-03-15 22:24:52 -04:00
yellows8
0d5bf5ab7b Added more comments for hidSetNpadJoyAssignmentModeDual(). 2018-03-15 11:39:57 -04:00
yellows8
cd14f40a19 Updated hid.h comment. 2018-03-15 11:23:20 -04:00
yellows8
5e9869cc41 Added hidSendVibrationValues(). Improved hidInitializeVibrationDevices(), including changing the HidControllerLayoutType param to HidControllerType. 2018-03-14 21:47:21 -04:00
cpasjuste
4677266d53 ipc.h: fix BufferType invalid conversion (c++) 2018-03-14 13:34:00 +01:00
yellows8
3a8a9d7c26 Removed code for g_gfxPixelFormat/gfxSetPixelFormat and use hard-coded constant instead, since changing this value has no affect (even when changing g_gfx_BufferInitData.format). 2018-03-11 22:14:03 -04:00
yellows8
49bea43cce Added envGetLastLoadResult(). 2018-03-11 17:40:28 -04:00
plutoo
e112ab6968 Fix ipc session close race properly 2018-03-11 13:21:36 +01:00
plutoo
e162da18ff Fix race condition in tmem 2018-03-10 21:03:31 +01:00
plutoo
1dfb1beafb Ipc bugfix 2018-03-10 17:49:17 +01:00
plutoo
965c7cdd47 Irs stylefix 2018-03-10 14:48:15 +01:00
plutoo
1d34db8497 Improve atomics 2018-03-10 14:41:06 +01:00
plutoo
a102c64341 Introduce atomics.c, refcounting on all services 2018-03-10 14:33:40 +01:00
plutoo
d54db1ac16 Includefix 2018-03-10 14:05:14 +01:00
plutoo
d12e99e3ad Move ipc.h to kernel/ 2018-03-10 14:03:29 +01:00
plutoo
11c77cb654 Clean up 2018-03-10 12:13:57 +01:00
plutoo
e41ab0db74 More ipc stuff 2018-03-10 11:47:14 +01:00
plutoo
f32f28b451 Ipc improvements 2018-03-10 11:28:40 +01:00
Kostas Missos
e3666b4705 [hidvib] Rename vibration variables (#62) 2018-03-07 12:23:43 -05:00
yellows8
d1cefabd12 Renamed hidInitializeVibrationDevice() to hidInitializeVibrationDevices(), and added support for optionally returning 2 handles + other changes. 2018-03-07 01:16:35 -05:00
yellows8
cbaa0e359b Added hidPermitVibration() and hidIsVibrationPermitted(). 2018-03-06 23:38:33 -05:00
Kostas Missos
e243e4507e [irs] Name image transfer config variables (#61)
* [irs] Name image transfer config variables
2018-03-06 19:33:45 -05:00
yellows8
a3933c7a85 Added hid vibration. 2018-03-06 18:08:57 -05:00
yellows8
e7a4eba71c Added hidSetNpadJoyAssignmentModeSingleByDefault() and hidSetNpadJoyAssignmentModeDual(). Check serviceIsActive() in hidExit(). Use hidSetNpadJoyAssignmentModeDual() for all controllers during hidInitialize()/hidExit(). 2018-03-05 22:37:37 -05:00
plutoo
c7b0e7c891 Stylefix 2018-03-05 21:07:53 +01:00
Mike H
208daf6344 Audio input implementation and fixes (#60)
* Implemented audin service and fixed released audio buffer handling
2018-03-04 12:20:31 -05:00
yellows8
ca03c58896
Update Changelog.md for 1.1.0. 2018-03-02 12:51:41 -05:00
plutoo
231dba8061 libnx 1.1.0 2018-03-02 16:01:38 +01:00
Dave Murphy
29aed09e10 allow parallel building 2018-03-02 12:27:43 +01:00
yellows8
f7335b7ae5 Only clear allocated tmem when alloc was successful. 2018-03-01 22:57:44 -05:00
yellows8
20a549b46b Clear allocated tmem. 2018-03-01 22:55:17 -05:00
yellows8
07ec16a8e7 Implemented more irs. 2018-03-01 19:14:45 -05:00
yellows8
e9f07a314a Removed warning comment from romfs_dev.h, romfs example README mentions this. 2018-02-28 19:44:53 -05:00
yellows8
6dd76f6288 Sync AudioOutBuffer comments with wiki. Updated audoutPlayBuffer() comments. Moved the waiting/post-append code from audoutPlayBuffer() into new func audoutWaitPlayFinish(). Removed '&' from code setting audoutAppendAudioOutBuffer() raw->tag. 2018-02-28 19:37:17 -05:00
yellows8
517c76c05c Added Module_Kernel and KernelError_Timeout to result.h. 2018-02-28 19:19:45 -05:00
plutoo
f4230f3ef0 Fix race condition in hid 2018-03-01 00:15:01 +01:00
plutoo
20f3e87d11 Change type of TryLock to bool 2018-02-28 18:22:28 +01:00
Jules Blok
e966f21800 mutex: Add TryLock() variants. 2018-02-28 18:00:03 +01:00
TuxSH
a622ae5593 Add domain handling to sm.h 2018-02-28 17:59:46 +01:00
TuxSH
e0457c4534 Handle bsdInitialize failure codes properly 2018-02-27 19:14:44 +01:00
TuxSH
133f8eccc2 Move all of the BSD headers to nx/external/bsd/include 2018-02-27 19:14:44 +01:00
TuxSH
d33b26016d Add documentation to bsd.h and sfdnsres.h, etc. 2018-02-27 19:14:44 +01:00
TuxSH
5242771903 Import ipc.h bugfixes from #44 2018-02-27 19:14:44 +01:00
TuxSH
372021e226 Add missing include in tmem.h 2018-02-27 19:14:44 +01:00
TuxSH
3709ee92a5 Fix netdb functions 2018-02-27 19:14:44 +01:00
TuxSH
888f7e101f Fix inet_ntop6 2018-02-27 19:14:44 +01:00
TuxSH
472d305883 Move socket.c definitions around, fix bugs 2018-02-27 19:14:44 +01:00
TuxSH
dcf3e56300 Implement netdb.h functions, fix bugs, etc. 2018-02-27 19:14:44 +01:00
TuxSH
b8fb1722d0 Add sfdnsres 2018-02-27 19:14:44 +01:00
TuxSH
6884a9dd19 Add netdb.h 2018-02-27 19:14:44 +01:00
TuxSH
4b685d676b Add basic IPv6 definitions as sfdnsres seems to support it...
...also fix a bug in the inet_* functions.
2018-02-27 19:14:44 +01:00
TuxSH
0b92bb76b0 Add newlib wrapper for sockets...
... fix several bugs, etc.
2018-02-27 19:14:44 +01:00
TuxSH
88dbc66d01 Handle result code+errno properly...
also make fcntl and ioctl non-variadic for convenience for the newlib wrapper
2018-02-27 19:14:44 +01:00
TuxSH
a3e90d68a0 Add all the needed headers from FreeBSD...
... clean them up, also fix some bugs in bsd.c/h, etc.
2018-02-27 19:14:44 +01:00
TuxSH
4d78f12871 Implement most bsd:u/s service commands 2018-02-27 19:14:44 +01:00
yellows8
5664830f35 Fixed args parsing with quotes. 2018-02-27 02:14:23 -05:00
plutoo
1f0820dd6a Add missing include 2018-02-27 00:34:08 +01:00
yellows8
f1fc00c516 Updated comments for SetLanguage. 2018-02-26 15:17:21 -05:00
yellows8
f07d09aeb0 Added appletGetDesiredLanguage(). In set-serv('set'), added support for all language/region commands, etc. 2018-02-26 12:34:01 -05:00
plutoo
47fa88d838 Amend codestyle 2018-02-26 03:16:54 +01:00
plutoo
d3cc781bf6 Stylefix for nro 2018-02-26 02:10:49 +01:00
Adubbz
7b0e4194de Changed the default icon (again) 2018-02-25 15:49:50 +01:00
Dave Murphy
bc29d34cfc use only one portlibs directory 2018-02-25 15:49:35 +01:00
Dave Murphy
0bbfbadc39 switch to 16x16 console font 2018-02-25 15:49:25 +01:00
yellows8
b964c69da8 Added comments regarding direct FS usage in fs.h. 2018-02-24 21:38:53 -05:00
yellows8
e24c20f9e7 Added Nro prefix to Asset in nro.h + updated romfs_dev for this. 2018-02-24 15:39:30 -05:00
yellows8
4c1b09d6b9 Check for invalid handle in fs*Close(). Added fsOpenDataStorageByCurrentProcess(), fsStorageRead(), and fsStorageClose(). Added fsdevGetDefaultFileSystem(). Imported nro.h from nx-hbmenu. Implemented proper RomFS support. 2018-02-23 22:29:43 -05:00
james
9e96639681 update default app icon 2018-02-24 00:01:37 +01:00
yellows8
3d0ae50a89 Updated comment for the GfxMode used by console. 2018-02-23 12:59:51 -05:00
yellows8
2022d545dc Store pixel-format in a global instead of hard-coding it and added a disabled func for setting it. Added a pixel-format comment to gfx.h. 2018-02-22 21:49:55 -05:00
yellows8
3c4c35e6e5 Added gfxSetDrawFlip() and gfxConfigureTransform(). 2018-02-22 20:31:51 -05:00
plutoo
ff8a95b47d Headerfail 2018-02-22 08:48:05 +01:00
plutoo
60876ef3f3 Eyeballin set:sys 2018-02-22 08:44:12 +01:00
shinyquagsire23
954a48b8fe Add hidMouseRead, allows mouse position/velocity/scrollwheel velocity to be fetched 2018-02-22 06:48:00 +01:00
shinyquagsire23
1b255bfe15 Add usleep 2018-02-21 08:28:18 +01:00
plutoo
f8a86bf7b6 Merge branch 'master' of https://github.com/switchbrew/libnx 2018-02-21 08:38:49 +01:00
plutoo
e25aae5a97 Workaround for burn in issue 2018-02-21 08:38:22 +01:00
yellows8
d61154f0e5 Added timeSetCurrentTime() and attempt to initialize time-serv with 'time:s' first. 2018-02-21 00:26:21 -05:00
yellows8
0dcaeec959 In __libnx_gtod() set tv_usec, and moved+updated the timezones comment. 2018-02-20 22:24:35 -05:00
plutoo
842ce50c2f Condvar fix 2018-02-21 03:05:15 +01:00
yellows8
14263ddd78 Initial time support, timezones are not handled yet. 2018-02-20 18:17:32 -05:00
plutoo
6ee4d389a5 Binder bugfix 2018-02-19 23:40:48 +01:00
Mike H
cde07068dd Return result from audoutPlayBuffer (#46)
* Return result from audoutPlayBuffer
* Add alignment note in header file
2018-02-19 16:43:58 -05:00
yellows8
9f8a33ba11 Added default_icon.jpg to Makefile dist-src. 2018-02-19 02:29:52 -05:00
yellows8
43124d2b95
Updated README. 2018-02-19 02:11:57 -05:00
yellows8
8b0b2407f9
Updated README. 2018-02-18 22:14:03 -05:00
404 changed files with 97897 additions and 10264 deletions

View File

@ -1,45 +0,0 @@
{
"targets": {
"lib": {
"buildenv": "xenial-amd64",
"builddeps": [
"wget", "p7zip-full", "build-essential", "git"
],
"environment": {
"DEVKITPATH": "/project/devkitA64_a6",
"DEVKITURL": "https://downloads.sourceforge.net/project/devkitpro/devkitA64/alpha6/devkitA64_a6-x86_64-linux.7z"
},
"buildcmd": [
"[ ! -d ${DEVKITPATH} ] && (rm -rf ${DEVKITPATH} && mkdir ${DEVKITPATH} && wget -O /tmp/devkita64.7z ${DEVKITURL} && cd ${DEVKITPATH} && 7z x -y /tmp/devkita64.7z) || /bin/true",
"DEVKITPRO=${DEVKITPATH} make -j${PARALLEL} install",
"git clone --depth 1 https://github.com/switchbrew/switch-examples",
"DEVKITPRO=${DEVKITPATH} make -C switch-examples/"
]
},
"docs": {
// Only invoke docs target when building from master branch
"branch": "master",
"buildenv": "xenial-amd64",
"builddeps": [
"doxygen"
],
"buildcmd": [
"cd nx", "doxygen"
],
"artifacts": [{
"source": "nx/docs/html",
"destination": {
"type": "git",
"branch": "gh-pages"
}
}]
}
}
}

22
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Build libnx
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Test build
runs-on: ubuntu-latest
container:
image: 'devkitpro/devkita64'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: build
run: make -C nx -j$(nproc)

39
.github/workflows/doxygen.yaml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Build documentation
on:
push:
tags: [ v* ]
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Get current tag
id: vars
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: Set up Doxygen
run: sudo apt-get install -y doxygen
- name: Display Doxygen version
run: echo "Doxygen version $(doxygen -v)"
- name: Build documentation
run: |
cd nx
LIBNX_VERSION=${{ steps.vars.outputs.tag }} doxygen Doxyfile
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: nx/docs/html
CLEAN: true
SINGLE_COMMIT: true

3
.gitignore vendored
View File

@ -8,7 +8,10 @@
*.pfs0
Thumbs.db
.*/
!.github/
debug/
release/
lib/
docs/
compile_commands.json
.clangd

View File

@ -22,5 +22,10 @@
## Functions
`modulenameFunctionName`
### Submodule function naming
Singletons use names like smInitialize/smExit
Objects use names like tmemCreate/tmemClose
## Macros
`LIKE_THIS`

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,7 @@
# Nintendo Switch AArch64-only userland library.
Based on libctru.
[![Build status](https://doozer.io/badge/switchbrew/libnx/buildstatus/master)](https://doozer.io/switchbrew/libnx)
![Build status](https://github.com/switchbrew/libnx/actions/workflows/build.yaml/badge.svg)
# Install instructions
* Install [devkitA64](https://sourceforge.net/projects/devkitpro/files/devkitA64/) to `$DEVKITPRO/devkitA64`.
* `make install`
See also the [switch-tools](https://github.com/switchbrew/switch-tools) repo if you want to manually build those - devkitA64 includes switch-tools. See also [switch-examples](https://github.com/switchbrew/switch-examples).
# Icon
`nx/default_icon.jpg` is based on the icon by [Sweet Farm from the Noun Project](https://thenounproject.com/term/nintendo-switch/694750/).
See [Switchbrew](https://switchbrew.org/wiki/Setting_up_Development_Environment).

View File

@ -38,7 +38,7 @@ PROJECT_NAME = "libnx"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "$(TRAVIS_TAG)"
PROJECT_NUMBER = "$(LIBNX_VERSION)"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -8,13 +8,6 @@ endif
include $(DEVKITPRO)/devkitA64/base_rules
export LIBNX_MAJOR := 1
export LIBNX_MINOR := 0
export LIBNX_PATCH := 0
VERSION := $(LIBNX_MAJOR).$(LIBNX_MINOR).$(LIBNX_PATCH)
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
@ -24,14 +17,14 @@ VERSION := $(LIBNX_MAJOR).$(LIBNX_MINOR).$(LIBNX_PATCH)
#---------------------------------------------------------------------------------
TARGET := nx
#BUILD := build
SOURCES := source/arm source/runtime source/kernel source/runtime/devices source/services source/gfx source/gfx/ioctl source/runtime/util/utf
SOURCES := source/arm source/kernel source/sf source/services source/crypto source/nvidia source/nvidia/ioctl source/display source/audio source/applets source/runtime source/runtime/devices source/runtime/util source/runtime/util/utf
DATA := data
INCLUDES := include
INCLUDES := include external/bsd/include
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec
CFLAGS := -g -Wall -Werror \
-ffunction-sections \
@ -39,7 +32,7 @@ CFLAGS := -g -Wall -Werror \
$(ARCH) \
$(BUILD_CFLAGS)
CFLAGS += $(INCLUDE) -DSWITCH
CFLAGS += $(INCLUDE) -D__SWITCH__ -DLIBNX_NO_DEPRECATION
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
@ -80,30 +73,29 @@ else
endif
#---------------------------------------------------------------------------------
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I. \
-iquote $(CURDIR)/include/switch/
.PHONY: clean all
.PHONY: clean all lib/libnx.a lib/libnxd.a
#---------------------------------------------------------------------------------
all: lib/libnx.a lib/libnxd.a
dist-bin: all
@tar --exclude=*~ -cjf libnx-$(VERSION).tar.bz2 include lib default_icon.jpg switch_rules switch.ld switch.specs
install: lib/libnx.a lib/libnxd.a
@mkdir -p $(DESTDIR)$(DEVKITPRO)/libnx
@cp -v default_icon.jpg switch_rules switch.ld switch.specs $(DESTDIR)$(DEVKITPRO)/libnx/
@cp -rv include lib $(DESTDIR)$(DEVKITPRO)/libnx/
@cp -rv external/bsd/include $(DESTDIR)$(DEVKITPRO)/libnx/
dist-src:
@tar --exclude=*~ -cjf libnx-src-$(VERSION).tar.bz2 include source data Makefile switch_rules switch.ld switch.specs
dist: dist-src dist-bin
install: dist-bin
mkdir -p $(DEVKITPRO)/libnx
bzip2 -cd libnx-$(VERSION).tar.bz2 | tar -xf - -C $(DEVKITPRO)/libnx
@tar -cjf libnx-`git describe --tags | sed 's/^v//'`.tar.bz2 include source data external Makefile default_icon.jpg switch_rules switch.ld switch.specs
#dox:
# @doxygen Doxyfile
@ -147,8 +139,10 @@ DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
$(OFILES_SRC) : $(HFILES)
#---------------------------------------------------------------------------------
%.bin.o : %.bin
%_bin.h %.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

41
nx/external/bsd/include/arpa/inet.h vendored Normal file
View File

@ -0,0 +1,41 @@
// FreeBSD's header was so full of s*it, I just picked libctru's version of <arpa/inet.h>
#pragma once
#include <netinet/in.h>
#include <stdint.h>
static inline uint32_t htonl(uint32_t hostlong)
{
return __builtin_bswap32(hostlong);
}
static inline uint16_t htons(uint16_t hostshort)
{
return __builtin_bswap16(hostshort);
}
static inline uint32_t ntohl(uint32_t netlong)
{
return __builtin_bswap32(netlong);
}
static inline uint16_t ntohs(uint16_t netshort)
{
return __builtin_bswap16(netshort);
}
#ifdef __cplusplus
extern "C" {
#endif
in_addr_t inet_addr(const char *cp);
int inet_aton(const char *cp, struct in_addr *inp);
char* inet_ntoa(struct in_addr in);
const char *inet_ntop(int af, const void * src, char * dst, socklen_t size);
int inet_pton(int af, const char * src, void * dst);
#ifdef __cplusplus
}
#endif

484
nx/external/bsd/include/net/bpf.h vendored Normal file
View File

@ -0,0 +1,484 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
// Stubbed some stuff
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)bpf.h 8.1 (Berkeley) 6/10/93
* @(#)bpf.h 1.34 (LBL) 6/16/96
*
* $FreeBSD$
*/
#ifndef _NET_BPF_H_
#define _NET_BPF_H_
#include <stdint.h>
#include <sys/types.h>
/* BSD style release date */
#define BPF_RELEASE 199606
typedef int32_t bpf_int32;
typedef u_int32_t bpf_u_int32;
typedef int64_t bpf_int64;
typedef u_int64_t bpf_u_int64;
/*
* Alignment macros. BPF_WORDALIGN rounds up to the next
* even multiple of BPF_ALIGNMENT.
*/
#define BPF_ALIGNMENT sizeof(long)
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
#define BPF_MAXINSNS 512
#define BPF_MAXBUFSIZE 0x80000
#define BPF_MINBUFSIZE 32
/*
* Structure for BIOCSETF.
*/
struct bpf_program {
u_int bf_len;
struct bpf_insn *bf_insns;
};
/*
* Struct returned by BIOCGSTATS.
*/
struct bpf_stat {
u_int bs_recv; /* number of packets received */
u_int bs_drop; /* number of packets dropped */
};
/*
* Struct return by BIOCVERSION. This represents the version number of
* the filter language described by the instruction encodings below.
* bpf understands a program iff kernel_major == filter_major &&
* kernel_minor >= filter_minor, that is, if the value returned by the
* running kernel has the same major number and a minor number equal
* equal to or less than the filter being downloaded. Otherwise, the
* results are undefined, meaning an error may be returned or packets
* may be accepted haphazardly.
* It has nothing to do with the source code version.
*/
struct bpf_version {
u_short bv_major;
u_short bv_minor;
};
/* Current version number of filter architecture. */
#define BPF_MAJOR_VERSION 1
#define BPF_MINOR_VERSION 1
/*
* Historically, BPF has supported a single buffering model, first using mbuf
* clusters in kernel, and later using malloc(9) buffers in kernel. We now
* support multiple buffering modes, which may be queried and set using
* BIOCGETBUFMODE and BIOCSETBUFMODE. So as to avoid handling the complexity
* of changing modes while sniffing packets, the mode becomes fixed once an
* interface has been attached to the BPF descriptor.
*/
#define BPF_BUFMODE_BUFFER 1 /* Kernel buffers with read(). */
#define BPF_BUFMODE_ZBUF 2 /* Zero-copy buffers. */
/*-
* Struct used by BIOCSETZBUF, BIOCROTZBUF: describes up to two zero-copy
* buffer as used by BPF.
*/
struct bpf_zbuf {
void *bz_bufa; /* Location of 'a' zero-copy buffer. */
void *bz_bufb; /* Location of 'b' zero-copy buffer. */
size_t bz_buflen; /* Size of zero-copy buffers. */
};
#define BIOCGBLEN _IOR('B', 102, u_int)
#define BIOCSBLEN _IOWR('B', 102, u_int)
#define BIOCSETF _IOW('B', 103, struct bpf_program)
#define BIOCFLUSH _IO('B', 104)
#define BIOCPROMISC _IO('B', 105)
#define BIOCGDLT _IOR('B', 106, u_int)
#define BIOCGETIF _IOR('B', 107, struct ifreq)
#define BIOCSETIF _IOW('B', 108, struct ifreq)
#define BIOCSRTIMEOUT _IOW('B', 109, struct timeval)
#define BIOCGRTIMEOUT _IOR('B', 110, struct timeval)
#define BIOCGSTATS _IOR('B', 111, struct bpf_stat)
#define BIOCIMMEDIATE _IOW('B', 112, u_int)
#define BIOCVERSION _IOR('B', 113, struct bpf_version)
#define BIOCGRSIG _IOR('B', 114, u_int)
#define BIOCSRSIG _IOW('B', 115, u_int)
#define BIOCGHDRCMPLT _IOR('B', 116, u_int)
#define BIOCSHDRCMPLT _IOW('B', 117, u_int)
#define BIOCGDIRECTION _IOR('B', 118, u_int)
#define BIOCSDIRECTION _IOW('B', 119, u_int)
#define BIOCSDLT _IOW('B', 120, u_int)
#define BIOCGDLTLIST _IOWR('B', 121, struct bpf_dltlist)
#define BIOCLOCK _IO('B', 122)
#define BIOCSETWF _IOW('B', 123, struct bpf_program)
#define BIOCFEEDBACK _IOW('B', 124, u_int)
#define BIOCGETBUFMODE _IOR('B', 125, u_int)
#define BIOCSETBUFMODE _IOW('B', 126, u_int)
#define BIOCGETZMAX _IOR('B', 127, size_t)
#define BIOCROTZBUF _IOR('B', 128, struct bpf_zbuf)
#define BIOCSETZBUF _IOW('B', 129, struct bpf_zbuf)
#define BIOCSETFNR _IOW('B', 130, struct bpf_program)
#define BIOCGTSTAMP _IOR('B', 131, u_int)
#define BIOCSTSTAMP _IOW('B', 132, u_int)
// Nintendo bullshit:
#define BIOCSETF_SERIALIZED _IOW('B', 103, struct bpf_program_serialized)
#define BIOCSETWF_SERIALIZED _IOW('B', 123, struct bpf_program_serialized)
#define BIOCSETFNR_SERIALIZED _IOW('B', 130, struct bpf_program_serialized)
/* Obsolete */
#define BIOCGSEESENT BIOCGDIRECTION
#define BIOCSSEESENT BIOCSDIRECTION
/* Packet directions */
enum bpf_direction {
BPF_D_IN, /* See incoming packets */
BPF_D_INOUT, /* See incoming and outgoing packets */
BPF_D_OUT /* See outgoing packets */
};
/* Time stamping functions */
#define BPF_T_MICROTIME 0x0000
#define BPF_T_NANOTIME 0x0001
#define BPF_T_BINTIME 0x0002
#define BPF_T_NONE 0x0003
#define BPF_T_FORMAT_MASK 0x0003
#define BPF_T_NORMAL 0x0000
#define BPF_T_FAST 0x0100
#define BPF_T_MONOTONIC 0x0200
#define BPF_T_MONOTONIC_FAST (BPF_T_FAST | BPF_T_MONOTONIC)
#define BPF_T_FLAG_MASK 0x0300
#define BPF_T_FORMAT(t) ((t) & BPF_T_FORMAT_MASK)
#define BPF_T_FLAG(t) ((t) & BPF_T_FLAG_MASK)
#define BPF_T_VALID(t) \
((t) == BPF_T_NONE || (BPF_T_FORMAT(t) != BPF_T_NONE && \
((t) & ~(BPF_T_FORMAT_MASK | BPF_T_FLAG_MASK)) == 0))
#define BPF_T_MICROTIME_FAST (BPF_T_MICROTIME | BPF_T_FAST)
#define BPF_T_NANOTIME_FAST (BPF_T_NANOTIME | BPF_T_FAST)
#define BPF_T_BINTIME_FAST (BPF_T_BINTIME | BPF_T_FAST)
#define BPF_T_MICROTIME_MONOTONIC (BPF_T_MICROTIME | BPF_T_MONOTONIC)
#define BPF_T_NANOTIME_MONOTONIC (BPF_T_NANOTIME | BPF_T_MONOTONIC)
#define BPF_T_BINTIME_MONOTONIC (BPF_T_BINTIME | BPF_T_MONOTONIC)
#define BPF_T_MICROTIME_MONOTONIC_FAST (BPF_T_MICROTIME | BPF_T_MONOTONIC_FAST)
#define BPF_T_NANOTIME_MONOTONIC_FAST (BPF_T_NANOTIME | BPF_T_MONOTONIC_FAST)
#define BPF_T_BINTIME_MONOTONIC_FAST (BPF_T_BINTIME | BPF_T_MONOTONIC_FAST)
/*
* Structure prepended to each packet.
*/
struct bpf_ts {
bpf_int64 bt_sec; /* seconds */
bpf_u_int64 bt_frac; /* fraction */
};
struct bpf_xhdr {
struct bpf_ts bh_tstamp; /* time stamp */
bpf_u_int32 bh_caplen; /* length of captured portion */
bpf_u_int32 bh_datalen; /* original length of packet */
u_short bh_hdrlen; /* length of bpf header (this struct
plus alignment padding) */
};
/* Obsolete */
struct bpf_hdr {
struct timeval bh_tstamp; /* time stamp */
bpf_u_int32 bh_caplen; /* length of captured portion */
bpf_u_int32 bh_datalen; /* original length of packet */
u_short bh_hdrlen; /* length of bpf header (this struct
plus alignment padding) */
};
/*
* When using zero-copy BPF buffers, a shared memory header is present
* allowing the kernel BPF implementation and user process to synchronize
* without using system calls. This structure defines that header. When
* accessing these fields, appropriate atomic operation and memory barriers
* are required in order not to see stale or out-of-order data; see bpf(4)
* for reference code to access these fields from userspace.
*
* The layout of this structure is critical, and must not be changed; if must
* fit in a single page on all architectures.
*/
struct bpf_zbuf_header {
volatile u_int bzh_kernel_gen; /* Kernel generation number. */
volatile u_int bzh_kernel_len; /* Length of data in the buffer. */
volatile u_int bzh_user_gen; /* User generation number. */
u_int _bzh_pad[5];
};
/* Pull in data-link level type codes. */
#include <net/dlt.h>
/*
* The instruction encodings.
*
* Please inform tcpdump-workers@lists.tcpdump.org if you use any
* of the reserved values, so that we can note that they're used
* (and perhaps implement it in the reference BPF implementation
* and encourage its implementation elsewhere).
*/
/*
* The upper 8 bits of the opcode aren't used. BSD/OS used 0x8000.
*/
/* instruction classes */
#define BPF_CLASS(code) ((code) & 0x07)
#define BPF_LD 0x00
#define BPF_LDX 0x01
#define BPF_ST 0x02
#define BPF_STX 0x03
#define BPF_ALU 0x04
#define BPF_JMP 0x05
#define BPF_RET 0x06
#define BPF_MISC 0x07
/* ld/ldx fields */
#define BPF_SIZE(code) ((code) & 0x18)
#define BPF_W 0x00
#define BPF_H 0x08
#define BPF_B 0x10
/* 0x18 reserved; used by BSD/OS */
#define BPF_MODE(code) ((code) & 0xe0)
#define BPF_IMM 0x00
#define BPF_ABS 0x20
#define BPF_IND 0x40
#define BPF_MEM 0x60
#define BPF_LEN 0x80
#define BPF_MSH 0xa0
/* 0xc0 reserved; used by BSD/OS */
/* 0xe0 reserved; used by BSD/OS */
/* alu/jmp fields */
#define BPF_OP(code) ((code) & 0xf0)
#define BPF_ADD 0x00
#define BPF_SUB 0x10
#define BPF_MUL 0x20
#define BPF_DIV 0x30
#define BPF_OR 0x40
#define BPF_AND 0x50
#define BPF_LSH 0x60
#define BPF_RSH 0x70
#define BPF_NEG 0x80
#define BPF_MOD 0x90
#define BPF_XOR 0xa0
/* 0xb0 reserved */
/* 0xc0 reserved */
/* 0xd0 reserved */
/* 0xe0 reserved */
/* 0xf0 reserved */
#define BPF_JA 0x00
#define BPF_JEQ 0x10
#define BPF_JGT 0x20
#define BPF_JGE 0x30
#define BPF_JSET 0x40
/* 0x50 reserved; used on BSD/OS */
/* 0x60 reserved */
/* 0x70 reserved */
/* 0x80 reserved */
/* 0x90 reserved */
/* 0xa0 reserved */
/* 0xb0 reserved */
/* 0xc0 reserved */
/* 0xd0 reserved */
/* 0xe0 reserved */
/* 0xf0 reserved */
#define BPF_SRC(code) ((code) & 0x08)
#define BPF_K 0x00
#define BPF_X 0x08
/* ret - BPF_K and BPF_X also apply */
#define BPF_RVAL(code) ((code) & 0x18)
#define BPF_A 0x10
/* 0x18 reserved */
/* misc */
#define BPF_MISCOP(code) ((code) & 0xf8)
#define BPF_TAX 0x00
/* 0x08 reserved */
/* 0x10 reserved */
/* 0x18 reserved */
/* #define BPF_COP 0x20 NetBSD "coprocessor" extensions */
/* 0x28 reserved */
/* 0x30 reserved */
/* 0x38 reserved */
/* #define BPF_COPX 0x40 NetBSD "coprocessor" extensions */
/* also used on BSD/OS */
/* 0x48 reserved */
/* 0x50 reserved */
/* 0x58 reserved */
/* 0x60 reserved */
/* 0x68 reserved */
/* 0x70 reserved */
/* 0x78 reserved */
#define BPF_TXA 0x80
/* 0x88 reserved */
/* 0x90 reserved */
/* 0x98 reserved */
/* 0xa0 reserved */
/* 0xa8 reserved */
/* 0xb0 reserved */
/* 0xb8 reserved */
/* 0xc0 reserved; used on BSD/OS */
/* 0xc8 reserved */
/* 0xd0 reserved */
/* 0xd8 reserved */
/* 0xe0 reserved */
/* 0xe8 reserved */
/* 0xf0 reserved */
/* 0xf8 reserved */
/*
* The instruction data structure.
*/
struct bpf_insn {
u_short code;
u_char jt;
u_char jf;
bpf_u_int32 k;
};
// Nintendo's bullshit
struct bpf_program_serialized {
u_int bf_len;
struct bpf_insn bf_insns[BPF_MAXINSNS];
};
/*
* Macros for insn array initializers.
*/
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
/*
* Structure to retrieve available DLTs for the interface.
*/
struct bpf_dltlist {
u_int bfl_len; /* number of bfd_list array */
u_int *bfl_list; /* array of DLTs */
};
/*
* Rotate the packet buffers in descriptor d. Move the store buffer into the
* hold slot, and the free buffer into the store slot. Zero the length of the
* new store buffer. Descriptor lock should be held. One must be careful to
* not rotate the buffers twice, i.e. if fbuf != NULL.
*/
#define ROTATE_BUFFERS(d) do { \
(d)->bd_hbuf = (d)->bd_sbuf; \
(d)->bd_hlen = (d)->bd_slen; \
(d)->bd_sbuf = (d)->bd_fbuf; \
(d)->bd_slen = 0; \
(d)->bd_fbuf = NULL; \
bpf_bufheld(d); \
} while (0)
/*
* Descriptor associated with each attached hardware interface.
* Part of this structure is exposed to external callers to speed up
* bpf_peers_present() calls.
*/
struct bpf_if;
struct bpf_if_ext; // Removed definition, if you need it, PR
/* [TuxSH] if you need those, PR;
void bpf_bufheld(struct bpf_d *d);
int bpf_validate(const struct bpf_insn *, int);
void bpf_tap(struct bpf_if *, u_char *, u_int);
void bpf_mtap(struct bpf_if *, struct mbuf *);
void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *);
void bpfattach(struct ifnet *, u_int, u_int);
void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **);
void bpfdetach(struct ifnet *);
#ifdef VIMAGE
int bpf_get_bp_params(struct bpf_if *, u_int *, u_int *);
#endif
void bpfilterattach(int);
u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int);
static __inline int
bpf_peers_present(struct bpf_if *bpf)
{
struct bpf_if_ext *ext;
ext = (struct bpf_if_ext *)bpf;
if (!LIST_EMPTY(&ext->bif_dlist))
return (1);
return (0);
}
#define BPF_TAP(_ifp,_pkt,_pktlen) do { \
if (bpf_peers_present((_ifp)->if_bpf)) \
bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \
} while (0)
#define BPF_MTAP(_ifp,_m) do { \
if (bpf_peers_present((_ifp)->if_bpf)) { \
M_ASSERTVALID(_m); \
bpf_mtap((_ifp)->if_bpf, (_m)); \
} \
} while (0)
#define BPF_MTAP2(_ifp,_data,_dlen,_m) do { \
if (bpf_peers_present((_ifp)->if_bpf)) { \
M_ASSERTVALID(_m); \
bpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m)); \
} \
} while (0)
#endif
*/
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
*/
#define BPF_MEMWORDS 16
#if 0 //def _SYS_EVENTHANDLER_H_
/* BPF attach/detach events */
struct ifnet;
typedef void (*bpf_track_fn)(void *, struct ifnet *, int /* dlt */,
int /* 1 =>'s attach */);
EVENTHANDLER_DECLARE(bpf_track, bpf_track_fn);
#endif /* _SYS_EVENTHANDLER_H_ */
#endif /* _NET_BPF_H_ */

1338
nx/external/bsd/include/net/dlt.h vendored Normal file

File diff suppressed because it is too large Load Diff

548
nx/external/bsd/include/net/if.h vendored Normal file
View File

@ -0,0 +1,548 @@
// Removed kernel stuff, use anon unions
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _NET_IF_H_
#define _NET_IF_H_
#include <sys/cdefs.h>
#if __BSD_VISIBLE
/*
* <net/if.h> does not depend on <sys/time.h> on most other systems. This
* helps userland compatibility. (struct timeval ifi_lastchange)
* The same holds for <sys/socket.h>. (struct sockaddr ifru_addr)
*/
#include <sys/time.h>
#include <sys/socket.h>
#endif
/*
* Length of interface external name, including terminating '\0'.
* Note: this is the same size as a generic device's external name.
*/
#define IF_NAMESIZE 16
#if __BSD_VISIBLE
#define IFNAMSIZ IF_NAMESIZE
#define IF_MAXUNIT 0x7fff /* historical value */
#endif
#if __BSD_VISIBLE
/*
* Structure used to query names of interface cloners.
*/
struct if_clonereq {
int ifcr_total; /* total cloners (out) */
int ifcr_count; /* room for this many in user buffer */
char *ifcr_buffer; /* buffer for cloner names */
};
/*
* Structure describing information about an interface
* which may be of interest to management entities.
*/
struct if_data {
/* generic interface information */
uint8_t ifi_type; /* ethernet, tokenring, etc */
uint8_t ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
uint8_t ifi_addrlen; /* media address length */
uint8_t ifi_hdrlen; /* media header length */
uint8_t ifi_link_state; /* current link state */
uint8_t ifi_vhid; /* carp vhid */
uint16_t ifi_datalen; /* length of this data struct */
uint32_t ifi_mtu; /* maximum transmission unit */
uint32_t ifi_metric; /* routing metric (external only) */
uint64_t ifi_baudrate; /* linespeed */
/* volatile statistics */
uint64_t ifi_ipackets; /* packets received on interface */
uint64_t ifi_ierrors; /* input errors on interface */
uint64_t ifi_opackets; /* packets sent on interface */
uint64_t ifi_oerrors; /* output errors on interface */
uint64_t ifi_collisions; /* collisions on csma interfaces */
uint64_t ifi_ibytes; /* total number of octets received */
uint64_t ifi_obytes; /* total number of octets sent */
uint64_t ifi_imcasts; /* packets received via multicast */
uint64_t ifi_omcasts; /* packets sent via multicast */
uint64_t ifi_iqdrops; /* dropped on input */
uint64_t ifi_oqdrops; /* dropped on output */
uint64_t ifi_noproto; /* destined for unsupported protocol */
uint64_t ifi_hwassist; /* HW offload capabilities, see IFCAP */
time_t ifi_epoch; /* uptime at attach or stat reset */
struct timeval ifi_lastchange; /* time of last administrative change */
};
/*-
* Interface flags are of two types: network stack owned flags, and driver
* owned flags. Historically, these values were stored in the same ifnet
* flags field, but with the advent of fine-grained locking, they have been
* broken out such that the network stack is responsible for synchronizing
* the stack-owned fields, and the device driver the device-owned fields.
* Both halves can perform lockless reads of the other half's field, subject
* to accepting the involved races.
*
* Both sets of flags come from the same number space, and should not be
* permitted to conflict, as they are exposed to user space via a single
* field.
*
* The following symbols identify read and write requirements for fields:
*
* (i) if_flags field set by device driver before attach, read-only there
* after.
* (n) if_flags field written only by the network stack, read by either the
* stack or driver.
* (d) if_drv_flags field written only by the device driver, read by either
* the stack or driver.
*/
#define IFF_UP 0x1 /* (n) interface is up */
#define IFF_BROADCAST 0x2 /* (i) broadcast address valid */
#define IFF_DEBUG 0x4 /* (n) turn on debugging */
#define IFF_LOOPBACK 0x8 /* (i) is a loopback net */
#define IFF_POINTOPOINT 0x10 /* (i) is a point-to-point link */
/* 0x20 was IFF_SMART */
#define IFF_DRV_RUNNING 0x40 /* (d) resources allocated */
#define IFF_NOARP 0x80 /* (n) no address resolution protocol */
#define IFF_PROMISC 0x100 /* (n) receive all packets */
#define IFF_ALLMULTI 0x200 /* (n) receive all multicast packets */
#define IFF_DRV_OACTIVE 0x400 /* (d) tx hardware queue is full */
#define IFF_SIMPLEX 0x800 /* (i) can't hear own transmissions */
#define IFF_LINK0 0x1000 /* per link layer defined bit */
#define IFF_LINK1 0x2000 /* per link layer defined bit */
#define IFF_LINK2 0x4000 /* per link layer defined bit */
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
#define IFF_MULTICAST 0x8000 /* (i) supports multicast */
#define IFF_CANTCONFIG 0x10000 /* (i) unconfigurable using ioctl(2) */
#define IFF_PPROMISC 0x20000 /* (n) user-requested promisc mode */
#define IFF_MONITOR 0x40000 /* (n) user-requested monitor mode */
#define IFF_STATICARP 0x80000 /* (n) static ARP */
#define IFF_DYING 0x200000 /* (n) interface is winding down */
#define IFF_RENAMING 0x400000 /* (n) interface is being renamed */
/*
* Old names for driver flags so that user space tools can continue to use
* the old (portable) names.
*/
#define IFF_RUNNING IFF_DRV_RUNNING
#define IFF_OACTIVE IFF_DRV_OACTIVE
/* flags set internally only: */
#define IFF_CANTCHANGE \
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_PROMISC|\
IFF_DYING|IFF_CANTCONFIG)
/*
* Values for if_link_state.
*/
#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */
#define LINK_STATE_DOWN 1 /* link is down */
#define LINK_STATE_UP 2 /* link is up */
/*
* Some convenience macros used for setting ifi_baudrate.
* XXX 1000 vs. 1024? --thorpej@netbsd.org
*/
#define IF_Kbps(x) ((uintmax_t)(x) * 1000) /* kilobits/sec. */
#define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */
#define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */
/*
* Capabilities that interfaces can advertise.
*
* struct ifnet.if_capabilities
* contains the optional features & capabilities a particular interface
* supports (not only the driver but also the detected hw revision).
* Capabilities are defined by IFCAP_* below.
* struct ifnet.if_capenable
* contains the enabled (either by default or through ifconfig) optional
* features & capabilities on this interface.
* Capabilities are defined by IFCAP_* below.
* struct if_data.ifi_hwassist in mbuf CSUM_ flag form, controlled by above
* contains the enabled optional feature & capabilites that can be used
* individually per packet and are specified in the mbuf pkthdr.csum_flags
* field. IFCAP_* and CSUM_* do not match one to one and CSUM_* may be
* more detailed or differenciated than IFCAP_*.
* Hwassist features are defined CSUM_* in sys/mbuf.h
*
* Capabilities that cannot be arbitrarily changed with ifconfig/ioctl
* are listed in IFCAP_CANTCHANGE, similar to IFF_CANTCHANGE.
* This is not strictly necessary because the common code never
* changes capabilities, and it is left to the individual driver
* to do the right thing. However, having the filter here
* avoids replication of the same code in all individual drivers.
*/
#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */
#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */
#define IFCAP_NETCONS 0x00004 /* can be a network console */
#define IFCAP_VLAN_MTU 0x00008 /* VLAN-compatible MTU */
#define IFCAP_VLAN_HWTAGGING 0x00010 /* hardware VLAN tag support */
#define IFCAP_JUMBO_MTU 0x00020 /* 9000 byte MTU supported */
#define IFCAP_POLLING 0x00040 /* driver supports polling */
#define IFCAP_VLAN_HWCSUM 0x00080 /* can do IFCAP_HWCSUM on VLANs */
#define IFCAP_TSO4 0x00100 /* can do TCP Segmentation Offload */
#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */
#define IFCAP_LRO 0x00400 /* can do Large Receive Offload */
#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */
#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */
#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */
#define IFCAP_TOE4 0x04000 /* interface can offload TCP */
#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */
/* available 0x20000 */
#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */
#define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */
#define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */
#define IFCAP_RXCSUM_IPV6 0x200000 /* can offload checksum on IPv6 RX */
#define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */
#define IFCAP_HWSTATS 0x800000 /* manages counters internally */
#define IFCAP_TXRTLMT 0x1000000 /* hardware supports TX rate limiting */
#define IFCAP_HWRXTSTMP 0x2000000 /* hardware rx timestamping */
#define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6)
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC)
#define IFCAP_TOE (IFCAP_TOE4 | IFCAP_TOE6)
#define IFCAP_CANTCHANGE (IFCAP_NETMAP)
#define IFQ_MAXLEN 50
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
/*
* Message format for use in obtaining information about interfaces
* from getkerninfo and the routing socket
* For the new, extensible interface see struct if_msghdrl below.
*/
struct if_msghdr {
u_short ifm_msglen; /* to skip over non-understood messages */
u_char ifm_version; /* future binary compatibility */
u_char ifm_type; /* message type */
int ifm_addrs; /* like rtm_addrs */
int ifm_flags; /* value of if_flags */
u_short ifm_index; /* index for associated ifp */
struct if_data ifm_data;/* statistics and other data about if */
};
/*
* The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is
* extensible after ifm_data_off or within ifm_data. Both the if_msghdr and
* if_data now have a member field detailing the struct length in addition to
* the routing message length. Macros are provided to find the start of
* ifm_data and the start of the socket address strucutres immediately following
* struct if_msghdrl given a pointer to struct if_msghdrl.
*/
#define IF_MSGHDRL_IFM_DATA(_l) \
(struct if_data *)((char *)(_l) + (_l)->ifm_data_off)
#define IF_MSGHDRL_RTA(_l) \
(void *)((uintptr_t)(_l) + (_l)->ifm_len)
struct if_msghdrl {
u_short ifm_msglen; /* to skip over non-understood messages */
u_char ifm_version; /* future binary compatibility */
u_char ifm_type; /* message type */
int ifm_addrs; /* like rtm_addrs */
int ifm_flags; /* value of if_flags */
u_short ifm_index; /* index for associated ifp */
u_short _ifm_spare1; /* spare space to grow if_index, see if_var.h */
u_short ifm_len; /* length of if_msghdrl incl. if_data */
u_short ifm_data_off; /* offset of if_data from beginning */
struct if_data ifm_data;/* statistics and other data about if */
};
/*
* Message format for use in obtaining information about interface addresses
* from getkerninfo and the routing socket
* For the new, extensible interface see struct ifa_msghdrl below.
*/
struct ifa_msghdr {
u_short ifam_msglen; /* to skip over non-understood messages */
u_char ifam_version; /* future binary compatibility */
u_char ifam_type; /* message type */
int ifam_addrs; /* like rtm_addrs */
int ifam_flags; /* value of ifa_flags */
u_short ifam_index; /* index for associated ifp */
int ifam_metric; /* value of ifa_ifp->if_metric */
};
/*
* The 'l' version shall be used by new interfaces, like NET_RT_IFLISTL. It is
* extensible after ifam_metric or within ifam_data. Both the ifa_msghdrl and
* if_data now have a member field detailing the struct length in addition to
* the routing message length. Macros are provided to find the start of
* ifm_data and the start of the socket address strucutres immediately following
* struct ifa_msghdrl given a pointer to struct ifa_msghdrl.
*/
#define IFA_MSGHDRL_IFAM_DATA(_l) \
(struct if_data *)((char *)(_l) + (_l)->ifam_data_off)
#define IFA_MSGHDRL_RTA(_l) \
(void *)((uintptr_t)(_l) + (_l)->ifam_len)
struct ifa_msghdrl {
u_short ifam_msglen; /* to skip over non-understood messages */
u_char ifam_version; /* future binary compatibility */
u_char ifam_type; /* message type */
int ifam_addrs; /* like rtm_addrs */
int ifam_flags; /* value of ifa_flags */
u_short ifam_index; /* index for associated ifp */
u_short _ifam_spare1; /* spare space to grow if_index, see if_var.h */
u_short ifam_len; /* length of ifa_msghdrl incl. if_data */
u_short ifam_data_off; /* offset of if_data from beginning */
int ifam_metric; /* value of ifa_ifp->if_metric */
struct if_data ifam_data;/* statistics and other data about if or
* address */
};
/*
* Message format for use in obtaining information about multicast addresses
* from the routing socket
*/
struct ifma_msghdr {
u_short ifmam_msglen; /* to skip over non-understood messages */
u_char ifmam_version; /* future binary compatibility */
u_char ifmam_type; /* message type */
int ifmam_addrs; /* like rtm_addrs */
int ifmam_flags; /* value of ifa_flags */
u_short ifmam_index; /* index for associated ifp */
};
/*
* Message format announcing the arrival or departure of a network interface.
*/
struct if_announcemsghdr {
u_short ifan_msglen; /* to skip over non-understood messages */
u_char ifan_version; /* future binary compatibility */
u_char ifan_type; /* message type */
u_short ifan_index; /* index for associated ifp */
char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */
u_short ifan_what; /* what type of announcement */
};
#define IFAN_ARRIVAL 0 /* interface arrival */
#define IFAN_DEPARTURE 1 /* interface departure */
/*
* Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests
*/
struct ifreq_buffer {
size_t length;
void *buffer;
};
/*
* Interface request structure used for socket
* ioctl's. All interface ioctl's must have parameter
* definitions which begin with ifr_name. The
* remainder may be interface specific.
*/
struct ifreq {
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifr_addr; /* address */
struct sockaddr ifr_dstaddr; /* other end of p-to-p link */
struct sockaddr ifr_broadaddr; /* broadcast address */
struct ifreq_buffer ifr_buffer; /* user supplied buffer with its length */
short ifr_flags; /* flags (low 16 bits) */
short ifr_flagshigh; /* flags (high 16 bits) */
short ifr_index; /* interface index */
int ifr_jid; /* jail/vnet */
int ifr_metric; /* metric */
int ifr_mtu; /* mtu */
int ifr_phys; /* physical wire */
int ifr_media; /* physical media */
caddr_t ifr_data; /* for use by interface */
int ifr_cap[2]; /* requested/current capabilities */
u_int ifr_fib; /* interface fib */
u_char ifr_vlan_pcp; /* VLAN priority */
};
};
#define _SIZEOF_ADDR_IFREQ(ifr) \
((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
(sizeof(struct ifreq) - sizeof(struct sockaddr) + \
(ifr).ifr_addr.sa_len) : sizeof(struct ifreq))
struct ifaliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
struct sockaddr ifra_addr;
struct sockaddr ifra_broadaddr;
struct sockaddr ifra_mask;
int ifra_vhid;
};
/* 9.x compat */
struct oifaliasreq {
char ifra_name[IFNAMSIZ];
struct sockaddr ifra_addr;
struct sockaddr ifra_broadaddr;
struct sockaddr ifra_mask;
};
struct ifmediareq {
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
int ifm_current; /* current media options */
int ifm_mask; /* don't care mask */
int ifm_status; /* media status */
int ifm_active; /* active options */
int ifm_count; /* # entries in ifm_ulist array */
int *ifm_ulist; /* media words */
};
struct ifdrv {
char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
unsigned long ifd_cmd;
size_t ifd_len;
void *ifd_data;
};
/*
* Structure used to retrieve aux status data from interfaces.
* Kernel suppliers to this interface should respect the formatting
* needed by ifconfig(8): each line starts with a TAB and ends with
* a newline. The canonical example to copy and paste is in if_tun.c.
*/
#define IFSTATMAX 800 /* 10 lines of text */
struct ifstat {
char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */
char ascii[IFSTATMAX + 1];
};
/*
* Structure used in SIOCGIFCONF request.
* Used to retrieve interface configuration
* for machine (useful for programs which
* must know all networks accessible).
*/
struct ifconf {
int ifc_len; /* size of associated buffer */
union {
caddr_t ifc_buf; /* buffer address */
struct ifreq *ifc_req; /* array of structures returned */
};
};
/*
* interface groups
*/
#define IFG_ALL "all" /* group contains all interfaces */
/* XXX: will we implement this? */
#define IFG_EGRESS "egress" /* if(s) default route(s) point to */
struct ifg_req {
union {
char ifgrq_group[IFNAMSIZ];
char ifgrq_member[IFNAMSIZ];
};
};
/*
* Used to lookup groups for an interface
*/
struct ifgroupreq {
char ifgr_name[IFNAMSIZ];
u_int ifgr_len;
union {
char ifgr_group[IFNAMSIZ];
struct ifg_req *ifgr_groups;
};
};
/*
* Structure used to request i2c data
* from interface transceivers.
*/
struct ifi2creq {
uint8_t dev_addr; /* i2c address (0xA0, 0xA2) */
uint8_t offset; /* read offset */
uint8_t len; /* read length */
uint8_t spare0;
uint32_t spare1;
uint8_t data[8]; /* read buffer */
};
/*
* RSS hash.
*/
#define RSS_FUNC_NONE 0 /* RSS disabled */
#define RSS_FUNC_PRIVATE 1 /* non-standard */
#define RSS_FUNC_TOEPLITZ 2
#define RSS_TYPE_IPV4 0x00000001
#define RSS_TYPE_TCP_IPV4 0x00000002
#define RSS_TYPE_IPV6 0x00000004
#define RSS_TYPE_IPV6_EX 0x00000008
#define RSS_TYPE_TCP_IPV6 0x00000010
#define RSS_TYPE_TCP_IPV6_EX 0x00000020
#define RSS_TYPE_UDP_IPV4 0x00000040
#define RSS_TYPE_UDP_IPV6 0x00000080
#define RSS_TYPE_UDP_IPV6_EX 0x00000100
#define RSS_KEYLEN 128
struct ifrsskey {
char ifrk_name[IFNAMSIZ]; /* if name, e.g. "en0" */
uint8_t ifrk_func; /* RSS_FUNC_ */
uint8_t ifrk_spare0;
uint16_t ifrk_keylen;
uint8_t ifrk_key[RSS_KEYLEN];
};
struct ifrsshash {
char ifrh_name[IFNAMSIZ]; /* if name, e.g. "en0" */
uint8_t ifrh_func; /* RSS_FUNC_ */
uint8_t ifrh_spare0;
uint16_t ifrh_spare1;
uint32_t ifrh_types; /* RSS_TYPE_ */
};
#endif /* __BSD_VISIBLE */
struct if_nameindex {
unsigned int if_index; /* 1, 2, ... */
char *if_name; /* null terminated name: "le0", ... */
};
/*
__BEGIN_DECLS
void if_freenameindex(struct if_nameindex *);
char *if_indextoname(unsigned int, char *);
struct if_nameindex *if_nameindex(void);
unsigned int if_nametoindex(const char *);
__END_DECLS */
#endif /* !_NET_IF_H_ */

118
nx/external/bsd/include/net/if_arp.h vendored Normal file
View File

@ -0,0 +1,118 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _NET_IF_ARP_H_
#define _NET_IF_ARP_H_
/*
* Address Resolution Protocol.
*
* See RFC 826 for protocol description. ARP packets are variable
* in size; the arphdr structure defines the fixed-length portion.
* Protocol type values are the same as those for 10 Mb/s Ethernet.
* It is followed by the variable-sized fields ar_sha, arp_spa,
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
#define ARPHRD_ARCNET 7 /* arcnet hardware format */
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
#define ARPHRD_IEEE1394 24 /* firewire hardware format */
#define ARPHRD_INFINIBAND 32 /* infiniband hardware format */
u_short ar_pro; /* format of protocol address */
u_char ar_hln; /* length of hardware address */
u_char ar_pln; /* length of protocol address */
u_short ar_op; /* one of: */
#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
#define ARPOP_REVREPLY 4 /* response giving protocol address */
#define ARPOP_INVREQUEST 8 /* request to identify peer */
#define ARPOP_INVREPLY 9 /* response identifying peer */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
u_char ar_sha[]; /* sender hardware address */
u_char ar_spa[]; /* sender protocol address */
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
};
#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0)
#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln)
#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln)
#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
#define arphdr_len2(ar_hln, ar_pln) \
(sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln))
#define arphdr_len(ap) (arphdr_len2((ap)->ar_hln, (ap)->ar_pln))
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
};
/* arp_flags and at_flags field values */
#define ATF_INUSE 0x01 /* entry in use */
#define ATF_COM 0x02 /* completed entry (enaddr valid) */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
struct arpstat {
/* Normal things that happen: */
uint64_t txrequests; /* # of ARP requests sent by this host. */
uint64_t txreplies; /* # of ARP replies sent by this host. */
uint64_t rxrequests; /* # of ARP requests received by this host. */
uint64_t rxreplies; /* # of ARP replies received by this host. */
uint64_t received; /* # of ARP packets received by this host. */
uint64_t arp_spares[4]; /* For either the upper or lower half. */
/* Abnormal event and error counting: */
uint64_t dropped; /* # of packets dropped waiting for a reply. */
uint64_t timeouts; /* # of times with entries removed */
/* due to timeout. */
uint64_t dupips; /* # of duplicate IPs detected. */
};
#endif /* !_NET_IF_ARP_H_ */

91
nx/external/bsd/include/net/if_dl.h vendored Normal file
View File

@ -0,0 +1,91 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _NET_IF_DL_H_
#define _NET_IF_DL_H_
#include <sys/types.h> // changed
/*
* A Link-Level Sockaddr may specify the interface in one of two
* ways: either by means of a system-provided index number (computed
* anew and possibly differently on every reboot), or by a human-readable
* string such as "il0" (for managerial convenience).
*
* Census taking actions, such as something akin to SIOCGCONF would return
* both the index and the human name.
*
* High volume transactions (such as giving a link-level ``from'' address
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
* form, (which requires fewer copy operations and less space).
*
* The form and interpretation of the link-level address is purely a matter
* of convention between the device driver and its consumers; however, it is
* expected that all drivers for an interface of a given if_type will agree.
*/
/*
* Structure of a Link-Level sockaddr:
*/
struct sockaddr_dl {
u_char sdl_len; /* Total length of sockaddr */
u_char sdl_family; /* AF_LINK */
u_short sdl_index; /* if != 0, system given index for interface */
u_char sdl_type; /* interface type */
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
u_char sdl_alen; /* link level address length */
u_char sdl_slen; /* link layer selector length */
char sdl_data[46]; /* minimum work area, can be larger;
contains both if name and ll address */
};
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
#define CLLADDR(s) ((c_caddr_t)((s)->sdl_data + (s)->sdl_nlen))
#define LLINDEX(s) ((s)->sdl_index)
struct ifnet;
/*struct sockaddr_dl *link_alloc_sdl(size_t, int);
void link_free_sdl(struct sockaddr *sa);
struct sockaddr_dl *link_init_sdl(struct ifnet *, struct sockaddr *, u_char);*/
#include <sys/cdefs.h>
/*
__BEGIN_DECLS
void link_addr(const char *, struct sockaddr_dl *);
char *link_ntoa(const struct sockaddr_dl *);
__END_DECLS */
#endif

794
nx/external/bsd/include/net/if_media.h vendored Normal file
View File

@ -0,0 +1,794 @@
/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
/* $FreeBSD$ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) 1997
* Jonathan Stone and Jason R. Thorpe. All rights reserved.
*
* This software is derived from information provided by Matt Thomas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Jonathan Stone
* and Jason R. Thorpe for the NetBSD Project.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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.
*/
#ifndef _NET_IF_MEDIA_H_
#define _NET_IF_MEDIA_H_
/*
* Prototypes and definitions for BSD/OS-compatible network interface
* media selection.
*
* Where it is safe to do so, this code strays slightly from the BSD/OS
* design. Software which uses the API (device drivers, basically)
* shouldn't notice any difference.
*
* Many thanks to Matt Thomas for providing the information necessary
* to implement this interface.
*/
/*
* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media variant
* 5-7 Media type
* 8-15 Type specific options (includes added variant bits on Ethernet)
* 16-18 Mode (for multi-mode devices)
* 19 RFU
* 20-27 Shared (global) options
* 28-31 Instance
*/
/*
* Ethernet
* In order to use more than 31 subtypes, Ethernet uses some of the option
* bits as part of the subtype field. See the options section below for
* relevant definitions
*/
#define IFM_ETHER 0x00000020
#define IFM_ETHER_SUBTYPE(x) (((x) & IFM_TMASK) | \
(((x) & (IFM_ETH_XTYPE >> IFM_ETH_XSHIFT)) << IFM_ETH_XSHIFT))
#define IFM_X(x) IFM_ETHER_SUBTYPE(x) /* internal shorthand */
#define IFM_ETHER_SUBTYPE_SET(x) (IFM_ETHER_SUBTYPE(x) | IFM_ETHER)
#define IFM_ETHER_SUBTYPE_GET(x) ((x) & (IFM_TMASK|IFM_ETH_XTYPE))
#define IFM_ETHER_IS_EXTENDED(x) ((x) & IFM_ETH_XTYPE)
#define IFM_10_T 3 /* 10BaseT - RJ45 */
#define IFM_10_2 4 /* 10Base2 - Thinnet */
#define IFM_10_5 5 /* 10Base5 - AUI */
#define IFM_100_TX 6 /* 100BaseTX - RJ45 */
#define IFM_100_FX 7 /* 100BaseFX - Fiber */
#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
#define IFM_100_VG 9 /* 100VG-AnyLAN */
#define IFM_100_T2 10 /* 100BaseT2 */
#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */
#define IFM_10_STP 12 /* 10BaseT over shielded TP */
#define IFM_10_FL 13 /* 10BaseFL - Fiber */
#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */
#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */
#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */
#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */
#define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */
#define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */
#define IFM_10G_CX4 20 /* 10GBase CX4 copper */
#define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */
#define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */
#define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */
#define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */
#define IFM_UNKNOWN 25 /* media types not defined yet */
#define IFM_10G_T 26 /* 10GBase-T - RJ45 */
#define IFM_40G_CR4 27 /* 40GBase-CR4 */
#define IFM_40G_SR4 28 /* 40GBase-SR4 */
#define IFM_40G_LR4 29 /* 40GBase-LR4 */
#define IFM_1000_KX 30 /* 1000Base-KX backplane */
#define IFM_OTHER 31 /* Other: one of the following */
/* following types are not visible to old binaries using only IFM_TMASK */
#define IFM_10G_KX4 IFM_X(32) /* 10GBase-KX4 backplane */
#define IFM_10G_KR IFM_X(33) /* 10GBase-KR backplane */
#define IFM_10G_CR1 IFM_X(34) /* 10GBase-CR1 Twinax splitter */
#define IFM_20G_KR2 IFM_X(35) /* 20GBase-KR2 backplane */
#define IFM_2500_KX IFM_X(36) /* 2500Base-KX backplane */
#define IFM_2500_T IFM_X(37) /* 2500Base-T - RJ45 (NBaseT) */
#define IFM_5000_T IFM_X(38) /* 5000Base-T - RJ45 (NBaseT) */
#define IFM_50G_PCIE IFM_X(39) /* 50G Ethernet over PCIE */
#define IFM_25G_PCIE IFM_X(40) /* 25G Ethernet over PCIE */
#define IFM_1000_SGMII IFM_X(41) /* 1G media interface */
#define IFM_10G_SFI IFM_X(42) /* 10G media interface */
#define IFM_40G_XLPPI IFM_X(43) /* 40G media interface */
#define IFM_1000_CX_SGMII IFM_X(44) /* 1000Base-CX-SGMII */
#define IFM_40G_KR4 IFM_X(45) /* 40GBase-KR4 */
#define IFM_10G_ER IFM_X(46) /* 10GBase-ER */
#define IFM_100G_CR4 IFM_X(47) /* 100GBase-CR4 */
#define IFM_100G_SR4 IFM_X(48) /* 100GBase-SR4 */
#define IFM_100G_KR4 IFM_X(49) /* 100GBase-KR4 */
#define IFM_100G_LR4 IFM_X(50) /* 100GBase-LR4 */
#define IFM_56G_R4 IFM_X(51) /* 56GBase-R4 */
#define IFM_100_T IFM_X(52) /* 100BaseT - RJ45 */
#define IFM_25G_CR IFM_X(53) /* 25GBase-CR */
#define IFM_25G_KR IFM_X(54) /* 25GBase-KR */
#define IFM_25G_SR IFM_X(55) /* 25GBase-SR */
#define IFM_50G_CR2 IFM_X(56) /* 50GBase-CR2 */
#define IFM_50G_KR2 IFM_X(57) /* 50GBase-KR2 */
#define IFM_25G_LR IFM_X(58) /* 25GBase-LR */
#define IFM_10G_AOC IFM_X(59) /* 10G active optical cable */
#define IFM_25G_ACC IFM_X(60) /* 25G active copper cable */
#define IFM_25G_AOC IFM_X(61) /* 25G active optical cable */
/*
* Please update ieee8023ad_lacp.c:lacp_compose_key()
* after adding new Ethernet media types.
*/
/* Note IFM_X(511) is the max! */
/* Ethernet option values; includes bits used for extended variant field */
#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */
#define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */
#define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */
#define IFM_ETH_XTYPE 0x00007800 /* extended media variants */
#define IFM_ETH_XSHIFT 6 /* shift XTYPE next to TMASK */
/*
* Token ring
*/
#define IFM_TOKEN 0x00000040
#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */
#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */
#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */
#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */
#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */
#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */
#define IFM_TOK_ETR 0x00000200 /* Early token release */
#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */
#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */
#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */
#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */
#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */
/*
* FDDI
*/
#define IFM_FDDI 0x00000060
#define IFM_FDDI_SMF 3 /* Single-mode fiber */
#define IFM_FDDI_MMF 4 /* Multi-mode fiber */
#define IFM_FDDI_UTP 5 /* CDDI / UTP */
#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
/*
* IEEE 802.11 Wireless
*/
#define IFM_IEEE80211 0x00000080
/* NB: 0,1,2 are auto, manual, none defined below */
#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */
#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */
#define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */
#define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */
#define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */
#define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */
#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */
#define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */
#define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */
#define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */
#define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */
#define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */
#define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */
#define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */
#define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */
#define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */
#define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */
#define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */
#define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */
#define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */
#define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */
/* NB: not enough bits to express MCS fully */
#define IFM_IEEE80211_MCS 24 /* HT MCS rate */
#define IFM_IEEE80211_VHT 25 /* HT MCS rate */
#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
#define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */
#define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */
#define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */
#define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */
#define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */
#define IFM_IEEE80211_MBSS 0x00004000 /* Operate in MBSS mode */
/* operating mode for multi-mode devices */
#define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */
#define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */
#define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */
#define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */
#define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */
#define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */
#define IFM_IEEE80211_VHT5G 0x00070000 /* 5Ghz, VHT mode */
#define IFM_IEEE80211_VHT2G 0x00080000 /* 2Ghz, VHT mode */
/*
* ATM
*/
#define IFM_ATM 0x000000a0
#define IFM_ATM_UNKNOWN 3
#define IFM_ATM_UTP_25 4
#define IFM_ATM_TAXI_100 5
#define IFM_ATM_TAXI_140 6
#define IFM_ATM_MM_155 7
#define IFM_ATM_SM_155 8
#define IFM_ATM_UTP_155 9
#define IFM_ATM_MM_622 10
#define IFM_ATM_SM_622 11
#define IFM_ATM_VIRTUAL 12
#define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */
#define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */
#define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */
/*
* Shared media sub-types
*/
#define IFM_AUTO 0 /* Autoselect best media */
#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
#define IFM_NONE 2 /* Deselect all media */
/*
* Shared options
*/
#define IFM_FDX 0x00100000 /* Force full duplex */
#define IFM_HDX 0x00200000 /* Force half duplex */
#define IFM_FLOW 0x00400000 /* enable hardware flow control */
#define IFM_FLAG0 0x01000000 /* Driver defined flag */
#define IFM_FLAG1 0x02000000 /* Driver defined flag */
#define IFM_FLAG2 0x04000000 /* Driver defined flag */
#define IFM_LOOP 0x08000000 /* Put hardware in loopback */
/*
* Masks
*/
#define IFM_NMASK 0x000000e0 /* Network type */
#define IFM_TMASK 0x0000001f /* Media sub-type */
#define IFM_IMASK 0xf0000000 /* Instance */
#define IFM_ISHIFT 28 /* Instance shift */
#define IFM_OMASK 0x0000ff00 /* Type specific options */
#define IFM_MMASK 0x00070000 /* Mode */
#define IFM_MSHIFT 16 /* Mode shift */
#define IFM_GMASK 0x0ff00000 /* Global options */
/* Ethernet flow control mask */
#define IFM_ETH_FMASK (IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE)
/*
* Status bits
*/
#define IFM_AVALID 0x00000001 /* Active bit valid */
#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
/* Mask of "status valid" bits, for ifconfig(8). */
#define IFM_STATUS_VALID IFM_AVALID
/* List of "status valid" bits, for ifconfig(8). */
#define IFM_STATUS_VALID_LIST { \
IFM_AVALID, \
0 \
}
/*
* Macros to extract various bits of information from the media word.
*/
#define IFM_TYPE(x) ((x) & IFM_NMASK)
#define IFM_SUBTYPE(x) \
(IFM_TYPE(x) == IFM_ETHER ? IFM_ETHER_SUBTYPE_GET(x) : ((x) & IFM_TMASK))
#define IFM_TYPE_MATCH(x,y) \
(IFM_TYPE(x) == IFM_TYPE(y) && IFM_SUBTYPE(x) == IFM_SUBTYPE(y))
#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
#define IFM_OPTIONS(x) ((x) & (IFM_OMASK | IFM_GMASK))
#define IFM_MODE(x) ((x) & IFM_MMASK)
#define IFM_INST_MAX IFM_INST(IFM_IMASK)
/*
* Macro to create a media word.
*/
#define IFM_MAKEWORD(type, subtype, options, instance) \
((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
#define IFM_MAKEMODE(mode) \
(((mode) << IFM_MSHIFT) & IFM_MMASK)
/*
* NetBSD extension not defined in the BSDI API. This is used in various
* places to get the canonical description for a given type/subtype.
*
* NOTE: all but the top-level type descriptions must contain NO whitespace!
* Otherwise, parsing these in ifconfig(8) would be a nightmare.
*/
struct ifmedia_description {
int ifmt_word; /* word value; may be masked */
const char *ifmt_string; /* description */
};
#define IFM_TYPE_DESCRIPTIONS { \
{ IFM_ETHER, "Ethernet" }, \
{ IFM_TOKEN, "Token ring" }, \
{ IFM_FDDI, "FDDI" }, \
{ IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \
{ IFM_ATM, "ATM" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \
{ IFM_10_T, "10baseT/UTP" }, \
{ IFM_10_2, "10base2/BNC" }, \
{ IFM_10_5, "10base5/AUI" }, \
{ IFM_100_TX, "100baseTX" }, \
{ IFM_100_FX, "100baseFX" }, \
{ IFM_100_T4, "100baseT4" }, \
{ IFM_100_VG, "100baseVG" }, \
{ IFM_100_T2, "100baseT2" }, \
{ IFM_10_STP, "10baseSTP" }, \
{ IFM_10_FL, "10baseFL" }, \
{ IFM_1000_SX, "1000baseSX" }, \
{ IFM_1000_LX, "1000baseLX" }, \
{ IFM_1000_CX, "1000baseCX" }, \
{ IFM_1000_T, "1000baseT" }, \
{ IFM_HPNA_1, "homePNA" }, \
{ IFM_10G_LR, "10Gbase-LR" }, \
{ IFM_10G_SR, "10Gbase-SR" }, \
{ IFM_10G_CX4, "10Gbase-CX4" }, \
{ IFM_2500_SX, "2500BaseSX" }, \
{ IFM_10G_LRM, "10Gbase-LRM" }, \
{ IFM_10G_TWINAX, "10Gbase-Twinax" }, \
{ IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \
{ IFM_UNKNOWN, "Unknown" }, \
{ IFM_10G_T, "10Gbase-T" }, \
{ IFM_40G_CR4, "40Gbase-CR4" }, \
{ IFM_40G_SR4, "40Gbase-SR4" }, \
{ IFM_40G_LR4, "40Gbase-LR4" }, \
{ IFM_1000_KX, "1000Base-KX" }, \
{ IFM_OTHER, "Other" }, \
{ IFM_10G_KX4, "10GBase-KX4" }, \
{ IFM_10G_KR, "10GBase-KR" }, \
{ IFM_10G_CR1, "10GBase-CR1" }, \
{ IFM_20G_KR2, "20GBase-KR2" }, \
{ IFM_2500_KX, "2500Base-KX" }, \
{ IFM_2500_T, "2500Base-T" }, \
{ IFM_5000_T, "5000Base-T" }, \
{ IFM_50G_PCIE, "PCIExpress-50G" }, \
{ IFM_25G_PCIE, "PCIExpress-25G" }, \
{ IFM_1000_SGMII, "1000Base-SGMII" }, \
{ IFM_10G_SFI, "10GBase-SFI" }, \
{ IFM_40G_XLPPI, "40GBase-XLPPI" }, \
{ IFM_1000_CX_SGMII, "1000Base-CX-SGMII" }, \
{ IFM_40G_KR4, "40GBase-KR4" }, \
{ IFM_10G_ER, "10GBase-ER" }, \
{ IFM_100G_CR4, "100GBase-CR4" }, \
{ IFM_100G_SR4, "100GBase-SR4" }, \
{ IFM_100G_KR4, "100GBase-KR4" }, \
{ IFM_100G_LR4, "100GBase-LR4" }, \
{ IFM_56G_R4, "56GBase-R4" }, \
{ IFM_100_T, "100BaseT" }, \
{ IFM_25G_CR, "25GBase-CR" }, \
{ IFM_25G_KR, "25GBase-KR" }, \
{ IFM_25G_SR, "25GBase-SR" }, \
{ IFM_50G_CR2, "50GBase-CR2" }, \
{ IFM_50G_KR2, "50GBase-KR2" }, \
{ IFM_25G_LR, "25GBase-LR" }, \
{ IFM_10G_AOC, "10GBase-AOC" }, \
{ IFM_25G_ACC, "25GBase-ACC" }, \
{ IFM_25G_AOC, "25GBase-AOC" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ETHERNET_ALIASES { \
{ IFM_10_T, "10baseT" }, \
{ IFM_10_T, "UTP" }, \
{ IFM_10_T, "10UTP" }, \
{ IFM_10_2, "BNC" }, \
{ IFM_10_2, "10BNC" }, \
{ IFM_10_5, "AUI" }, \
{ IFM_10_5, "10AUI" }, \
{ IFM_100_TX, "100TX" }, \
{ IFM_100_T4, "100T4" }, \
{ IFM_100_VG, "100VG" }, \
{ IFM_100_T2, "100T2" }, \
{ IFM_10_STP, "10STP" }, \
{ IFM_10_FL, "10FL" }, \
{ IFM_1000_SX, "1000SX" }, \
{ IFM_1000_LX, "1000LX" }, \
{ IFM_1000_CX, "1000CX" }, \
{ IFM_1000_T, "1000baseTX" }, \
{ IFM_1000_T, "1000TX" }, \
{ IFM_1000_T, "1000T" }, \
{ IFM_2500_SX, "2500SX" }, \
\
/* \
* Shorthands for common media+option combinations as announced \
* by miibus(4) \
*/ \
{ IFM_10_T | IFM_FDX, "10baseT-FDX" }, \
{ IFM_10_T | IFM_FDX | IFM_FLOW, "10baseT-FDX-flow" }, \
{ IFM_100_TX | IFM_FDX, "100baseTX-FDX" }, \
{ IFM_100_TX | IFM_FDX | IFM_FLOW, "100baseTX-FDX-flow" }, \
{ IFM_1000_T | IFM_FDX, "1000baseT-FDX" }, \
{ IFM_1000_T | IFM_FDX | IFM_FLOW, "1000baseT-FDX-flow" }, \
{ IFM_1000_T | IFM_FDX | IFM_FLOW | IFM_ETH_MASTER, \
"1000baseT-FDX-flow-master" }, \
{ IFM_1000_T | IFM_FDX | IFM_ETH_MASTER, \
"1000baseT-FDX-master" }, \
{ IFM_1000_T | IFM_ETH_MASTER, "1000baseT-master" }, \
\
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \
{ IFM_ETH_MASTER, "master" }, \
{ IFM_ETH_RXPAUSE, "rxpause" }, \
{ IFM_ETH_TXPAUSE, "txpause" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \
{ IFM_TOK_STP4, "DB9/4Mbit" }, \
{ IFM_TOK_STP16, "DB9/16Mbit" }, \
{ IFM_TOK_UTP4, "UTP/4Mbit" }, \
{ IFM_TOK_UTP16, "UTP/16Mbit" }, \
{ IFM_TOK_STP100, "STP/100Mbit" }, \
{ IFM_TOK_UTP100, "UTP/100Mbit" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_TOKENRING_ALIASES { \
{ IFM_TOK_STP4, "4STP" }, \
{ IFM_TOK_STP16, "16STP" }, \
{ IFM_TOK_UTP4, "4UTP" }, \
{ IFM_TOK_UTP16, "16UTP" }, \
{ IFM_TOK_STP100, "100STP" }, \
{ IFM_TOK_UTP100, "100UTP" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \
{ IFM_TOK_ETR, "EarlyTokenRelease" }, \
{ IFM_TOK_SRCRT, "SourceRouting" }, \
{ IFM_TOK_ALLR, "AllRoutes" }, \
{ IFM_TOK_DTR, "Dedicated" }, \
{ IFM_TOK_CLASSIC,"Classic" }, \
{ IFM_TOK_AUTO, " " }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \
{ IFM_FDDI_SMF, "Single-mode" }, \
{ IFM_FDDI_MMF, "Multi-mode" }, \
{ IFM_FDDI_UTP, "UTP" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_FDDI_ALIASES { \
{ IFM_FDDI_SMF, "SMF" }, \
{ IFM_FDDI_MMF, "MMF" }, \
{ IFM_FDDI_UTP, "CDDI" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \
{ IFM_FDDI_DA, "Dual-attach" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \
{ IFM_IEEE80211_FH1, "FH/1Mbps" }, \
{ IFM_IEEE80211_FH2, "FH/2Mbps" }, \
{ IFM_IEEE80211_DS1, "DS/1Mbps" }, \
{ IFM_IEEE80211_DS2, "DS/2Mbps" }, \
{ IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \
{ IFM_IEEE80211_DS11, "DS/11Mbps" }, \
{ IFM_IEEE80211_DS22, "DS/22Mbps" }, \
{ IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \
{ IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \
{ IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \
{ IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \
{ IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \
{ IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \
{ IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \
{ IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \
{ IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \
{ IFM_IEEE80211_DS354k, "DS/354Kbps" }, \
{ IFM_IEEE80211_DS512k, "DS/512Kbps" }, \
{ IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \
{ IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \
{ IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \
{ IFM_IEEE80211_MCS, "MCS" }, \
{ IFM_IEEE80211_VHT, "VHT" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_ALIASES { \
{ IFM_IEEE80211_FH1, "FH1" }, \
{ IFM_IEEE80211_FH2, "FH2" }, \
{ IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \
{ IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \
{ IFM_IEEE80211_DS1, "DS1" }, \
{ IFM_IEEE80211_DS2, "DS2" }, \
{ IFM_IEEE80211_DS5, "DS5.5" }, \
{ IFM_IEEE80211_DS11, "DS11" }, \
{ IFM_IEEE80211_DS22, "DS22" }, \
{ IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \
{ IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \
{ IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \
{ IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \
{ IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \
{ IFM_IEEE80211_OFDM6, "OFDM6" }, \
{ IFM_IEEE80211_OFDM9, "OFDM9" }, \
{ IFM_IEEE80211_OFDM12, "OFDM12" }, \
{ IFM_IEEE80211_OFDM18, "OFDM18" }, \
{ IFM_IEEE80211_OFDM24, "OFDM24" }, \
{ IFM_IEEE80211_OFDM36, "OFDM36" }, \
{ IFM_IEEE80211_OFDM48, "OFDM48" }, \
{ IFM_IEEE80211_OFDM54, "OFDM54" }, \
{ IFM_IEEE80211_OFDM72, "OFDM72" }, \
{ IFM_IEEE80211_DS1, "CCK1" }, \
{ IFM_IEEE80211_DS2, "CCK2" }, \
{ IFM_IEEE80211_DS5, "CCK5.5" }, \
{ IFM_IEEE80211_DS11, "CCK11" }, \
{ IFM_IEEE80211_DS354k, "DS354K" }, \
{ IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \
{ IFM_IEEE80211_DS512k, "DS512K" }, \
{ IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \
{ IFM_IEEE80211_OFDM3, "OFDM3" }, \
{ IFM_IEEE80211_OFDM4, "OFDM4.5" }, \
{ IFM_IEEE80211_OFDM27, "OFDM27" }, \
{ IFM_IEEE80211_MCS, "MCS" }, \
{ IFM_IEEE80211_VHT, "VHT" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \
{ IFM_IEEE80211_ADHOC, "adhoc" }, \
{ IFM_IEEE80211_HOSTAP, "hostap" }, \
{ IFM_IEEE80211_IBSS, "ibss" }, \
{ IFM_IEEE80211_WDS, "wds" }, \
{ IFM_IEEE80211_TURBO, "turbo" }, \
{ IFM_IEEE80211_MONITOR, "monitor" }, \
{ IFM_IEEE80211_MBSS, "mesh" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \
{ IFM_AUTO, "autoselect" }, \
{ IFM_IEEE80211_11A, "11a" }, \
{ IFM_IEEE80211_11B, "11b" }, \
{ IFM_IEEE80211_11G, "11g" }, \
{ IFM_IEEE80211_FH, "fh" }, \
{ IFM_IEEE80211_11NA, "11na" }, \
{ IFM_IEEE80211_11NG, "11ng" }, \
{ IFM_IEEE80211_VHT5G, "11ac" }, \
{ IFM_IEEE80211_VHT2G, "11ac2" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \
{ IFM_AUTO, "auto" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ATM_DESCRIPTIONS { \
{ IFM_ATM_UNKNOWN, "Unknown" }, \
{ IFM_ATM_UTP_25, "UTP/25.6MBit" }, \
{ IFM_ATM_TAXI_100, "Taxi/100MBit" }, \
{ IFM_ATM_TAXI_140, "Taxi/140MBit" }, \
{ IFM_ATM_MM_155, "Multi-mode/155MBit" }, \
{ IFM_ATM_SM_155, "Single-mode/155MBit" }, \
{ IFM_ATM_UTP_155, "UTP/155MBit" }, \
{ IFM_ATM_MM_622, "Multi-mode/622MBit" }, \
{ IFM_ATM_SM_622, "Single-mode/622MBit" }, \
{ IFM_ATM_VIRTUAL, "Virtual" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ATM_ALIASES { \
{ IFM_ATM_UNKNOWN, "UNKNOWN" }, \
{ IFM_ATM_UTP_25, "UTP-25" }, \
{ IFM_ATM_TAXI_100, "TAXI-100" }, \
{ IFM_ATM_TAXI_140, "TAXI-140" }, \
{ IFM_ATM_MM_155, "MM-155" }, \
{ IFM_ATM_SM_155, "SM-155" }, \
{ IFM_ATM_UTP_155, "UTP-155" }, \
{ IFM_ATM_MM_622, "MM-622" }, \
{ IFM_ATM_SM_622, "SM-622" }, \
{ IFM_ATM_VIRTUAL, "VIRTUAL" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \
{ IFM_ATM_SDH, "SDH" }, \
{ IFM_ATM_NOSCRAMB, "Noscramb" }, \
{ IFM_ATM_UNASSIGNED, "Unassigned" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
{ IFM_AUTO, "autoselect" }, \
{ IFM_MANUAL, "manual" }, \
{ IFM_NONE, "none" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_SHARED_ALIASES { \
{ IFM_AUTO, "auto" }, \
\
/* \
* Shorthands for common media+option combinations as announced \
* by miibus(4) \
*/ \
{ IFM_AUTO | IFM_FLOW, "auto-flow" }, \
\
{ 0, NULL }, \
}
#define IFM_SHARED_OPTION_DESCRIPTIONS { \
{ IFM_FDX, "full-duplex" }, \
{ IFM_HDX, "half-duplex" }, \
{ IFM_FLOW, "flowcontrol" }, \
{ IFM_FLAG0, "flag0" }, \
{ IFM_FLAG1, "flag1" }, \
{ IFM_FLAG2, "flag2" }, \
{ IFM_LOOP, "hw-loopback" }, \
{ 0, NULL }, \
}
#define IFM_SHARED_OPTION_ALIASES { \
{ IFM_FDX, "fdx" }, \
{ IFM_HDX, "hdx" }, \
{ IFM_FLOW, "flow" }, \
{ IFM_LOOP, "loop" }, \
{ IFM_LOOP, "loopback" }, \
{ 0, NULL }, \
}
/*
* Baudrate descriptions for the various media types.
*/
struct ifmedia_baudrate {
int ifmb_word; /* media word */
uint64_t ifmb_baudrate; /* corresponding baudrate */
};
#define IFM_BAUDRATE_DESCRIPTIONS { \
{ IFM_ETHER | IFM_10_T, IF_Mbps(10) }, \
{ IFM_ETHER | IFM_10_2, IF_Mbps(10) }, \
{ IFM_ETHER | IFM_10_5, IF_Mbps(10) }, \
{ IFM_ETHER | IFM_100_TX, IF_Mbps(100) }, \
{ IFM_ETHER | IFM_100_FX, IF_Mbps(100) }, \
{ IFM_ETHER | IFM_100_T4, IF_Mbps(100) }, \
{ IFM_ETHER | IFM_100_VG, IF_Mbps(100) }, \
{ IFM_ETHER | IFM_100_T2, IF_Mbps(100) }, \
{ IFM_ETHER | IFM_1000_SX, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_10_STP, IF_Mbps(10) }, \
{ IFM_ETHER | IFM_10_FL, IF_Mbps(10) }, \
{ IFM_ETHER | IFM_1000_LX, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_1000_CX, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_1000_T, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_HPNA_1, IF_Mbps(1) }, \
{ IFM_ETHER | IFM_10G_LR, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_SR, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_CX4, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_2500_SX, IF_Mbps(2500ULL) }, \
{ IFM_ETHER | IFM_10G_TWINAX, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_TWINAX_LONG, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_LRM, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_T, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_40G_CR4, IF_Gbps(40ULL) }, \
{ IFM_ETHER | IFM_40G_SR4, IF_Gbps(40ULL) }, \
{ IFM_ETHER | IFM_40G_LR4, IF_Gbps(40ULL) }, \
{ IFM_ETHER | IFM_1000_KX, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_10G_KX4, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_KR, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_10G_CR1, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_20G_KR2, IF_Gbps(20ULL) }, \
{ IFM_ETHER | IFM_2500_KX, IF_Mbps(2500) }, \
{ IFM_ETHER | IFM_2500_T, IF_Mbps(2500) }, \
{ IFM_ETHER | IFM_5000_T, IF_Mbps(5000) }, \
{ IFM_ETHER | IFM_50G_PCIE, IF_Gbps(50ULL) }, \
{ IFM_ETHER | IFM_25G_PCIE, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_1000_SGMII, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_10G_SFI, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_40G_XLPPI, IF_Gbps(40ULL) }, \
{ IFM_ETHER | IFM_1000_CX_SGMII, IF_Mbps(1000) }, \
{ IFM_ETHER | IFM_40G_KR4, IF_Gbps(40ULL) }, \
{ IFM_ETHER | IFM_10G_ER, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_100G_CR4, IF_Gbps(100ULL) }, \
{ IFM_ETHER | IFM_100G_SR4, IF_Gbps(100ULL) }, \
{ IFM_ETHER | IFM_100G_KR4, IF_Gbps(100ULL) }, \
{ IFM_ETHER | IFM_100G_LR4, IF_Gbps(100ULL) }, \
{ IFM_ETHER | IFM_56G_R4, IF_Gbps(56ULL) }, \
{ IFM_ETHER | IFM_100_T, IF_Mbps(100ULL) }, \
{ IFM_ETHER | IFM_25G_CR, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_25G_KR, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_25G_SR, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_50G_CR2, IF_Gbps(50ULL) }, \
{ IFM_ETHER | IFM_50G_KR2, IF_Gbps(50ULL) }, \
{ IFM_ETHER | IFM_25G_LR, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_10G_AOC, IF_Gbps(10ULL) }, \
{ IFM_ETHER | IFM_25G_ACC, IF_Gbps(25ULL) }, \
{ IFM_ETHER | IFM_25G_AOC, IF_Gbps(25ULL) }, \
\
{ IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \
{ IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \
{ IFM_TOKEN | IFM_TOK_UTP4, IF_Mbps(4) }, \
{ IFM_TOKEN | IFM_TOK_UTP16, IF_Mbps(16) }, \
\
{ IFM_FDDI | IFM_FDDI_SMF, IF_Mbps(100) }, \
{ IFM_FDDI | IFM_FDDI_MMF, IF_Mbps(100) }, \
{ IFM_FDDI | IFM_FDDI_UTP, IF_Mbps(100) }, \
\
{ IFM_IEEE80211 | IFM_IEEE80211_FH1, IF_Mbps(1) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_FH2, IF_Mbps(2) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_DS2, IF_Mbps(2) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_DS5, IF_Kbps(5500) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_DS11, IF_Mbps(11) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_DS1, IF_Mbps(1) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_DS22, IF_Mbps(22) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \
{ IFM_IEEE80211 | IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \
\
{ 0, 0 }, \
}
/*
* Status descriptions for the various media types.
*/
struct ifmedia_status_description {
int ifms_type;
int ifms_valid;
int ifms_bit;
const char *ifms_string[2];
};
#define IFM_STATUS_DESC(ifms, bit) \
(ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
#define IFM_STATUS_DESCRIPTIONS { \
{ IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \
{ "no carrier", "active" } }, \
{ IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \
{ "no ring", "inserted" } }, \
{ IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \
{ "no ring", "inserted" } }, \
{ IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \
{ "no network", "active" } }, \
{ IFM_ATM, IFM_AVALID, IFM_ACTIVE, \
{ "no network", "active" } }, \
{ 0, 0, 0, \
{ NULL, NULL } } \
}
#endif /* _NET_IF_MEDIA_H_ */

323
nx/external/bsd/include/net/route.h vendored Normal file
View File

@ -0,0 +1,323 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)route.h 8.4 (Berkeley) 1/9/95
* $FreeBSD$
*/
#ifndef _NET_ROUTE_H_
#define _NET_ROUTE_H_
#include <sys/cdefs.h> // custom
#include <sys/types.h> // custom
/*
* Kernel resident routing tables.
*
* The routing tables are initialized when interface addresses
* are set by making entries for all directly connected interfaces.
*/
/*
* Struct route consiste of a destination address,
* a route entry pointer, link-layer prepend data pointer along
* with its length.
*/
struct route {
struct rtentry *ro_rt;
struct llentry *ro_lle;
/*
* ro_prepend and ro_plen are only used for bpf to pass in a
* preformed header. They are not cacheable.
*/
char *ro_prepend;
uint16_t ro_plen;
uint16_t ro_flags;
uint16_t ro_mtu; /* saved ro_rt mtu */
uint16_t spare;
struct sockaddr ro_dst;
};
#define RT_L2_ME_BIT 2 /* dst L2 addr is our address */
#define RT_MAY_LOOP_BIT 3 /* dst may require loop copy */
#define RT_HAS_HEADER_BIT 4 /* mbuf already have its header prepended */
#define RT_L2_ME (1 << RT_L2_ME_BIT) /* 0x0004 */
#define RT_MAY_LOOP (1 << RT_MAY_LOOP_BIT) /* 0x0008 */
#define RT_HAS_HEADER (1 << RT_HAS_HEADER_BIT) /* 0x0010 */
#define RT_REJECT 0x0020 /* Destination is reject */
#define RT_BLACKHOLE 0x0040 /* Destination is blackhole */
#define RT_HAS_GW 0x0080 /* Destination has GW */
#define RT_LLE_CACHE 0x0100 /* Cache link layer */
struct rt_metrics {
u_long rmx_locks; /* Kernel must leave these values alone */
u_long rmx_mtu; /* MTU for this path */
u_long rmx_hopcount; /* max hops expected */
u_long rmx_expire; /* lifetime for route, e.g. redirect */
u_long rmx_recvpipe; /* inbound delay-bandwidth product */
u_long rmx_sendpipe; /* outbound delay-bandwidth product */
u_long rmx_ssthresh; /* outbound gateway buffer limit */
u_long rmx_rtt; /* estimated round trip time */
u_long rmx_rttvar; /* estimated rtt variance */
u_long rmx_pksent; /* packets sent using this route */
u_long rmx_weight; /* route weight */
u_long rmx_filler[3]; /* will be used for T/TCP later */
};
/*
* rmx_rtt and rmx_rttvar are stored as microseconds;
* RTTTOPRHZ(rtt) converts to a value suitable for use
* by a protocol slowtimo counter.
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
/* lle state is exported in rmx_state rt_metrics field */
#define rmx_state rmx_weight
/*
* Keep a generation count of routing table, incremented on route addition,
* so we can invalidate caches. This is accessed without a lock, as precision
* is not required.
*/
typedef volatile u_int rt_gen_t; /* tree generation (for adds) */
#define RT_GEN(fibnum, af) rt_tables_get_gen(fibnum, af)
#define RT_DEFAULT_FIB 0 /* Explicitly mark fib=0 restricted cases */
#define RT_ALL_FIBS -1 /* Announce event for every fib */
/*
* We distinguish between routes to hosts and routes to networks,
* preferring the former if available. For each route we infer
* the interface to use from the gateway address supplied when
* the route was entered. Routes that forward packets through
* gateways are marked so that the output routines know to address the
* gateway rather than the ultimate destination.
*/
// We don't need those includes, I guess
/*#ifndef RNF_NORMAL
#include <net/radix.h>
#ifdef RADIX_MPATH
#include <net/radix_mpath.h>
#endif
#endif
*/
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
#define RTF_REJECT 0x8 /* host or net unreachable */
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
#define RTF_DONE 0x40 /* message confirmed */
/* 0x80 unused, was RTF_DELCLONE */
/* 0x100 unused, was RTF_CLONING */
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
#define RTF_LLINFO 0x400 /* DEPRECATED - exists ONLY for backward
compatibility */
#define RTF_LLDATA 0x400 /* used by apps to add/del L2 entries */
#define RTF_STATIC 0x800 /* manually added */
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
/* 0x10000 unused, was RTF_PRCLONING */
/* 0x20000 unused, was RTF_WASCLONED */
#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
#define RTF_FIXEDMTU 0x80000 /* MTU was explicitly specified */
#define RTF_PINNED 0x100000 /* route is immutable */
#define RTF_LOCAL 0x200000 /* route represents a local address */
#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
/* 0x8000000 and up unassigned */
#define RTF_STICKY 0x10000000 /* always route dst->src */
#define RTF_RNH_LOCKED 0x40000000 /* radix node head is locked */
#define RTF_GWFLAG_COMPAT 0x80000000 /* a compatibility bit for interacting
with existing routing apps */
/* Mask of RTF flags that are allowed to be modified by RTM_CHANGE. */
#define RTF_FMASK \
(RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \
RTF_REJECT | RTF_STATIC | RTF_STICKY)
/*
* fib_ nexthop API flags.
*/
/* Consumer-visible nexthop info flags */
#define NHF_REJECT 0x0010 /* RTF_REJECT */
#define NHF_BLACKHOLE 0x0020 /* RTF_BLACKHOLE */
#define NHF_REDIRECT 0x0040 /* RTF_DYNAMIC|RTF_MODIFIED */
#define NHF_DEFAULT 0x0080 /* Default route */
#define NHF_BROADCAST 0x0100 /* RTF_BROADCAST */
#define NHF_GATEWAY 0x0200 /* RTF_GATEWAY */
/* Nexthop request flags */
#define NHR_IFAIF 0x01 /* Return ifa_ifp interface */
#define NHR_REF 0x02 /* For future use */
/* Control plane route request flags */
#define NHR_COPY 0x100 /* Copy rte data */
/*
* Routing statistics.
*/
struct rtstat {
short rts_badredirect; /* bogus redirect calls */
short rts_dynamic; /* routes created by redirects */
short rts_newgateway; /* routes modified by redirects */
short rts_unreach; /* lookups which failed */
short rts_wildcard; /* lookups satisfied by a wildcard */
};
/*
* Structures for routing messages.
*/
struct rt_msghdr {
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
pid_t rtm_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
int rtm_fmask; /* bitmask used in RTM_CHANGE message */
u_long rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
#define RTM_VERSION 5 /* Up the ante and ignore older versions */
/*
* Message types.
*
* The format for each message is annotated below using the following
* identifiers:
*
* (1) struct rt_msghdr
* (2) struct ifa_msghdr
* (3) struct if_msghdr
* (4) struct ifma_msghdr
* (5) struct if_announcemsghdr
*
*/
#define RTM_ADD 0x1 /* (1) Add Route */
#define RTM_DELETE 0x2 /* (1) Delete Route */
#define RTM_CHANGE 0x3 /* (1) Change Metrics or flags */
#define RTM_GET 0x4 /* (1) Report Metrics */
#define RTM_LOSING 0x5 /* (1) Kernel Suspects Partitioning */
#define RTM_REDIRECT 0x6 /* (1) Told to use different route */
#define RTM_MISS 0x7 /* (1) Lookup failed on this address */
#define RTM_LOCK 0x8 /* (1) fix specified metrics */
/* 0x9 */
/* 0xa */
#define RTM_RESOLVE 0xb /* (1) req to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* (2) address being added to iface */
#define RTM_DELADDR 0xd /* (2) address being removed from iface */
#define RTM_IFINFO 0xe /* (3) iface going up/down etc. */
#define RTM_NEWMADDR 0xf /* (4) mcast group membership being added to if */
#define RTM_DELMADDR 0x10 /* (4) mcast group membership being deleted */
#define RTM_IFANNOUNCE 0x11 /* (5) iface arrival/departure */
#define RTM_IEEE80211 0x12 /* (5) IEEE80211 wireless event */
/*
* Bitmask values for rtm_inits and rmx_locks.
*/
#define RTV_MTU 0x1 /* init or lock _mtu */
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
#define RTV_EXPIRE 0x4 /* init or lock _expire */
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
#define RTV_RTT 0x40 /* init or lock _rtt */
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
#define RTV_WEIGHT 0x100 /* init or lock _weight */
/*
* Bitmask values for rtm_addrs.
*/
#define RTA_DST 0x1 /* destination sockaddr present */
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
#define RTA_NETMASK 0x4 /* netmask sockaddr present */
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
#define RTA_IFP 0x10 /* interface name sockaddr present */
#define RTA_IFA 0x20 /* interface addr sockaddr present */
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
/*
* Index offsets for sockaddr array for alternate internal encoding.
*/
#define RTAX_DST 0 /* destination sockaddr present */
#define RTAX_GATEWAY 1 /* gateway sockaddr present */
#define RTAX_NETMASK 2 /* netmask sockaddr present */
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
#define RTAX_IFP 4 /* interface name sockaddr present */
#define RTAX_IFA 5 /* interface addr sockaddr present */
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
#define RTAX_MAX 8 /* size of array to allocate */
typedef int rt_filter_f_t(const struct rtentry *, void *);
struct rt_addrinfo {
int rti_addrs; /* Route RTF_ flags */
int rti_flags; /* Route RTF_ flags */
struct sockaddr *rti_info[RTAX_MAX]; /* Sockaddr data */
struct ifaddr *rti_ifa; /* value of rt_ifa addr */
struct ifnet *rti_ifp; /* route interface */
rt_filter_f_t *rti_filter; /* filter function */
void *rti_filterdata; /* filter paramenters */
u_long rti_mflags; /* metrics RTV_ flags */
u_long rti_spare; /* Will be used for fib */
struct rt_metrics *rti_rmx; /* Pointer to route metrics */
};
/*
* This macro returns the size of a struct sockaddr when passed
* through a routing socket. Basically we round up sa_len to
* a multiple of sizeof(long), with a minimum of sizeof(long).
* The case sa_len == 0 should only apply to empty structures.
*/
#define SA_SIZE(sa) \
( (((struct sockaddr *)(sa))->sa_len == 0) ? \
sizeof(long) : \
1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )
#define sa_equal(a, b) ( \
(((const struct sockaddr *)(a))->sa_len == ((const struct sockaddr *)(b))->sa_len) && \
(bcmp((a), (b), ((const struct sockaddr *)(b))->sa_len) == 0))
#endif

249
nx/external/bsd/include/netdb.h vendored Normal file
View File

@ -0,0 +1,249 @@
// TuxSH: define __BSD_VISIBLE, change a lot of symbols, etc
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: (BSD-3-Clause AND ISC)
*
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
* $FreeBSD$
*/
#ifndef _NETDB_H_
#define _NETDB_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <stdint.h>
#ifndef _SOCKLEN_T_DECLARED
typedef __socklen_t socklen_t;
#define _SOCKLEN_T_DECLARED
#endif
extern __thread int h_errno;
// Removed some FreeBSD definitions
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* AF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#define IPPORT_RESERVED 1024
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
/*
* Error return codes from getaddrinfo()
*/
#if 1//0
/* obsoleted */
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#endif
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#if 1//0
/* obsoleted */
#define EAI_NODATA 7 /* no address associated with hostname */
#endif
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12 /* invalid value for hints */
#define EAI_PROTOCOL 13 /* resolved protocol is unknown */
#define EAI_OVERFLOW 14 /* argument buffer overflow */
#define EAI_MAX 15
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
/* valid flags for addrinfo (not a standard def, apps should not use it) */
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
AI_ADDRCONFIG | AI_ALL | AI_V4MAPPED)
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
/* special recommended flags for getipnodebyname */
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#define NI_NUMERICSCOPE 0x00000020
/*
* Scope delimit character
*/
#define SCOPE_DELIMITER '%'
// Modified the prototypes: added argument names, etc.
__BEGIN_DECLS
void endhostent(void);
void endnetent(void);
void endprotoent(void);
void endservent(void);
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 200112)
struct hostent* gethostbyname(const char *name);
struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type);
#endif
struct hostent *gethostent(void);
struct netent *getnetbyaddr(uint32_t, int);
struct netent *getnetbyname(const char *);
struct netent *getnetent(void);
struct protoent *getprotobyname(const char *);
struct protoent *getprotobynumber(int);
struct protoent *getprotoent(void);
struct servent *getservbyname(const char *, const char *);
struct servent *getservbyport(int, const char *);
struct servent *getservent(void);
void sethostent(int);
/* void sethostfile(const char *); */
void setnetent(int);
void setprotoent(int);
int getnameinfo(const struct sockaddr *sa, socklen_t salen,
char *host, socklen_t hostlen,
char *serv, socklen_t servlen, int flags);
int getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
void freeaddrinfo(struct addrinfo *ai);
const char *gai_strerror(int err);
void setservent(int);
#if __BSD_VISIBLE
// removed a lot of definitions here
void freehostent(struct hostent *he);
void herror(const char *s);
const char* hstrerror(int err);
#endif
// Removed private __h_errno()
__END_DECLS
#endif /* !_NETDB_H_ */

692
nx/external/bsd/include/netinet/in.h vendored Normal file
View File

@ -0,0 +1,692 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
* $FreeBSD$
*/
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <sys/types.h>
#include <machine/endian.h>
#ifndef _IN_ADDR_T_DECLARED
typedef __uint32_t in_addr_t;
#define _IN_ADDR_T_DECLARED
#endif
#ifndef _IN_PORT_T_DECLARED
typedef __uint16_t in_port_t;
#define _IN_PORT_T_DECLARED
#endif
/* Protocols common to RFC 1700, POSIX, and X/Open. */
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define INADDR_ANY ((in_addr_t)0x00000000)
#define INADDR_BROADCAST ((in_addr_t)0xffffffff) /* must be masked */
#ifndef _SA_FAMILY_T_DECLARED
typedef __sa_family_t sa_family_t;
#define _SA_FAMILY_T_DECLARED
#endif
/* Internet address (a structure for historical reasons). */
#ifndef _STRUCT_IN_ADDR_DECLARED
struct in_addr {
in_addr_t s_addr;
};
#define _STRUCT_IN_ADDR_DECLARED
#endif
#ifndef _SOCKLEN_T_DECLARED
typedef __socklen_t socklen_t;
#define _SOCKLEN_T_DECLARED
#endif
#include <sys/_sockaddr_storage.h>
/* Socket address, internet style. */
struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
// Removed redundant host<>local definition functions
#if __POSIX_VISIBLE >= 200112
#define IPPROTO_IPV6 41 /* IP6 header */
#define IPPROTO_RAW 255 /* raw IP packet */
#define INET_ADDRSTRLEN 16
#endif
#if __BSD_VISIBLE
/*
* Constants and structures defined by the internet system,
* Per RFC 790, September 1981, and numerous additions.
*/
/*
* Protocols (RFC 1700)
*/
#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_IPV4 4 /* IPv4 encapsulation */
#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */
#define IPPROTO_ST 7 /* Stream protocol II */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_PIGP 9 /* private interior gateway */
#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */
#define IPPROTO_NVPII 11 /* network voice protocol*/
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_ARGUS 13 /* Argus */
#define IPPROTO_EMCON 14 /* EMCON */
#define IPPROTO_XNET 15 /* Cross Net Debugger */
#define IPPROTO_CHAOS 16 /* Chaos*/
#define IPPROTO_MUX 18 /* Multiplexing */
#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */
#define IPPROTO_HMP 20 /* Host Monitoring */
#define IPPROTO_PRM 21 /* Packet Radio Measurement */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_TRUNK1 23 /* Trunk-1 */
#define IPPROTO_TRUNK2 24 /* Trunk-2 */
#define IPPROTO_LEAF1 25 /* Leaf-1 */
#define IPPROTO_LEAF2 26 /* Leaf-2 */
#define IPPROTO_RDP 27 /* Reliable Data */
#define IPPROTO_IRTP 28 /* Reliable Transaction */
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
#define IPPROTO_BLT 30 /* Bulk Data Transfer */
#define IPPROTO_NSP 31 /* Network Services */
#define IPPROTO_INP 32 /* Merit Internodal */
#define IPPROTO_SEP 33 /* Sequential Exchange */
#define IPPROTO_3PC 34 /* Third Party Connect */
#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */
#define IPPROTO_XTP 36 /* XTP */
#define IPPROTO_DDP 37 /* Datagram Delivery */
#define IPPROTO_CMTP 38 /* Control Message Transport */
#define IPPROTO_TPXX 39 /* TP++ Transport */
#define IPPROTO_IL 40 /* IL transport protocol */
#define IPPROTO_SDRP 42 /* Source Demand Routing */
#define IPPROTO_ROUTING 43 /* IP6 routing header */
#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
#define IPPROTO_IDRP 45 /* InterDomain Routing*/
#define IPPROTO_RSVP 46 /* resource reservation */
#define IPPROTO_GRE 47 /* General Routing Encap. */
#define IPPROTO_MHRP 48 /* Mobile Host Routing */
#define IPPROTO_BHA 49 /* BHA */
#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */
#define IPPROTO_AH 51 /* IP6 Auth Header */
#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */
#define IPPROTO_SWIPE 53 /* IP with encryption */
#define IPPROTO_NHRP 54 /* Next Hop Resolution */
#define IPPROTO_MOBILE 55 /* IP Mobility */
#define IPPROTO_TLSP 56 /* Transport Layer Security */
#define IPPROTO_SKIP 57 /* SKIP */
#define IPPROTO_ICMPV6 58 /* ICMP6 */
#define IPPROTO_NONE 59 /* IP6 no next header */
#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
#define IPPROTO_AHIP 61 /* any host internal protocol */
#define IPPROTO_CFTP 62 /* CFTP */
#define IPPROTO_HELLO 63 /* "hello" routing protocol */
#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */
#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */
#define IPPROTO_RVD 66 /* Remote Virtual Disk */
#define IPPROTO_IPPC 67 /* Pluribus Packet Core */
#define IPPROTO_ADFS 68 /* Any distributed FS */
#define IPPROTO_SATMON 69 /* Satnet Monitoring */
#define IPPROTO_VISA 70 /* VISA Protocol */
#define IPPROTO_IPCV 71 /* Packet Core Utility */
#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */
#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */
#define IPPROTO_WSN 74 /* Wang Span Network */
#define IPPROTO_PVP 75 /* Packet Video Protocol */
#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */
#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */
#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */
#define IPPROTO_EON 80 /* ISO cnlp */
#define IPPROTO_VMTP 81 /* VMTP */
#define IPPROTO_SVMTP 82 /* Secure VMTP */
#define IPPROTO_VINES 83 /* Banyon VINES */
#define IPPROTO_TTP 84 /* TTP */
#define IPPROTO_IGP 85 /* NSFNET-IGP */
#define IPPROTO_DGP 86 /* dissimilar gateway prot. */
#define IPPROTO_TCF 87 /* TCF */
#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
#define IPPROTO_OSPFIGP 89 /* OSPFIGP */
#define IPPROTO_SRPC 90 /* Strite RPC protocol */
#define IPPROTO_LARP 91 /* Locus Address Resoloution */
#define IPPROTO_MTP 92 /* Multicast Transport */
#define IPPROTO_AX25 93 /* AX.25 Frames */
#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */
#define IPPROTO_MICP 95 /* Mobile Int.ing control */
#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */
#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */
#define IPPROTO_ENCAP 98 /* encapsulation header */
#define IPPROTO_APES 99 /* any private encr. scheme */
#define IPPROTO_GMTP 100 /* GMTP*/
#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */
#define IPPROTO_SCTP 132 /* SCTP */
#define IPPROTO_MH 135 /* IPv6 Mobility Header */
#define IPPROTO_UDPLITE 136 /* UDP-Lite */
#define IPPROTO_HIP 139 /* IP6 Host Identity Protocol */
#define IPPROTO_SHIM6 140 /* IP6 Shim6 Protocol */
/* 101-254: Partly Unassigned */
#define IPPROTO_PIM 103 /* Protocol Independent Mcast */
#define IPPROTO_CARP 112 /* CARP */
#define IPPROTO_PGM 113 /* PGM */
#define IPPROTO_MPLS 137 /* MPLS-in-IP */
#define IPPROTO_PFSYNC 240 /* PFSYNC */
#define IPPROTO_RESERVED_253 253 /* Reserved */
#define IPPROTO_RESERVED_254 254 /* Reserved */
/* 255: Reserved */
/* BSD Private, local use, namespace incursion, no longer used */
#define IPPROTO_OLD_DIVERT 254 /* OLD divert pseudo-proto */
#define IPPROTO_MAX 256
/* last return value of *_input(), meaning "all job for this pkt is done". */
#define IPPROTO_DONE 257
/* Only used internally, so can be outside the range of valid IP protocols. */
#define IPPROTO_DIVERT 258 /* divert pseudo-protocol */
#define IPPROTO_SEND 259 /* SeND pseudo-protocol */
/*
* Defined to avoid confusion. The master value is defined by
* PROTO_SPACER in sys/protosw.h.
*/
#define IPPROTO_SPACER 32767 /* spacer for loadable protos */
/*
* Local port number conventions:
*
* When a user does a bind(2) or connect(2) with a port number of zero,
* a non-conflicting local port address is chosen.
* The default range is IPPORT_HIFIRSTAUTO through
* IPPORT_HILASTAUTO, although that is settable by sysctl.
*
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
* default assignment range.
*
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
*
* The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
* into the "high" range. These are reserved for client outbound connections
* which do not want to be filtered by any firewalls.
*
* The value IP_PORTRANGE_LOW changes the range to the "low" are
* that is (by convention) restricted to privileged processes. This
* convention is based on "vouchsafe" principles only. It is only secure
* if you trust the remote host to restrict these ports.
*
* The default range of ports and the high range can be changed by
* sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last})
*
* Changing those values has bad security implications if you are
* using a stateless firewall that is allowing packets outside of that
* range in order to allow transparent outgoing connections.
*
* Such a firewall configuration will generally depend on the use of these
* default values. If you change them, you may find your Security
* Administrator looking for you with a heavy object.
*
* For a slightly more orthodox text view on this:
*
* ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
*
* port numbers are divided into three ranges:
*
* 0 - 1023 Well Known Ports
* 1024 - 49151 Registered Ports
* 49152 - 65535 Dynamic and/or Private Ports
*
*/
/*
* Ports < IPPORT_RESERVED are reserved for
* privileged processes (e.g. root). (IP_PORTRANGE_LOW)
*/
#define IPPORT_RESERVED 1024
/*
* Default local port range, used by IP_PORTRANGE_DEFAULT
*/
#define IPPORT_EPHEMERALFIRST 10000
#define IPPORT_EPHEMERALLAST 65535
/*
* Dynamic port range, used by IP_PORTRANGE_HIGH.
*/
#define IPPORT_HIFIRSTAUTO 49152
#define IPPORT_HILASTAUTO 65535
/*
* Scanning for a free reserved port return a value below IPPORT_RESERVED,
* but higher than IPPORT_RESERVEDSTART. Traditionally the start value was
* 512, but that conflicts with some well-known-services that firewalls may
* have a fit if we use.
*/
#define IPPORT_RESERVEDSTART 600
#define IPPORT_MAX 65535
/*
* Definitions of bits in internet address integers.
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*/
#define IN_CLASSA(i) (((in_addr_t)(i) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
#define IN_CLASSB(i) (((in_addr_t)(i) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(i) (((in_addr_t)(i) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ff
#define IN_CLASSD(i) (((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
#define IN_MULTICAST(i) IN_CLASSD(i)
#define IN_EXPERIMENTAL(i) (((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
#define IN_BADCLASS(i) (((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
#define IN_LINKLOCAL(i) (((in_addr_t)(i) & 0xffff0000) == 0xa9fe0000)
#define IN_LOOPBACK(i) (((in_addr_t)(i) & 0xff000000) == 0x7f000000)
#define IN_ZERONET(i) (((in_addr_t)(i) & 0xff000000) == 0)
#define IN_PRIVATE(i) ((((in_addr_t)(i) & 0xff000000) == 0x0a000000) || \
(((in_addr_t)(i) & 0xfff00000) == 0xac100000) || \
(((in_addr_t)(i) & 0xffff0000) == 0xc0a80000))
#define IN_LOCAL_GROUP(i) (((in_addr_t)(i) & 0xffffff00) == 0xe0000000)
#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
#define INADDR_LOOPBACK ((in_addr_t)0x7f000001)
#define INADDR_NONE ((in_addr_t)0xffffffff) /* -1 return */
#define INADDR_UNSPEC_GROUP ((in_addr_t)0xe0000000) /* 224.0.0.0 */
#define INADDR_ALLHOSTS_GROUP ((in_addr_t)0xe0000001) /* 224.0.0.1 */
#define INADDR_ALLRTRS_GROUP ((in_addr_t)0xe0000002) /* 224.0.0.2 */
#define INADDR_ALLRPTS_GROUP ((in_addr_t)0xe0000016) /* 224.0.0.22, IGMPv3 */
#define INADDR_CARP_GROUP ((in_addr_t)0xe0000012) /* 224.0.0.18 */
#define INADDR_PFSYNC_GROUP ((in_addr_t)0xe00000f0) /* 224.0.0.240 */
#define INADDR_ALLMDNS_GROUP ((in_addr_t)0xe00000fb) /* 224.0.0.251 */
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t)0xe00000ff) /* 224.0.0.255 */
#define IN_LOOPBACKNET 127 /* official! */
#define IN_RFC3021_MASK ((in_addr_t)0xfffffffe)
/*
* Options for use with [gs]etsockopt at the IP level.
* First word of comment is data type; bool is stored in int.
*/
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL 2 /* int; header is included with data */
#define IP_TOS 3 /* int; IP type of service and preced. */
#define IP_TTL 4 /* int; IP time to live */
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
#define IP_SENDSRCADDR IP_RECVDSTADDR /* cmsg_type to set src addr */
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
#define IP_MULTICAST_IF 9 /* struct in_addr *or* struct ip_mreqn;
* set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
#define IP_RSVP_ON 15 /* enable RSVP in kernel */
#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
/* for IPSEC */
#define IP_IPSEC_POLICY 21 /* int; set/get security policy */
/* unused; was IP_FAITH */
#define IP_ONESBCAST 23 /* bool: send all-ones broadcast */
#define IP_BINDANY 24 /* bool: allow bind to any address */
#define IP_BINDMULTI 25 /* bool: allow multiple listeners on a tuple */
#define IP_RSS_LISTEN_BUCKET 26 /* int; set RSS listen bucket */
#define IP_ORIGDSTADDR 27 /* bool: receive IP dst addr/port w/dgram */
#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
/*
* Options for controlling the firewall and dummynet.
* Historical options (from 40 to 64) will eventually be
* replaced by only two options, IP_FW3 and IP_DUMMYNET3.
*/
#define IP_FW_TABLE_ADD 40 /* add entry */
#define IP_FW_TABLE_DEL 41 /* delete entry */
#define IP_FW_TABLE_FLUSH 42 /* flush table */
#define IP_FW_TABLE_GETSIZE 43 /* get table size */
#define IP_FW_TABLE_LIST 44 /* list table contents */
#define IP_FW3 48 /* generic ipfw v.3 sockopts */
#define IP_DUMMYNET3 49 /* generic dummynet v.3 sockopts */
#define IP_FW_ADD 50 /* add a firewall rule to chain */
#define IP_FW_DEL 51 /* delete a firewall rule from chain */
#define IP_FW_FLUSH 52 /* flush firewall rule chain */
#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
#define IP_FW_GET 54 /* get entire firewall rule chain */
#define IP_FW_RESETLOG 55 /* reset logging counters */
#define IP_FW_NAT_CFG 56 /* add/config a nat rule */
#define IP_FW_NAT_DEL 57 /* delete a nat rule */
#define IP_FW_NAT_GET_CONFIG 58 /* get configuration of a nat rule */
#define IP_FW_NAT_GET_LOG 59 /* get log of a nat rule */
#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */
#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */
#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */
#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */
#define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */
#define IP_MINTTL 66 /* minimum TTL for packet or drop */
#define IP_DONTFRAG 67 /* don't fragment packet */
#define IP_RECVTOS 68 /* bool; receive IP TOS w/dgram */
/* IPv4 Source Filter Multicast API [RFC3678] */
#define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
#define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */
#define IP_BLOCK_SOURCE 72 /* block a source */
#define IP_UNBLOCK_SOURCE 73 /* unblock a source */
/* The following option is private; do not use it from user applications. */
#define IP_MSFILTER 74 /* set/get filter list */
/* Protocol Independent Multicast API [RFC3678] */
#define MCAST_JOIN_GROUP 80 /* join an any-source group */
#define MCAST_LEAVE_GROUP 81 /* leave all sources for group */
#define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */
#define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */
#define MCAST_BLOCK_SOURCE 84 /* block a source */
#define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
/* Flow and RSS definitions */
#define IP_FLOWID 90 /* get flow id for the given socket/inp */
#define IP_FLOWTYPE 91 /* get flow type (M_HASHTYPE) */
#define IP_RSSBUCKETID 92 /* get RSS flowid -> bucket mapping */
#define IP_RECVFLOWID 93 /* bool; receive IP flowid/flowtype w/ datagram */
#define IP_RECVRSSBUCKETID 94 /* bool; receive IP RSS bucket id w/ datagram */
/*
* Defaults and limits for options
*/
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
/*
* The imo_membership vector for each socket is now dynamically allocated at
* run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
* according to a power-of-two increment.
*/
#define IP_MIN_MEMBERSHIPS 31
#define IP_MAX_MEMBERSHIPS 4095
#define IP_MAX_SOURCE_FILTER 1024 /* XXX to be unused */
/*
* Default resource limits for IPv4 multicast source filtering.
* These may be modified by sysctl.
*/
#define IP_MAX_GROUP_SRC_FILTER 512 /* sources per group */
#define IP_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
#define IP_MAX_SOCK_MUTE_FILTER 128 /* XXX no longer used */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
/*
* Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
* This is used to specify an interface index for multicast sends, as
* the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
*/
struct ip_mreqn {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_address; /* local IP address of interface */
int imr_ifindex; /* Interface index; cast to uint32_t */
};
/*
* Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
*/
struct ip_mreq_source {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_sourceaddr; /* IP address of source */
struct in_addr imr_interface; /* local IP address of interface */
};
/*
* Argument structures for Protocol-Independent Multicast Source
* Filter APIs. [RFC3678]
*/
struct group_req {
uint32_t gr_interface; /* interface index */
struct sockaddr_storage gr_group; /* group address */
};
struct group_source_req {
uint32_t gsr_interface; /* interface index */
struct sockaddr_storage gsr_group; /* group address */
struct sockaddr_storage gsr_source; /* source address */
};
// Removed private stuff
// Removed RFC3678 functions
/*
* Filter modes; also used to represent per-socket filter mode internally.
*/
#define MCAST_UNDEFINED 0 /* fmode: not yet defined */
#define MCAST_INCLUDE 1 /* fmode: include these source(s) */
#define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */
/*
* Argument for IP_PORTRANGE:
* - which range to search when port is unspecified at bind() or connect()
*/
#define IP_PORTRANGE_DEFAULT 0 /* default range */
#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
/*
* Identifiers for IP sysctl nodes
*/
#define IPCTL_FORWARDING 1 /* act as router */
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
#define IPCTL_DEFTTL 3 /* default TTL */
#ifdef notyet
#define IPCTL_DEFMTU 4 /* default MTU */
#endif
/* IPCTL_RTEXPIRE 5 deprecated */
/* IPCTL_RTMINEXPIRE 6 deprecated */
/* IPCTL_RTMAXCACHE 7 deprecated */
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
#define IPCTL_STATS 12 /* ipstat structure */
#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */
#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
/* 15, unused, was: IPCTL_KEEPFAITH */
#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */
#define IPCTL_INTRDQMAXLEN 17 /* max length of direct netisr queue */
#define IPCTL_INTRDQDROPS 18 /* number of direct netisr q drops */
#endif /* __BSD_VISIBLE */
/* INET6 stuff */
#if __POSIX_VISIBLE >= 200112
// TuxSH: modified
#define INET6_ADDRSTRLEN 46
// For compliance:
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
#define IPV6_JOIN_GROUP 12 /* ipv6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ipv6_mreq; leave a group membership */
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */
/*
* Unspecified
*/
#define IN6_IS_ADDR_UNSPECIFIED(a) \
((a)->__u6_addr32[0] == 0 && \
(a)->__u6_addr32[1] == 0 && \
(a)->__u6_addr32[2] == 0 && \
(a)->__u6_addr32[3] == 0)
/*
* Loopback
*/
#define IN6_IS_ADDR_LOOPBACK(a) \
((a)->__u6_addr32[0] == 0 && \
(a)->__u6_addr32[1] == 0 && \
(a)->__u6_addr32[2] == 0 && \
(a)->__u6_addr32[3] == ntohl(1))
/*
* IPv4 compatible
*/
#define IN6_IS_ADDR_V4COMPAT(a) \
((a)->__u6_addr32[0] == 0 && \
(a)->__u6_addr32[1] == 0 && \
(a)->__u6_addr32[2] == 0 && \
(a)->__u6_addr32[3] != 0 && \
(a)->__u6_addr32[3] != ntohl(1))
/*
* Mapped
*/
#define IN6_IS_ADDR_V4MAPPED(a) \
((a)->__u6_addr32[0] == 0 && \
(a)->__u6_addr32[1] == 0 && \
(a)->__u6_addr32[2] == ntohl(0x0000ffff))
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
/*
* Unicast Scope
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
*/
#define IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
/*
* Multicast
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
struct in6_addr {
union {
uint16_t __u6_addr16[8];
uint32_t __u6_addr32[4];
unsigned char s6_addr[16]; /* IPv6 address */
};
};
struct sockaddr_in6 {
sa_family_t sin6_family; /* AF_INET6 */
in_port_t sin6_port; /* port number */
uint32_t sin6_flowinfo; /* IPv6 flow information */
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* Scope ID */
};
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
#endif
#endif /* !_NETINET_IN_H_*/

268
nx/external/bsd/include/netinet/tcp.h vendored Normal file
View File

@ -0,0 +1,268 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _NETINET_TCP_H_
#define _NETINET_TCP_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#if __BSD_VISIBLE
typedef u_int32_t tcp_seq;
#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */
#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */
/*
* TCP header.
* Per RFC 793, September, 1981.
*/
struct tcphdr {
u_short th_sport; /* source port */
u_short th_dport; /* destination port */
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
#if BYTE_ORDER == LITTLE_ENDIAN
u_char th_x2:4, /* (unused) */
th_off:4; /* data offset */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_char th_off:4, /* data offset */
th_x2:4; /* (unused) */
#endif
u_char th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
#define TH_ECE 0x40
#define TH_CWR 0x80
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECE|TH_CWR)
#define PRINT_TH_FLAGS "\20\1FIN\2SYN\3RST\4PUSH\5ACK\6URG\7ECE\10CWR"
u_short th_win; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
};
#define TCPOPT_EOL 0
#define TCPOLEN_EOL 1
#define TCPOPT_PAD 0 /* padding after EOL */
#define TCPOLEN_PAD 1
#define TCPOPT_NOP 1
#define TCPOLEN_NOP 1
#define TCPOPT_MAXSEG 2
#define TCPOLEN_MAXSEG 4
#define TCPOPT_WINDOW 3
#define TCPOLEN_WINDOW 3
#define TCPOPT_SACK_PERMITTED 4
#define TCPOLEN_SACK_PERMITTED 2
#define TCPOPT_SACK 5
#define TCPOLEN_SACKHDR 2
#define TCPOLEN_SACK 8 /* 2*sizeof(tcp_seq) */
#define TCPOPT_TIMESTAMP 8
#define TCPOLEN_TIMESTAMP 10
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
#define TCPOLEN_SIGNATURE 18
#define TCPOPT_FAST_OPEN 34
#define TCPOLEN_FAST_OPEN_EMPTY 2
#define TCPOLEN_FAST_OPEN_MIN 6
#define TCPOLEN_FAST_OPEN_MAX 18
/* Miscellaneous constants */
#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */
#define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */
/*
* The default maximum segment size (MSS) to be used for new TCP connections
* when path MTU discovery is not enabled.
*
* RFC879 derives the default MSS from the largest datagram size hosts are
* minimally required to handle directly or through IP reassembly minus the
* size of the IP and TCP header. With IPv6 the minimum MTU is specified
* in RFC2460.
*
* For IPv4 the MSS is 576 - sizeof(struct tcpiphdr)
* For IPv6 the MSS is IPV6_MMTU - sizeof(struct ip6_hdr) - sizeof(struct tcphdr)
*
* We use explicit numerical definition here to avoid header pollution.
*/
#define TCP_MSS 536
#define TCP6_MSS 1220
/*
* Limit the lowest MSS we accept for path MTU discovery and the TCP SYN MSS
* option. Allowing low values of MSS can consume significant resources and
* be used to mount a resource exhaustion attack.
* Connections requesting lower MSS values will be rounded up to this value
* and the IP_DF flag will be cleared to allow fragmentation along the path.
*
* See tcp_subr.c tcp_minmss SYSCTL declaration for more comments. Setting
* it to "0" disables the minmss check.
*
* The default value is fine for TCP across the Internet's smallest official
* link MTU (256 bytes for AX.25 packet radio). However, a connection is very
* unlikely to come across such low MTU interfaces these days (anno domini 2003).
*/
#define TCP_MINMSS 216
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
#define TCP_MAXBURST 4 /* maximum segments in a burst */
#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
/* max space left for options */
#endif /* __BSD_VISIBLE */
/*
* User-settable options (used with setsockopt). These are discrete
* values and are not masked together. Some values appear to be
* bitmasks for historical reasons.
*/
#define TCP_NODELAY 1 /* don't delay send to coalesce packets */
#if __BSD_VISIBLE
#define TCP_MAXSEG 2 /* set maximum segment size */
#define TCP_NOPUSH 4 /* don't push last block of write */
#define TCP_NOOPT 8 /* don't use TCP options */
#define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */
#define TCP_INFO 32 /* retrieve tcp_info structure */
#define TCP_CONGESTION 64 /* get/set congestion control algorithm */
#define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */
#define TCP_KEEPINIT 128 /* N, time to establish connection */
#define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */
#define TCP_KEEPINTVL 512 /* L,N interval between keepalives */
#define TCP_KEEPCNT 1024 /* L,N number of keepalives before close */
#define TCP_FASTOPEN 1025 /* enable TFO / was created via TFO */
#define TCP_PCAP_OUT 2048 /* number of output packets to keep */
#define TCP_PCAP_IN 4096 /* number of input packets to keep */
#define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */
/* Start of reserved space for third-party user-settable options. */
#define TCP_VENDOR SO_VENDOR
#define TCP_CA_NAME_MAX 16 /* max congestion control name length */
#define TCPI_OPT_TIMESTAMPS 0x01
#define TCPI_OPT_SACK 0x02
#define TCPI_OPT_WSCALE 0x04
#define TCPI_OPT_ECN 0x08
#define TCPI_OPT_TOE 0x10
/*
* The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits
* the caller to query certain information about the state of a TCP
* connection. We provide an overlapping set of fields with the Linux
* implementation, but since this is a fixed size structure, room has been
* left for growth. In order to maximize potential future compatibility with
* the Linux API, the same variable names and order have been adopted, and
* padding left to make room for omitted fields in case they are added later.
*
* XXX: This is currently an unstable ABI/API, in that it is expected to
* change.
*/
struct tcp_info {
u_int8_t tcpi_state; /* TCP FSM state. */
u_int8_t __tcpi_ca_state;
u_int8_t __tcpi_retransmits;
u_int8_t __tcpi_probes;
u_int8_t __tcpi_backoff;
u_int8_t tcpi_options; /* Options enabled on conn. */
u_int8_t tcpi_snd_wscale:4, /* RFC1323 send shift value. */
tcpi_rcv_wscale:4; /* RFC1323 recv shift value. */
u_int32_t tcpi_rto; /* Retransmission timeout (usec). */
u_int32_t __tcpi_ato;
u_int32_t tcpi_snd_mss; /* Max segment size for send. */
u_int32_t tcpi_rcv_mss; /* Max segment size for receive. */
u_int32_t __tcpi_unacked;
u_int32_t __tcpi_sacked;
u_int32_t __tcpi_lost;
u_int32_t __tcpi_retrans;
u_int32_t __tcpi_fackets;
/* Times; measurements in usecs. */
u_int32_t __tcpi_last_data_sent;
u_int32_t __tcpi_last_ack_sent; /* Also unimpl. on Linux? */
u_int32_t tcpi_last_data_recv; /* Time since last recv data. */
u_int32_t __tcpi_last_ack_recv;
/* Metrics; variable units. */
u_int32_t __tcpi_pmtu;
u_int32_t __tcpi_rcv_ssthresh;
u_int32_t tcpi_rtt; /* Smoothed RTT in usecs. */
u_int32_t tcpi_rttvar; /* RTT variance in usecs. */
u_int32_t tcpi_snd_ssthresh; /* Slow start threshold. */
u_int32_t tcpi_snd_cwnd; /* Send congestion window. */
u_int32_t __tcpi_advmss;
u_int32_t __tcpi_reordering;
u_int32_t __tcpi_rcv_rtt;
u_int32_t tcpi_rcv_space; /* Advertised recv window. */
/* FreeBSD extensions to tcp_info. */
u_int32_t tcpi_snd_wnd; /* Advertised send window. */
u_int32_t tcpi_snd_bwnd; /* No longer used. */
u_int32_t tcpi_snd_nxt; /* Next egress seqno */
u_int32_t tcpi_rcv_nxt; /* Next ingress seqno */
u_int32_t tcpi_toe_tid; /* HWTID for TOE endpoints */
u_int32_t tcpi_snd_rexmitpack; /* Retransmitted packets */
u_int32_t tcpi_rcv_ooopack; /* Out-of-order packets */
u_int32_t tcpi_snd_zerowin; /* Zero-sized windows sent */
/* Padding to grow without breaking ABI. */
u_int32_t __tcpi_pad[26]; /* Padding. */
};
#endif
#define TCP_FUNCTION_NAME_LEN_MAX 32
struct tcp_function_set {
char function_set_name[TCP_FUNCTION_NAME_LEN_MAX];
uint32_t pcbcnt;
};
#endif /* !_NETINET_TCP_H_ */

81
nx/external/bsd/include/netinet/udp.h vendored Normal file
View File

@ -0,0 +1,81 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)udp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _NETINET_UDP_H_
#define _NETINET_UDP_H_
// Added:
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/socket.h>
/*
* UDP protocol header.
* Per RFC 768, September, 1981.
*/
struct udphdr {
u_short uh_sport; /* source port */
u_short uh_dport; /* destination port */
u_short uh_ulen; /* udp length */
u_short uh_sum; /* udp checksum */
};
/*
* User-settable options (used with setsockopt).
*/
#define UDP_ENCAP 1
/* Start of reserved space for third-party user-settable options. */
#define UDP_VENDOR SO_VENDOR
/*
* UDP Encapsulation of IPsec Packets options.
*/
/* Encapsulation types. */
#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
#define UDP_ENCAP_ESPINUDP 2 /* RFC3948 */
/* Default ESP in UDP encapsulation port. */
#define UDP_ENCAP_ESPINUDP_PORT 500
/* Maximum UDP fragment size for ESP over UDP. */
#define UDP_ENCAP_ESPINUDP_MAXFRAGLEN 552
#endif

122
nx/external/bsd/include/poll.h vendored Normal file
View File

@ -0,0 +1,122 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1997 Peter Wemm <peter@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD$
*/
#ifndef _SYS_POLL_H_
#define _SYS_POLL_H_
#include <sys/cdefs.h>
/*
* This file is intended to be compatible with the traditional poll.h.
*/
typedef unsigned int nfds_t;
/*
* This structure is passed as an array to poll(2).
*/
struct pollfd {
int fd; /* which file descriptor to poll */
short events; /* events we are interested in */
short revents; /* events found on return */
};
/*
* Requestable events. If poll(2) finds any of these set, they are
* copied to revents on return.
* XXX Note that FreeBSD doesn't make much distinction between POLLPRI
* and POLLRDBAND since none of the file types have distinct priority
* bands - and only some have an urgent "mode".
* XXX Note POLLIN isn't really supported in true SVSV terms. Under SYSV
* POLLIN includes all of normal, band and urgent data. Most poll handlers
* on FreeBSD only treat it as "normal" data.
*/
#define POLLIN 0x0001 /* any readable data available */
#define POLLPRI 0x0002 /* OOB/Urgent readable data */
#define POLLOUT 0x0004 /* file descriptor is writeable */
#define POLLRDNORM 0x0040 /* non-OOB/URG data available */
#define POLLWRNORM POLLOUT /* no write type differentiation */
#define POLLRDBAND 0x0080 /* OOB/Urgent readable data */
#define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */
#if __BSD_VISIBLE
/* General FreeBSD extension (currently only supported for sockets): */
#define POLLINIGNEOF 0x2000 /* like POLLIN, except ignore EOF */
#endif
/*
* These events are set if they occur regardless of whether they were
* requested.
*/
#define POLLERR 0x0008 /* some poll error occurred */
#define POLLHUP 0x0010 /* file descriptor was "hung up" */
#define POLLNVAL 0x0020 /* requested events "invalid" */
#if __BSD_VISIBLE
#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\
POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
/*
* Request that poll() wait forever.
* XXX in SYSV, this is defined in stropts.h, which is not included
* by poll.h.
*/
#define INFTIM (-1)
#endif
#if __BSD_VISIBLE
#include <sys/_types.h>
#include <sys/_sigset.h>
#include <sys/timespec.h>
#ifndef _SIGSET_T_DECLARED
#define _SIGSET_T_DECLARED
typedef __sigset_t sigset_t;
#endif
#endif
__BEGIN_DECLS
int poll(struct pollfd *pfd, nfds_t nfds, int timeout);
// changed poll argument names ; removed ppoll because it is not exposed
__END_DECLS
#endif /* !_SYS_POLL_H_ */

48
nx/external/bsd/include/sys/_iovec.h vendored Normal file
View File

@ -0,0 +1,48 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)uio.h 8.5 (Berkeley) 2/22/94
* $FreeBSD$
*/
#ifndef _SYS__IOVEC_H_
#define _SYS__IOVEC_H_
#include <stddef.h> // changed
#include <stdint.h>
struct iovec {
void *iov_base; /* Base address. */
size_t iov_len; /* Length. */
};
#endif /* !_SYS__IOVEC_H_ */

View File

@ -0,0 +1,59 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
* $FreeBSD$
*/
#ifndef _SYS__SOCKADDR_STORAGE_H_
#define _SYS__SOCKADDR_STORAGE_H_
#include <stddef.h> // changed
#include <stdint.h>
/*
* RFC 2553: protocol-independent placeholder for socket addresses
*/
#define _SS_MAXSIZE 128U
#define _SS_ALIGNSIZE (sizeof(__int64_t))
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \
sizeof(sa_family_t))
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \
sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE)
struct sockaddr_storage {
unsigned char ss_len; /* address length */
sa_family_t ss_family; /* address family */
char __ss_pad1[_SS_PAD1SIZE];
int64_t __ss_align; /* force desired struct alignment */ // changed
char __ss_pad2[_SS_PAD2SIZE];
};
#endif /* !_SYS__SOCKADDR_STORAGE_H_ */

66
nx/external/bsd/include/sys/filio.h vendored Normal file
View File

@ -0,0 +1,66 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)filio.h 8.1 (Berkeley) 3/28/94
* $FreeBSD$
*/
#ifndef _SYS_FILIO_H_
#define _SYS_FILIO_H_
#include <sys/ioccom.h>
/* Generic file-descriptor ioctl's. */
#define FIOCLEX _IO('f', 1) /* set close on exec on fd */
#define FIONCLEX _IO('f', 2) /* remove close on exec */
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN _IOW('f', 124, int) /* set owner */
#define FIOGETOWN _IOR('f', 123, int) /* get owner */
#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */
#define FIOGETLBA _IOR('f', 121, int) /* get start blk # */
struct fiodgname_arg {
int len;
void *buf;
};
#define FIODGNAME _IOW('f', 120, struct fiodgname_arg) /* get dev. name */
#define FIONWRITE _IOR('f', 119, int) /* get # bytes (yet) to write */
#define FIONSPACE _IOR('f', 118, int) /* get space in send queue */
/* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
#define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */
#define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */
#endif /* !_SYS_FILIO_H_ */

74
nx/external/bsd/include/sys/ioccom.h vendored Normal file
View File

@ -0,0 +1,74 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)ioccom.h 8.2 (Berkeley) 3/28/94
* $FreeBSD$
*/
#ifndef _SYS_IOCCOM_H_
#define _SYS_IOCCOM_H_
/*
* Ioctl's have the command encoded in the lower word, and the size of
* any in or out parameters in the upper word. The high 3 bits of the
* upper word are used to encode the in/out status of the parameter.
*/
#define IOCPARM_SHIFT 13 /* number of bits for ioctl size */
#define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
#define IOCGROUP(x) (((x) >> 8) & 0xff)
#define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */
#define IOC_VOID 0x20000000 /* no parameters */
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define IOC_INOUT (IOC_IN|IOC_OUT)
#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN)
#define _IOC(inout,group,num,len) ((int) \
((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
#define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int))
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
#include <sys/cdefs.h>
__BEGIN_DECLS
// Modified declaration
int ioctl(int fd, int request, ...);
__END_DECLS
#endif /* !_SYS_IOCCOM_H_ */

52
nx/external/bsd/include/sys/ioctl.h vendored Normal file
View File

@ -0,0 +1,52 @@
// TuxSH: removed definitions under _KERNEL ifdef block, modify the prototype of some functions,
// some other changes
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)ioctl.h 8.6 (Berkeley) 3/28/94
* $FreeBSD$
*/
#ifndef _SYS_IOCTL_H_
#define _SYS_IOCTL_H_
#include <sys/ioccom.h>
#include <sys/filio.h>
#include <sys/sockio.h>
//#include <sys/ttycom.h>
#endif /* !_SYS_IOCTL_H_ */

2
nx/external/bsd/include/sys/poll.h vendored Normal file
View File

@ -0,0 +1,2 @@
#include <poll.h>

597
nx/external/bsd/include/sys/socket.h vendored Normal file
View File

@ -0,0 +1,597 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
* $FreeBSD$
*/
#ifndef _SYS_SOCKET_H_
#define _SYS_SOCKET_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <sys/_iovec.h>
/*
* Definitions related to sockets: types, address families, options.
*/
/*
* Data types.
*/
// Stripped some of them
#include <sys/types.h> // for ssize_t, etc.
#include <stdint.h>
#ifndef _SA_FAMILY_T_DECLARED
typedef __sa_family_t sa_family_t;
#define _SA_FAMILY_T_DECLARED
#endif
#ifndef _SOCKLEN_T_DECLARED
typedef __socklen_t socklen_t;
#define _SOCKLEN_T_DECLARED
#endif
/*
* Types
*/
#define SOCK_STREAM 1 /* stream socket */
#define SOCK_DGRAM 2 /* datagram socket */
#define SOCK_RAW 3 /* raw-protocol interface */
#if __BSD_VISIBLE
#define SOCK_RDM 4 /* reliably-delivered message */
#endif
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
#if __BSD_VISIBLE
/*
* Creation flags, OR'ed into socket() and socketpair() type argument.
*/
#define SOCK_CLOEXEC 0x10000000
#define SOCK_NONBLOCK 0x20000000
#endif /* __BSD_VISIBLE */
/*
* Option flags per-socket.
*/
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define SO_REUSEADDR 0x0004 /* allow local address reuse */
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
#define SO_DONTROUTE 0x0010 /* just use interface addresses */
#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
#if __BSD_VISIBLE
#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#endif
#define SO_LINGER 0x0080 /* linger on close if data present */
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
#if __BSD_VISIBLE
#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */
#define SO_NOSIGPIPE 0x0800 /* no SIGPIPE from EPIPE */
#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */
#define SO_BINTIME 0x2000 /* timestamp received dgram traffic */
#endif
#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */
#define SO_NO_DDP 0x8000 /* disable direct data placement */
/*
* Additional options, not kept in so_options.
*/
#define SO_SNDBUF 0x1001 /* send buffer size */
#define SO_RCVBUF 0x1002 /* receive buffer size */
#define SO_SNDLOWAT 0x1003 /* send low-water mark */
#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define SO_SNDTIMEO 0x1005 /* send timeout */
#define SO_RCVTIMEO 0x1006 /* receive timeout */
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
#if __BSD_VISIBLE
#define SO_LABEL 0x1009 /* socket's MAC label */
#define SO_PEERLABEL 0x1010 /* socket's peer's MAC label */
#define SO_LISTENQLIMIT 0x1011 /* socket's backlog limit */
#define SO_LISTENQLEN 0x1012 /* socket's complete queue length */
#define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */
#define SO_SETFIB 0x1014 /* use this FIB to route */
#define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */
#define SO_PROTOCOL 0x1016 /* get socket protocol (Linux name) */
#define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */
#define SO_TS_CLOCK 0x1017 /* clock type used for SO_TIMESTAMP */
#define SO_MAX_PACING_RATE 0x1018 /* socket's max TX pacing rate (Linux name) */
#endif
#if __BSD_VISIBLE
#define SO_TS_REALTIME_MICRO 0 /* microsecond resolution, realtime */
#define SO_TS_BINTIME 1 /* sub-nanosecond resolution, realtime */
#define SO_TS_REALTIME 2 /* nanosecond resolution, realtime */
#define SO_TS_MONOTONIC 3 /* nanosecond resolution, monotonic */
#define SO_TS_DEFAULT SO_TS_REALTIME_MICRO
#define SO_TS_CLOCK_MAX SO_TS_MONOTONIC
#endif
/*
* Space reserved for new socket options added by third-party vendors.
* This range applies to all socket option levels. New socket options
* in FreeBSD should always use an option value less than SO_VENDOR.
*/
#if __BSD_VISIBLE
#define SO_VENDOR 0x80000000
#endif
/*
* Structure used for manipulating linger option.
*/
struct linger {
int l_onoff; /* option on/off */
int l_linger; /* linger time */
};
#if __BSD_VISIBLE
struct accept_filter_arg {
char af_name[16];
char af_arg[256-16];
};
#endif
/*
* Level number for (get/set)sockopt() to apply to socket itself.
*/
#define SOL_SOCKET 0xffff /* options for socket level */
/*
* Address families.
*/
#define AF_UNSPEC 0 /* unspecified */
#if __BSD_VISIBLE
#define AF_LOCAL AF_UNIX /* local to host (pipes, portals) */
#endif
#define AF_UNIX 1 /* standardized name for AF_LOCAL */
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
#if __BSD_VISIBLE
#define AF_IMPLINK 3 /* arpanet imp addresses */
#define AF_PUP 4 /* pup protocols: e.g. BSP */
#define AF_CHAOS 5 /* mit CHAOS protocols */
#define AF_NETBIOS 6 /* SMB protocols */
#define AF_ISO 7 /* ISO protocols */
#define AF_OSI AF_ISO
#define AF_ECMA 8 /* European computer manufacturers */
#define AF_DATAKIT 9 /* datakit protocols */
#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
#define AF_SNA 11 /* IBM SNA */
#define AF_DECnet 12 /* DECnet */
#define AF_DLI 13 /* DEC Direct data link interface */
#define AF_LAT 14 /* LAT */
#define AF_HYLINK 15 /* NSC Hyperchannel */
#define AF_APPLETALK 16 /* Apple Talk */
#define AF_ROUTE 17 /* Internal Routing Protocol */
#define AF_LINK 18 /* Link layer interface */
#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
#define AF_COIP 20 /* connection-oriented IP, aka ST II */
#define AF_CNT 21 /* Computer Network Technology */
#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
#define AF_IPX 23 /* Novell Internet Protocol */
#define AF_SIP 24 /* Simple Internet Protocol */
#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
#define AF_ISDN 26 /* Integrated Services Digital Network*/
#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
#define pseudo_AF_KEY 27 /* Internal key-management function */
#endif
#define AF_INET6 28 /* IPv6 */
#if __BSD_VISIBLE
#define AF_NATM 29 /* native ATM access */
#define AF_ATM 30 /* ATM */
#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers
* in interface output routine
*/
#define AF_NETGRAPH 32 /* Netgraph sockets */
#define AF_SLOW 33 /* 802.3ad slow protocol */
#define AF_SCLUSTER 34 /* Sitara cluster protocol */
#define AF_ARP 35
#define AF_BLUETOOTH 36 /* Bluetooth sockets */
#define AF_IEEE80211 37 /* IEEE 802.11 protocol */
#define AF_INET_SDP 40 /* OFED Socket Direct Protocol ipv4 */
#define AF_INET6_SDP 42 /* OFED Socket Direct Protocol ipv6 */
#define AF_MAX 42
/*
* When allocating a new AF_ constant, please only allocate
* even numbered constants for FreeBSD until 134 as odd numbered AF_
* constants 39-133 are now reserved for vendors.
*/
#define AF_VENDOR00 39
#define AF_VENDOR01 41
#define AF_VENDOR02 43
#define AF_VENDOR03 45
#define AF_VENDOR04 47
#define AF_VENDOR05 49
#define AF_VENDOR06 51
#define AF_VENDOR07 53
#define AF_VENDOR08 55
#define AF_VENDOR09 57
#define AF_VENDOR10 59
#define AF_VENDOR11 61
#define AF_VENDOR12 63
#define AF_VENDOR13 65
#define AF_VENDOR14 67
#define AF_VENDOR15 69
#define AF_VENDOR16 71
#define AF_VENDOR17 73
#define AF_VENDOR18 75
#define AF_VENDOR19 77
#define AF_VENDOR20 79
#define AF_VENDOR21 81
#define AF_VENDOR22 83
#define AF_VENDOR23 85
#define AF_VENDOR24 87
#define AF_VENDOR25 89
#define AF_VENDOR26 91
#define AF_VENDOR27 93
#define AF_VENDOR28 95
#define AF_VENDOR29 97
#define AF_VENDOR30 99
#define AF_VENDOR31 101
#define AF_VENDOR32 103
#define AF_VENDOR33 105
#define AF_VENDOR34 107
#define AF_VENDOR35 109
#define AF_VENDOR36 111
#define AF_VENDOR37 113
#define AF_VENDOR38 115
#define AF_VENDOR39 117
#define AF_VENDOR40 119
#define AF_VENDOR41 121
#define AF_VENDOR42 123
#define AF_VENDOR43 125
#define AF_VENDOR44 127
#define AF_VENDOR45 129
#define AF_VENDOR46 131
#define AF_VENDOR47 133
#endif
/*
* Structure used by kernel to store most
* addresses.
*/
struct sockaddr {
unsigned char sa_len; /* total length */
sa_family_t sa_family; /* address family */
char sa_data[14]; /* actually longer; address value */
};
#if __BSD_VISIBLE
#define SOCK_MAXADDRLEN 255 /* longest possible addresses */
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
*/
struct sockproto {
unsigned short sp_family; /* address family */
unsigned short sp_protocol; /* protocol */
};
#endif
#include <sys/_sockaddr_storage.h>
#if __BSD_VISIBLE
/*
* Protocol families, same as address families for now.
*/
#define PF_UNSPEC AF_UNSPEC
#define PF_LOCAL AF_LOCAL
#define PF_UNIX PF_LOCAL /* backward compatibility */
#define PF_INET AF_INET
#define PF_IMPLINK AF_IMPLINK
#define PF_PUP AF_PUP
#define PF_CHAOS AF_CHAOS
#define PF_NETBIOS AF_NETBIOS
#define PF_ISO AF_ISO
#define PF_OSI AF_ISO
#define PF_ECMA AF_ECMA
#define PF_DATAKIT AF_DATAKIT
#define PF_CCITT AF_CCITT
#define PF_SNA AF_SNA
#define PF_DECnet AF_DECnet
#define PF_DLI AF_DLI
#define PF_LAT AF_LAT
#define PF_HYLINK AF_HYLINK
#define PF_APPLETALK AF_APPLETALK
#define PF_ROUTE AF_ROUTE
#define PF_LINK AF_LINK
#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
#define PF_COIP AF_COIP
#define PF_CNT AF_CNT
#define PF_SIP AF_SIP
#define PF_IPX AF_IPX
#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */
#define PF_PIP pseudo_AF_PIP
#define PF_ISDN AF_ISDN
#define PF_KEY pseudo_AF_KEY
#define PF_INET6 AF_INET6
#define PF_NATM AF_NATM
#define PF_ATM AF_ATM
#define PF_NETGRAPH AF_NETGRAPH
#define PF_SLOW AF_SLOW
#define PF_SCLUSTER AF_SCLUSTER
#define PF_ARP AF_ARP
#define PF_BLUETOOTH AF_BLUETOOTH
#define PF_IEEE80211 AF_IEEE80211
#define PF_INET_SDP AF_INET_SDP
#define PF_INET6_SDP AF_INET6_SDP
#define PF_MAX AF_MAX
/*
* Definitions for network related sysctl, CTL_NET.
*
* Second level is protocol family.
* Third level is protocol number.
*
* Further levels are defined by the individual families.
*/
/*
* PF_ROUTE - Routing table
*
* Three additional levels are defined:
* Fourth: address family, 0 is wildcard
* Fifth: type of info, defined below
* Sixth: flag(s) to mask with for NET_RT_FLAGS
*/
#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
#define NET_RT_IFLIST 3 /* survey interface list */
#define NET_RT_IFMALIST 4 /* return multicast address list */
#define NET_RT_IFLISTL 5 /* Survey interface list, using 'l'en
* versions of msghdr structs. */
#endif /* __BSD_VISIBLE */
/*
* Maximum queue length specifiable by listen.
*/
#define SOMAXCONN 128
/*
* Message header for recvmsg and sendmsg calls.
* Used value-result for recvmsg, value only for sendmsg.
*/
struct msghdr {
void *msg_name; /* optional address */
socklen_t msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter/gather array */
int msg_iovlen; /* # elements in msg_iov */
void *msg_control; /* ancillary data, see below */
socklen_t msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
};
#define MSG_OOB 0x00000001 /* process out-of-band data */
#define MSG_PEEK 0x00000002 /* peek at incoming message */
#define MSG_DONTROUTE 0x00000004 /* send without using routing tables */
#define MSG_EOR 0x00000008 /* data completes record */
#define MSG_TRUNC 0x00000010 /* data discarded before delivery */
#define MSG_CTRUNC 0x00000020 /* control data lost before delivery */
#define MSG_WAITALL 0x00000040 /* wait for full request or error */
#if __BSD_VISIBLE
#define MSG_DONTWAIT 0x00000080 /* this message should be nonblocking */
#define MSG_EOF 0x00000100 /* data completes connection */
/* 0x00000200 unused */
/* 0x00000400 unused */
/* 0x00000800 unused */
/* 0x00001000 unused */
#define MSG_NOTIFICATION 0x00002000 /* SCTP notification */
#define MSG_NBIO 0x00004000 /* FIONBIO mode, used by fifofs */
#define MSG_COMPAT 0x00008000 /* used in sendit() */
#endif
#if __POSIX_VISIBLE >= 200809
#define MSG_NOSIGNAL 0x00020000 /* do not generate SIGPIPE on EOF */
#endif
#if __BSD_VISIBLE
#define MSG_CMSG_CLOEXEC 0x00040000 /* make received fds close-on-exec */
#define MSG_WAITFORONE 0x00080000 /* for recvmmsg() */
#endif
/*
* Header for ancillary data objects in msg_control buffer.
* Used for additional information with/about a datagram
* not expressible by flags. The format is a sequence
* of message elements headed by cmsghdr structures.
*/
struct cmsghdr {
socklen_t cmsg_len; /* data byte count, including hdr */
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
/* followed by u_char cmsg_data[]; */
};
#define _ALIGNBYTES (sizeof(long) - 1)
#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
/* given pointer to struct cmsghdr, return pointer to data */
#define CMSG_DATA(cmsg) \
((unsigned char *)(cmsg) + _ALIGN(sizeof(struct cmsghdr)))
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
#define CMSG_NXTHDR(mhdr, cmsg) \
(((char *)(cmsg) + _ALIGN((cmsg)->cmsg_len) + \
_ALIGN(sizeof(struct cmsghdr)) > \
((char *)(mhdr)->msg_control) + (mhdr)->msg_controllen) ? \
(struct cmsghdr *)NULL : \
(struct cmsghdr *)((char *)(cmsg) + _ALIGN((cmsg)->cmsg_len)))
/*
* RFC 2292 requires to check msg_controllen, in case that the kernel returns
* an empty list for some reasons.
*/
#define CMSG_FIRSTHDR(mhdr) \
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
(struct cmsghdr *)(mhdr)->msg_control : \
(struct cmsghdr *)NULL)
/* Length of the contents of a control message of length len */
#define CMSG_LEN(len) (_ALIGN(sizeof(struct cmsghdr)) + (len))
/* Length of the space taken up by a padded control message of length len */
#define CMSG_SPACE(len) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(len))
/* "Socket"-level control message types: */
#define SCM_RIGHTS 0x01 /* access rights (array of int) */
#if __BSD_VISIBLE
#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
#define SCM_BINTIME 0x04 /* timestamp (struct bintime) */
#define SCM_REALTIME 0x05 /* timestamp (struct timespec) */
#define SCM_MONOTONIC 0x06 /* timestamp (struct timespec) */
#define SCM_TIME_INFO 0x07 /* timestamp info */
struct sock_timestamp_info {
uint32_t st_info_flags;
uint32_t st_info_pad0;
uint64_t st_info_rsv[7];
};
#define ST_INFO_HW 0x0001 /* SCM_TIMESTAMP was hw */
#define ST_INFO_HW_HPREC 0x0002 /* SCM_TIMESTAMP was hw-assisted
on entrance */
#endif
#if __BSD_VISIBLE
/*
* 4.3 compat sockaddr, move to compat file later
*/
struct osockaddr {
unsigned short sa_family; /* address family */
char sa_data[14]; /* up to 14 bytes of direct address */
};
/*
* 4.3-compat message header (move to compat file later).
*/
struct omsghdr {
char *msg_name; /* optional address */
int msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter/gather array */
int msg_iovlen; /* # elements in msg_iov */
char *msg_accrights; /* access rights sent/received */
int msg_accrightslen;
};
#endif
/*
* howto arguments for shutdown(2), specified by Posix.1g.
*/
#define SHUT_RD 0 /* shut down the reading side */
#define SHUT_WR 1 /* shut down the writing side */
#define SHUT_RDWR 2 /* shut down both sides */
#if __BSD_VISIBLE
/* for SCTP */
/* we cheat and use the SHUT_XX defines for these */
#define PRU_FLUSH_RD SHUT_RD
#define PRU_FLUSH_WR SHUT_WR
#define PRU_FLUSH_RDWR SHUT_RDWR
#endif
#if __BSD_VISIBLE
/*
* sendfile(2) header/trailer struct
*/
struct sf_hdtr {
struct iovec *headers; /* pointer to an array of header struct iovec's */
int hdr_cnt; /* number of header iovec's */
struct iovec *trailers; /* pointer to an array of trailer struct iovec's */
int trl_cnt; /* number of trailer iovec's */
};
/*
* Sendfile-specific flag(s)
*/
#define SF_NODISKIO 0x00000001
#define SF_MNOWAIT 0x00000002 /* obsolete */
#define SF_SYNC 0x00000004
#define SF_USER_READAHEAD 0x00000008
#define SF_NOCACHE 0x00000010
#define SF_FLAGS(rh, flags) (((rh) << 16) | (flags))
/*
* Sendmmsg/recvmmsg specific structure(s)
*/
struct mmsghdr {
struct msghdr msg_hdr; /* message header */
ssize_t msg_len; /* message length */
};
#endif /* __BSD_VISIBLE */
#include <sys/cdefs.h>
// Note: rewrote the definitions to make them more POSIX-compliant and such, adding back arg names
// Remove some function declarations
__BEGIN_DECLS
// Note: POSIX claims that some prototypes should take restrict ptrs
// But this causes more problem that it solves, so much like linux
// We won't declare those args restrict.
int socket(int domain, int type, int protocol);
ssize_t recv(int sockfd, void *buf, size_t len, int flags);
ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
ssize_t send(int sockfd, const void* buf, size_t len, int flags);
ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
int listen(int sockfd, int backlog);
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
int shutdown(int sockfd, int how);
int sockatmark(int sockfd);
int socketpair(int domain, int type, int protocol, int sv[2]);
ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
#if __BSD_VISIBLE
struct timespec;
int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags);
int recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, struct timespec *timeout);
#endif
__END_DECLS
#endif /* !_SYS_SOCKET_H_ */

143
nx/external/bsd/include/sys/sockio.h vendored Normal file
View File

@ -0,0 +1,143 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)sockio.h 8.1 (Berkeley) 3/28/94
* $FreeBSD$
*/
#ifndef _SYS_SOCKIO_H_
#define _SYS_SOCKIO_H_
#include <sys/ioccom.h>
/* Socket ioctl's. */
#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
/* SIOCADDRT _IOW('r', 10, struct ortentry) 4.3BSD */
/* SIOCDELRT _IOW('r', 11, struct ortentry) 4.3BSD */
#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
/* OSIOCGIFADDR _IOWR('i', 13, struct ifreq) 4.3BSD */
#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */
#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
/* OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) 4.3BSD */
#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */
#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */
/* OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) 4.3BSD */
#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */
#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
/* OSIOCGIFCONF _IOWR('i', 20, struct ifconf) 4.3BSD */
#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */
/* OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) 4.3BSD */
#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */
#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
#define OSIOCAIFADDR _IOW('i', 26, struct oifaliasreq) /* FreeBSD 9.x */
/* SIOCALIFADDR _IOW('i', 27, struct if_laddrreq) KAME */
/* SIOCGLIFADDR _IOWR('i', 28, struct if_laddrreq) KAME */
/* SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) KAME */
#define SIOCSIFCAP _IOW('i', 30, struct ifreq) /* set IF features */
#define SIOCGIFCAP _IOWR('i', 31, struct ifreq) /* get IF features */
#define SIOCGIFINDEX _IOWR('i', 32, struct ifreq) /* get IF index */
#define SIOCGIFMAC _IOWR('i', 38, struct ifreq) /* get IF MAC label */
#define SIOCSIFMAC _IOW('i', 39, struct ifreq) /* set IF MAC label */
#define SIOCSIFNAME _IOW('i', 40, struct ifreq) /* set IF name */
#define SIOCSIFDESCR _IOW('i', 41, struct ifreq) /* set ifnet descr */
#define SIOCGIFDESCR _IOWR('i', 42, struct ifreq) /* get ifnet descr */
#define SIOCAIFADDR _IOW('i', 43, struct ifaliasreq)/* add/chg IF alias */
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */
#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */
#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */
#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */
#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */
#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */
#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */
#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */
#define SIOCGIFSTATUS _IOWR('i', 59, struct ifstat) /* get IF status */
#define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set linklevel addr */
#define SIOCGI2C _IOWR('i', 61, struct ifreq) /* get I2C data */
#define SIOCGHWADDR _IOWR('i', 62, struct ifreq) /* get hardware lladdr */
#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif address */
#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */
#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */
#define SIOCDIFPHYADDR _IOW('i', 73, struct ifreq) /* delete gif addrs */
/* SIOCSLIFPHYADDR _IOW('i', 74, struct if_laddrreq) KAME */
/* SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) KAME */
#define SIOCGPRIVATE_0 _IOWR('i', 80, struct ifreq) /* device private 0 */
#define SIOCGPRIVATE_1 _IOWR('i', 81, struct ifreq) /* device private 1 */
#define SIOCSIFVNET _IOWR('i', 90, struct ifreq) /* move IF jail/vnet */
#define SIOCSIFRVNET _IOWR('i', 91, struct ifreq) /* reclaim vnet IF */
#define SIOCGIFFIB _IOWR('i', 92, struct ifreq) /* get IF fib */
#define SIOCSIFFIB _IOW('i', 93, struct ifreq) /* set IF fib */
#define SIOCGTUNFIB _IOWR('i', 94, struct ifreq) /* get tunnel fib */
#define SIOCSTUNFIB _IOW('i', 95, struct ifreq) /* set tunnel fib */
#define SIOCSDRVSPEC _IOW('i', 123, struct ifdrv) /* set driver-specific
parameters */
#define SIOCGDRVSPEC _IOWR('i', 123, struct ifdrv) /* get driver-specific
parameters */
#define SIOCIFCREATE _IOWR('i', 122, struct ifreq) /* create clone if */
#define SIOCIFCREATE2 _IOWR('i', 124, struct ifreq) /* create clone if */
#define SIOCIFDESTROY _IOW('i', 121, struct ifreq) /* destroy clone if */
#define SIOCIFGCLONERS _IOWR('i', 120, struct if_clonereq) /* get cloners */
#define SIOCAIFGROUP _IOW('i', 135, struct ifgroupreq) /* add an ifgroup */
#define SIOCGIFGROUP _IOWR('i', 136, struct ifgroupreq) /* get ifgroups */
#define SIOCDIFGROUP _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */
#define SIOCGIFGMEMB _IOWR('i', 138, struct ifgroupreq) /* get members */
#define SIOCGIFXMEDIA _IOWR('i', 139, struct ifmediareq) /* get net xmedia */
#define SIOCGIFRSSKEY _IOWR('i', 150, struct ifrsskey)/* get RSS key */
#define SIOCGIFRSSHASH _IOWR('i', 151, struct ifrsshash)/* get the current RSS
type/func settings */
#endif /* !_SYS_SOCKIO_H_ */

320
nx/external/bsd/include/sys/sysctl.h vendored Normal file
View File

@ -0,0 +1,320 @@
// TuxSH: removed definitions under _KERNEL ifdef blocks, modify the prototype of some functions, some other cleanup, etc.
// Note: I didn't provide <vm/vm_param.h>
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Karels at Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _SYS_SYSCTL_H_
#define _SYS_SYSCTL_H_
//#include <sys/queue.h>
//struct thread;
/*
* Definitions for sysctl call. The sysctl call uses a hierarchical name
* for objects that can be examined or modified. The name is expressed as
* a sequence of integers. Like a file path name, the meaning of each
* component depends on its place in the hierarchy. The top-level and kern
* identifiers are defined here, and other identifiers are defined in the
* respective subsystem header files.
*/
#define CTL_MAXNAME 24 /* largest number of components supported */
/*
* Each subsystem defined by sysctl defines a list of variables
* for that subsystem. Each name is either a node with further
* levels defined below it, or it is a leaf of some particular
* type given below. Each sysctl level defines a set of name/type
* pairs to be used by sysctl(8) in manipulating the subsystem.
*/
struct ctlname {
char *ctl_name; /* subsystem name */
int ctl_type; /* type of name */
};
#define CTLTYPE 0xf /* mask for the type */
#define CTLTYPE_NODE 1 /* name is a node */
#define CTLTYPE_INT 2 /* name describes an integer */
#define CTLTYPE_STRING 3 /* name describes a string */
#define CTLTYPE_S64 4 /* name describes a signed 64-bit number */
#define CTLTYPE_OPAQUE 5 /* name describes a structure */
#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
#define CTLTYPE_UINT 6 /* name describes an unsigned integer */
#define CTLTYPE_LONG 7 /* name describes a long */
#define CTLTYPE_ULONG 8 /* name describes an unsigned long */
#define CTLTYPE_U64 9 /* name describes an unsigned 64-bit number */
#define CTLTYPE_U8 0xa /* name describes an unsigned 8-bit number */
#define CTLTYPE_U16 0xb /* name describes an unsigned 16-bit number */
#define CTLTYPE_S8 0xc /* name describes a signed 8-bit number */
#define CTLTYPE_S16 0xd /* name describes a signed 16-bit number */
#define CTLTYPE_S32 0xe /* name describes a signed 32-bit number */
#define CTLTYPE_U32 0xf /* name describes an unsigned 32-bit number */
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
#define CTLFLAG_DORMANT 0x20000000 /* This sysctl is not active yet */
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */
#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */
#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */
#define CTLMASK_SECURE 0x00F00000 /* Secure level */
#define CTLFLAG_TUN 0x00080000 /* Default value is loaded from getenv() */
#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN)
#define CTLFLAG_RWTUN (CTLFLAG_RW|CTLFLAG_TUN)
#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */
#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */
#define CTLFLAG_DYING 0x00010000 /* Oid is being removed */
#define CTLFLAG_CAPRD 0x00008000 /* Can be read in capability mode */
#define CTLFLAG_CAPWR 0x00004000 /* Can be written in capability mode */
#define CTLFLAG_STATS 0x00002000 /* Statistics, not a tuneable */
#define CTLFLAG_NOFETCH 0x00001000 /* Don't fetch tunable from getenv() */
#define CTLFLAG_CAPRW (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
/*
* Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.
*
* Secure when the securelevel is raised to at least N.
*/
#define CTLSHIFT_SECURE 20
#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
/*
* USE THIS instead of a hardwired number from the categories below
* to get dynamically assigned sysctl entries using the linker-set
* technology. This is the way nearly all new sysctl variables should
* be implemented.
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
*/
#define OID_AUTO (-1)
/*
* The starting number for dynamically-assigned entries. WARNING!
* ALL static sysctl entries should have numbers LESS than this!
*/
#define CTL_AUTO_START 0x100
/*
* Top-level identifiers
*/
#define CTL_UNSPEC 0 /* unused */
#define CTL_KERN 1 /* "high kernel": proc, limits */
#define CTL_VM 2 /* virtual memory */
#define CTL_VFS 3 /* filesystem, mount type is next */
#define CTL_NET 4 /* network, see socket.h */
#define CTL_DEBUG 5 /* debugging parameters */
#define CTL_HW 6 /* generic cpu/io */
#define CTL_MACHDEP 7 /* machine dependent */
#define CTL_USER 8 /* user-level */
#define CTL_P1003_1B 9 /* POSIX 1003.1B */
/*
* CTL_KERN identifiers
*/
#define KERN_OSTYPE 1 /* string: system version */
#define KERN_OSRELEASE 2 /* string: system release */
#define KERN_OSREV 3 /* int: system revision */
#define KERN_VERSION 4 /* string: compile time info */
#define KERN_MAXVNODES 5 /* int: max vnodes */
#define KERN_MAXPROC 6 /* int: max processes */
#define KERN_MAXFILES 7 /* int: max open files */
#define KERN_ARGMAX 8 /* int: max arguments to exec */
#define KERN_SECURELVL 9 /* int: system security level */
#define KERN_HOSTNAME 10 /* string: hostname */
#define KERN_HOSTID 11 /* int: host identifier */
#define KERN_CLOCKRATE 12 /* struct: struct clockrate */
#define KERN_VNODE 13 /* struct: vnode structures */
#define KERN_PROC 14 /* struct: process entries */
#define KERN_FILE 15 /* struct: file entries */
#define KERN_PROF 16 /* node: kernel profiling info */
#define KERN_POSIX1 17 /* int: POSIX.1 version */
#define KERN_NGROUPS 18 /* int: # of supplemental group ids */
#define KERN_JOB_CONTROL 19 /* int: is job control available */
#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
#define KERN_BOOTTIME 21 /* struct: time kernel was booted */
#define KERN_NISDOMAINNAME 22 /* string: YP domain name */
#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */
#define KERN_OSRELDATE 24 /* int: kernel release date */
#define KERN_NTP_PLL 25 /* node: NTP PLL control */
#define KERN_BOOTFILE 26 /* string: name of booted kernel */
#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */
#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */
#define KERN_IPC 30 /* node: anything related to IPC */
#define KERN_DUMMY 31 /* unused */
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */
#define KERN_HOSTUUID 36 /* string: host UUID identifier */
#define KERN_ARND 37 /* int: from arc4rand() */
#define KERN_MAXPHYS 38 /* int: MAXPHYS value */
/*
* KERN_PROC subtypes
*/
#define KERN_PROC_ALL 0 /* everything */
#define KERN_PROC_PID 1 /* by process id */
#define KERN_PROC_PGRP 2 /* by process group id */
#define KERN_PROC_SESSION 3 /* by session of pid */
#define KERN_PROC_TTY 4 /* by controlling tty */
#define KERN_PROC_UID 5 /* by effective uid */
#define KERN_PROC_RUID 6 /* by real uid */
#define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */
#define KERN_PROC_PROC 8 /* only return procs */
#define KERN_PROC_SV_NAME 9 /* get syscall vector name */
#define KERN_PROC_RGID 10 /* by real group id */
#define KERN_PROC_GID 11 /* by effective group id */
#define KERN_PROC_PATHNAME 12 /* path to executable */
#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */
#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */
#define KERN_PROC_KSTACK 15 /* Kernel stacks for process */
#define KERN_PROC_INC_THREAD 0x10 /*
* modifier for pid, pgrp, tty,
* uid, ruid, gid, rgid and proc
* This effectively uses 16-31
*/
#define KERN_PROC_VMMAP 32 /* VM map entries for process */
#define KERN_PROC_FILEDESC 33 /* File descriptors for process */
#define KERN_PROC_GROUPS 34 /* process groups */
#define KERN_PROC_ENV 35 /* get environment */
#define KERN_PROC_AUXV 36 /* get ELF auxiliary vector */
#define KERN_PROC_RLIMIT 37 /* process resource limits */
#define KERN_PROC_PS_STRINGS 38 /* get ps_strings location */
#define KERN_PROC_UMASK 39 /* process umask */
#define KERN_PROC_OSREL 40 /* osreldate for process binary */
#define KERN_PROC_SIGTRAMP 41 /* signal trampoline location */
#define KERN_PROC_CWD 42 /* process current working directory */
#define KERN_PROC_NFDS 43 /* number of open file descriptors */
/*
* KERN_IPC identifiers
*/
#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
#define KIPC_SOMAXCONN 3 /* int: max length of connection q */
#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */
#define KIPC_MAX_HDR 6 /* int: max total length of headers */
#define KIPC_MAX_DATALEN 7 /* int: max length of data? */
/*
* CTL_HW identifiers
*/
#define HW_MACHINE 1 /* string: machine class */
#define HW_MODEL 2 /* string: specific machine model */
#define HW_NCPU 3 /* int: number of cpus */
#define HW_BYTEORDER 4 /* int: machine byte order */
#define HW_PHYSMEM 5 /* int: total memory */
#define HW_USERMEM 6 /* int: non-kernel memory */
#define HW_PAGESIZE 7 /* int: software page size */
#define HW_DISKNAMES 8 /* strings: disk drive names */
#define HW_DISKSTATS 9 /* struct: diskstats[] */
#define HW_FLOATINGPT 10 /* int: has HW floating point? */
#define HW_MACHINE_ARCH 11 /* string: machine architecture */
#define HW_REALMEM 12 /* int: 'real' memory */
/*
* CTL_USER definitions
*/
#define USER_CS_PATH 1 /* string: _CS_PATH */
#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
#define USER_LINE_MAX 8 /* int: LINE_MAX */
#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
#define CTL_P1003_1B_FSYNC 11 /* boolean */
#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
#define CTL_P1003_1B_TIMERS 14 /* boolean */
#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
#define CTL_P1003_1B_AIO_MAX 16 /* int */
#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
#define CTL_P1003_1B_PAGESIZE 20 /* int */
#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
#define CTL_P1003_1B_TIMER_MAX 25 /* int */
#define CTL_P1003_1B_MAXID 26
#include <sys/cdefs.h>
// Modified: added arg names, etc
__BEGIN_DECLS
int sysctl(const int *name, unsigned int namelen, void *oldp, size_t *oldlenp, const void *newp, size_t newlen);
int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, const void *newp, size_t newlen);
int sysctlnametomib(const char *name, int *mibp, size_t *sizep);
__END_DECLS
#endif /* !_SYS_SYSCTL_H_ */

View File

@ -12,51 +12,184 @@ extern "C" {
#include "switch/types.h"
#include "switch/result.h"
#include "switch/nro.h"
#include "switch/nacp.h"
#include "switch/arm/tls.h"
#include "switch/arm/cache.h"
#include "switch/arm/counter.h"
#include "switch/kernel/svc.h"
#include "switch/kernel/wait.h"
#include "switch/kernel/tmem.h"
#include "switch/kernel/shmem.h"
#include "switch/kernel/mutex.h"
#include "switch/kernel/event.h"
#include "switch/kernel/levent.h"
#include "switch/kernel/uevent.h"
#include "switch/kernel/utimer.h"
#include "switch/kernel/rwlock.h"
#include "switch/kernel/condvar.h"
#include "switch/kernel/thread.h"
#include "switch/kernel/semaphore.h"
#include "switch/kernel/virtmem.h"
#include "switch/kernel/detect.h"
#include "switch/kernel/random.h"
#include "switch/kernel/jit.h"
#include "switch/kernel/barrier.h"
#include "switch/arm/tls.h"
#include "switch/arm/cache.h"
#include "switch/ipc.h"
#include "switch/sf/hipc.h"
#include "switch/sf/cmif.h"
#include "switch/sf/service.h"
#include "switch/sf/sessionmgr.h"
#include "switch/sf/tipc.h"
#include "switch/services/sm.h"
#include "switch/services/smm.h"
#include "switch/services/fs.h"
#include "switch/services/fsldr.h"
#include "switch/services/fspr.h"
#include "switch/services/acc.h"
#include "switch/services/apm.h"
#include "switch/services/applet.h"
#include "switch/services/async.h"
#include "switch/services/audctl.h"
#include "switch/services/audin.h"
#include "switch/services/audout.h"
#include "switch/services/bsd.h"
#include "switch/services/audrec.h"
#include "switch/services/audren.h"
#include "switch/services/auddev.h"
#include "switch/services/hwopus.h"
#include "switch/services/csrng.h"
#include "switch/services/lbl.h"
#include "switch/services/i2c.h"
#include "switch/services/gpio.h"
#include "switch/services/uart.h"
#include "switch/services/bpc.h"
#include "switch/services/pcv.h"
#include "switch/services/clkrst.h"
#include "switch/services/fan.h"
#include "switch/services/pgl.h"
#include "switch/services/psm.h"
#include "switch/services/spsm.h"
//#include "switch/services/bsd.h" Use <sys/socket.h> instead
//#include "switch/services/sfdnsres.h" Use <netdb.h> instead
//#include "switch/services/htcs.h"
#include "switch/services/fatal.h"
#include "switch/services/time.h"
#include "switch/services/usb.h"
#include "switch/services/usbds.h"
#include "switch/services/usbhs.h"
#include "switch/services/hid.h"
#include "switch/services/hidbus.h"
#include "switch/services/hiddbg.h"
#include "switch/services/hidsys.h"
#include "switch/services/irs.h"
#include "switch/services/pl.h"
#include "switch/services/vi.h"
#include "switch/services/nv.h"
#include "switch/services/nifm.h"
#include "switch/services/nim.h"
#include "switch/services/ns.h"
#include "switch/services/ldr.h"
#include "switch/services/ro.h"
#include "switch/services/tc.h"
#include "switch/services/ts.h"
#include "switch/services/pm.h"
#include "switch/services/set.h"
#include "switch/services/ssl.h"
#include "switch/services/lr.h"
#include "switch/services/bt.h"
#include "switch/services/btdrv.h"
#include "switch/services/btm.h"
#include "switch/services/btmu.h"
#include "switch/services/btmsys.h"
#include "switch/services/spl.h"
#include "switch/services/ncm.h"
#include "switch/services/psc.h"
#include "switch/services/caps.h"
#include "switch/services/capsa.h"
#include "switch/services/capsc.h"
#include "switch/services/capsdc.h"
#include "switch/services/capsu.h"
#include "switch/services/capssc.h"
#include "switch/services/capssu.h"
#include "switch/services/capmtp.h"
#include "switch/services/nfc.h"
#include "switch/services/wlaninf.h"
#include "switch/services/pctl.h"
#include "switch/services/pdm.h"
#include "switch/services/grc.h"
#include "switch/services/friends.h"
#include "switch/services/notif.h"
#include "switch/services/mii.h"
#include "switch/services/miiimg.h"
#include "switch/services/ldn.h"
#include "switch/services/lp2p.h"
#include "switch/services/news.h"
#include "switch/services/ins.h"
#include "switch/services/ectx.h"
#include "switch/services/avm.h"
#include "switch/services/mm.h"
#include "switch/gfx/gfx.h"
#include "switch/gfx/binder.h"
#include "switch/gfx/parcel.h"
#include "switch/gfx/buffer_producer.h"
#include "switch/gfx/ioctl.h"
#include "switch/gfx/nvioctl.h"
#include "switch/gfx/nvgfx.h"
#include "switch/display/binder.h"
#include "switch/display/parcel.h"
#include "switch/display/buffer_producer.h"
#include "switch/display/native_window.h"
#include "switch/display/framebuffer.h"
#include "switch/nvidia/ioctl.h"
#include "switch/nvidia/graphic_buffer.h"
#include "switch/nvidia/fence.h"
#include "switch/nvidia/map.h"
#include "switch/nvidia/address_space.h"
#include "switch/nvidia/channel.h"
#include "switch/nvidia/gpu.h"
#include "switch/nvidia/gpu_channel.h"
#include "switch/audio/driver.h"
#include "switch/applets/libapplet.h"
#include "switch/applets/album_la.h"
#include "switch/applets/friends_la.h"
#include "switch/applets/hid_la.h"
#include "switch/applets/mii_la.h"
#include "switch/applets/nfp_la.h"
#include "switch/applets/nifm_la.h"
#include "switch/applets/pctlauth.h"
#include "switch/applets/psel.h"
#include "switch/applets/error.h"
#include "switch/applets/swkbd.h"
#include "switch/applets/web.h"
#include "switch/runtime/env.h"
#include "switch/runtime/hosversion.h"
#include "switch/runtime/diag.h"
#include "switch/runtime/nxlink.h"
#include "switch/runtime/resolver.h"
#include "switch/runtime/pad.h"
#include "switch/runtime/ringcon.h"
#include "switch/runtime/btdev.h"
#include "switch/runtime/util/utf.h"
#include "switch/runtime/devices/console.h"
#include "switch/runtime/devices/usb_comms.h"
#include "switch/runtime/devices/fs_dev.h"
#include "switch/runtime/devices/romfs_dev.h"
#include "switch/runtime/devices/socket.h"
#include "switch/crypto/aes.h"
#include "switch/crypto/aes_cbc.h"
#include "switch/crypto/aes_ctr.h"
#include "switch/crypto/aes_xts.h"
#include "switch/crypto/cmac.h"
#include "switch/crypto/sha256.h"
#include "switch/crypto/sha1.h"
#include "switch/crypto/hmac.h"
#include "switch/crypto/crc.h"
#ifdef __cplusplus
}

View File

@ -0,0 +1,31 @@
/**
* @file album_la.h
* @brief Wrapper for using the Album LibraryApplet.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/// Arg type values pushed for the applet input storage, stored as an u8.
typedef enum {
AlbumLaArg_ShowAlbumFiles = 0, ///< ShowAlbumFiles. Only displays AlbumFiles associated with the application which launched the Album applet, with the filter button disabled.
AlbumLaArg_ShowAllAlbumFiles = 1, ///< ShowAllAlbumFiles. Displays all AlbumFiles, with filtering allowed.
AlbumLaArg_ShowAllAlbumFilesForHomeMenu = 2, ///< ShowAllAlbumFilesForHomeMenu. Similar to ::AlbumLaArg_ShowAllAlbumFiles.
} AlbumLaArg;
/**
* @brief Launches the applet with ::AlbumLaArg_ShowAlbumFiles and playStartupSound=false.
*/
Result albumLaShowAlbumFiles(void);
/**
* @brief Launches the applet with ::AlbumLaArg_ShowAllAlbumFiles and playStartupSound=false.
*/
Result albumLaShowAllAlbumFiles(void);
/**
* @brief Launches the applet with ::AlbumLaArg_ShowAllAlbumFilesForHomeMenu and playStartupSound=true.
*/
Result albumLaShowAllAlbumFilesForHomeMenu(void);

View File

@ -0,0 +1,314 @@
/**
* @file error.h
* @brief Wrapper for using the error LibraryApplet.
* @author StuntHacks, yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/set.h"
/// Error type for ErrorCommonHeader.type.
typedef enum {
ErrorType_Normal = 0, ///< Normal
ErrorType_System = 1, ///< System
ErrorType_Application = 2, ///< Application
ErrorType_Eula = 3, ///< EULA
ErrorType_Pctl = 4, ///< Parental Controls
ErrorType_Record = 5, ///< Record
ErrorType_SystemUpdateEula = 8, ///< SystemUpdateEula
} ErrorType;
/// Stores error-codes which are displayed as XXXX-XXXX, low for the former and desc for the latter.
typedef struct {
u32 low; ///< The module portion of the error, normally this should be set to module + 2000.
u32 desc; ///< The error description.
} ErrorCode;
/// Error type for ErrorContext.type
typedef enum {
ErrorContextType_None = 0, ///< None
ErrorContextType_Http = 1, ///< Http
ErrorContextType_FileSystem = 2, ///< FileSystem
ErrorContextType_WebMediaPlayer = 3, ///< WebMediaPlayer
ErrorContextType_LocalContentShare = 4, ///< LocalContentShare
} ErrorContextType;
/// Error context.
typedef struct {
u8 type; ///< Type, see \ref ErrorContextType.
u8 pad[7]; ///< Padding
u8 data[0x1f4]; ///< Data
Result res; ///< Result
} ErrorContext;
/// Common header for the start of the arg storage.
typedef struct {
u8 type; ///< Type, see \ref ErrorType.
u8 jumpFlag; ///< When clear, this indicates WithoutJump.
u8 unk_x2[3]; ///< Unknown
u8 contextFlag; ///< When set with ::ErrorType_Normal, indicates that an additional storage is pushed for \ref ErrorResultBacktrace. [4.0.0+] Otherwise, when set indicates that an additional storage is pushed for \ref ErrorContext.
u8 resultFlag; ///< ErrorCommonArg: When clear, errorCode is used, otherwise the applet generates the error-code from res.
u8 contextFlag2; ///< Similar to contextFlag except for ErrorCommonArg, indicating \ref ErrorContext is used.
} ErrorCommonHeader;
/// Common error arg data.
typedef struct {
ErrorCommonHeader hdr; ///< Common header.
ErrorCode errorCode; ///< \ref ErrorCode
Result res; ///< Result
} ErrorCommonArg;
/// Error arg data for certain errors with module PCTL.
typedef struct {
ErrorCommonHeader hdr; ///< Common header.
Result res; ///< Result
} ErrorPctlArg;
/// ResultBacktrace
typedef struct {
s32 count; ///< Total entries in the backtrace array.
Result backtrace[0x20]; ///< Result backtrace.
} ErrorResultBacktrace;
/// Error arg data for EULA.
typedef struct {
ErrorCommonHeader hdr; ///< Common header.
SetRegion regionCode; ///< \ref SetRegion
} ErrorEulaArg;
/// Additional input storage data for \ref errorSystemUpdateEulaShow.
typedef struct {
u8 data[0x20000]; ///< data
} ErrorEulaData;
/// Error arg data for Record.
typedef struct {
ErrorCommonHeader hdr; ///< Common header.
ErrorCode errorCode; ///< \ref ErrorCode
u64 timestamp; ///< POSIX timestamp.
} ErrorRecordArg;
/// SystemErrorArg
typedef struct {
ErrorCommonHeader hdr; ///< Common header.
ErrorCode errorCode; ///< \ref ErrorCode
u64 languageCode; ///< See set.h.
char dialogMessage[0x800]; ///< UTF-8 Dialog message.
char fullscreenMessage[0x800]; ///< UTF-8 Fullscreen message (displayed when the user clicks on "Details").
} ErrorSystemArg;
/// Error system config.
typedef struct {
ErrorSystemArg arg; ///< Arg data.
ErrorContext ctx; ///< Optional error context.
} ErrorSystemConfig;
/// ApplicationErrorArg
typedef struct {
ErrorCommonHeader hdr; ///< Common header.
u32 errorNumber; ///< Raw decimal error number which is displayed in the dialog.
u64 languageCode; ///< See set.h.
char dialogMessage[0x800]; ///< UTF-8 Dialog message.
char fullscreenMessage[0x800]; ///< UTF-8 Fullscreen message (displayed when the user clicks on "Details").
} NX_PACKED ErrorApplicationArg;
/// Error application config.
typedef struct {
ErrorApplicationArg arg; ///< Arg data.
} ErrorApplicationConfig;
/**
* @brief Creates an \ref ErrorCode.
* @param low The module portion of the error, normally this should be set to module + 2000.
* @param desc The error description.
*/
static inline ErrorCode errorCodeCreate(u32 low, u32 desc) {
return (ErrorCode){low, desc};
}
/**
* @brief Creates an \ref ErrorCode with the input Result. Wrapper for \ref errorCodeCreate.
* @param res Input Result.
*/
static inline ErrorCode errorCodeCreateResult(Result res) {
return errorCodeCreate(2000 + R_MODULE(res), R_DESCRIPTION(res));
}
/**
* @brief Creates an invalid \ref ErrorCode.
*/
static inline ErrorCode errorCodeCreateInvalid(void) {
return (ErrorCode){0};
}
/**
* @brief Checks whether the input ErrorCode is valid.
* @param errorCode \ref ErrorCode
*/
static inline bool errorCodeIsValid(ErrorCode errorCode) {
return errorCode.low!=0;
}
/**
* @brief Launches the applet for displaying the specified Result.
* @param res Result
* @param jumpFlag Jump flag, normally this is true.
* @param ctx Optional \ref ErrorContext, can be NULL. Unused when jumpFlag=false. Ignored on pre-4.0.0, since it's only available for [4.0.0+].
* @note Sets the following fields: jumpFlag and contextFlag2. Uses ::ErrorType_Normal normally.
* @note For module=PCTL errors with desc 100-119 this sets uses ::ErrorType_Pctl, in which case the applet will display the following special dialog: "This software is restricted by Parental Controls".
* @note If the input Result is 0xC8A2, the applet will display a special dialog regarding the current application requiring a software update, with buttons "Later" and "Restart".
* @note [3.0.0+] If the input Result is 0xCAA2, the applet will display a special dialog related to DLC version.
* @warning This applet creates an error report that is logged in the system, when not handling the above special dialogs. Proceed at your own risk!
*/
Result errorResultShow(Result res, bool jumpFlag, const ErrorContext* ctx);
/**
* @brief Launches the applet for displaying the specified ErrorCode.
* @param errorCode \ref ErrorCode
* @param jumpFlag Jump flag, normally this is true.
* @param ctx Optional \ref ErrorContext, can be NULL. Unused when jumpFlag=false. Ignored on pre-4.0.0, since it's only available for [4.0.0+].
* @note Sets the following fields: jumpFlag and contextFlag2. resultFlag=1. Uses ::ErrorType_Normal.
* @warning This applet creates an error report that is logged in the system. Proceed at your own risk!
*/
Result errorCodeShow(ErrorCode errorCode, bool jumpFlag, const ErrorContext* ctx);
/**
* @brief Creates an ErrorResultBacktrace struct.
* @param backtrace \ref ErrorResultBacktrace struct.
* @param count Total number of entries.
* @param entries Input array of Result.
*/
Result errorResultBacktraceCreate(ErrorResultBacktrace* backtrace, s32 count, const Result* entries);
/**
* @brief Launches the applet for \ref ErrorResultBacktrace.
* @param backtrace ErrorResultBacktrace struct.
* @param res Result
* @note Sets the following fields: jumpFlag=1, contextFlag=1, and uses ::ErrorType_Normal.
* @warning This applet creates an error report that is logged in the system. Proceed at your own risk!
*/
Result errorResultBacktraceShow(Result res, const ErrorResultBacktrace* backtrace);
/**
* @brief Launches the applet for displaying the EULA.
* @param RegionCode \ref SetRegion
* @note Sets the following fields: jumpFlag=1, regionCode, and uses ::ErrorType_Eula.
*/
Result errorEulaShow(SetRegion RegionCode);
/**
* @brief Launches the applet for displaying the system-update EULA.
* @param RegionCode \ref SetRegion
* @param eula EULA data. Address must be 0x1000-byte aligned.
* @note Sets the following fields: jumpFlag=1, regionCode, and uses ::ErrorType_SystemUpdateEula.
*/
Result errorSystemUpdateEulaShow(SetRegion RegionCode, const ErrorEulaData* eula);
/**
* @brief Launches the applet for displaying an error full-screen, using the specified ErrorCode and timestamp.
* @param errorCode \ref ErrorCode
* @param timestamp POSIX timestamp.
* @note Sets the following fields: jumpFlag=1, errorCode, timestamp, and uses ::ErrorType_Record.
* @note The applet does not log an error report for this. error*RecordShow is used by qlaunch for displaying previously logged error reports.
*/
Result errorCodeRecordShow(ErrorCode errorCode, u64 timestamp);
/**
* @brief Launches the applet for displaying an error full-screen, using the specified Result and timestamp.
* @param res Result
* @param timestamp POSIX timestamp.
* @note Wrapper for \ref errorCodeRecordShow, see \ref errorCodeRecordShow notes.
*/
static inline Result errorResultRecordShow(Result res, u64 timestamp) {
return errorCodeRecordShow(errorCodeCreateResult(res), timestamp);
}
/**
* @brief Creates an ErrorSystemConfig struct.
* @param c ErrorSystemConfig struct.
* @param dialog_message UTF-8 dialog message.
* @param fullscreen_message UTF-8 fullscreen message, displayed when the user clicks on "Details". Optional, can be NULL (which disables displaying Details).
* @note Sets the following fields: {strings}, and uses ::ErrorType_System. The rest are cleared.
* @note On pre-5.0.0 this will initialize languageCode by using: setInitialize(), setMakeLanguageCode(SetLanguage_ENUS, ...), and setExit(). This is needed since an empty languageCode wasn't supported until [5.0.0+] (which would also use SetLanguage_ENUS).
* @warning This applet creates an error report that is logged in the system. Proceed at your own risk!
*/
Result errorSystemCreate(ErrorSystemConfig* c, const char* dialog_message, const char* fullscreen_message);
/**
* @brief Launches the applet with the specified config.
* @param c ErrorSystemConfig struct.
*/
Result errorSystemShow(ErrorSystemConfig* c);
/**
* @brief Sets the error code.
* @param c ErrorSystemConfig struct.
* @param errorCode \ref ErrorCode
*/
static inline void errorSystemSetCode(ErrorSystemConfig* c, ErrorCode errorCode) {
c->arg.errorCode = errorCode;
}
/**
* @brief Sets the error code, using the input Result. Wrapper for \ref errorSystemSetCode.
* @param c ErrorSystemConfig struct.
* @param res The Result to set.
*/
static inline void errorSystemSetResult(ErrorSystemConfig* c, Result res) {
errorSystemSetCode(c, errorCodeCreateResult(res));
}
/**
* @brief Sets the LanguageCode.
* @param c ErrorSystemConfig struct.
* @param LanguageCode LanguageCode, see set.h.
*/
static inline void errorSystemSetLanguageCode(ErrorSystemConfig* c, u64 LanguageCode) {
c->arg.languageCode = LanguageCode;
}
/**
* @brief Sets the ErrorContext.
* @note Only available on [4.0.0+], on older versions this will return without setting the context.
* @param c ErrorSystemConfig struct.
* @param ctx ErrorContext, NULL to clear it.
*/
void errorSystemSetContext(ErrorSystemConfig* c, const ErrorContext* ctx);
/**
* @brief Creates an ErrorApplicationConfig struct.
* @param c ErrorApplicationConfig struct.
* @param dialog_message UTF-8 dialog message.
* @param fullscreen_message UTF-8 fullscreen message, displayed when the user clicks on "Details". Optional, can be NULL (which disables displaying Details).
* @note Sets the following fields: jumpFlag=1, {strings}, and uses ::ErrorType_Application. The rest are cleared.
* @note On pre-5.0.0 this will initialize languageCode by using: setInitialize(), setMakeLanguageCode(SetLanguage_ENUS, ...), and setExit(). This is needed since an empty languageCode wasn't supported until [5.0.0+] (which would also use SetLanguage_ENUS).
* @note With [10.0.0+] this must only be used when running under an Application, since otherwise the applet will trigger a fatalerr.
* @warning This applet creates an error report that is logged in the system. Proceed at your own risk!
*/
Result errorApplicationCreate(ErrorApplicationConfig* c, const char* dialog_message, const char* fullscreen_message);
/**
* @brief Launches the applet with the specified config.
* @param c ErrorApplicationConfig struct.
*/
Result errorApplicationShow(ErrorApplicationConfig* c);
/**
* @brief Sets the error code number.
* @param c ErrorApplicationConfig struct.
* @param errorNumber Error code number. Raw decimal error number which is displayed in the dialog.
*/
static inline void errorApplicationSetNumber(ErrorApplicationConfig* c, u32 errorNumber) {
c->arg.errorNumber = errorNumber;
}
/**
* @brief Sets the LanguageCode.
* @param c ErrorApplicationConfig struct.
* @param LanguageCode LanguageCode, see set.h.
*/
static inline void errorApplicationSetLanguageCode(ErrorApplicationConfig* c, u64 LanguageCode) {
c->arg.languageCode = LanguageCode;
}

View File

@ -0,0 +1,172 @@
/**
* @file friends_la.h
* @brief Wrapper for using the MyPage (friends) LibraryApplet.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/acc.h"
#include "../services/friends.h"
/// Arg type values used with \ref FriendsLaArg.
typedef enum {
FriendsLaArgType_ShowFriendList = 0, ///< ShowFriendList. Launches the applet with the "Friend List" menu initially selected.
FriendsLaArgType_ShowUserDetailInfo = 1, ///< ShowUserDetailInfo
FriendsLaArgType_StartSendingFriendRequest = 2, ///< StartSendingFriendRequest
FriendsLaArgType_ShowMethodsOfSendingFriendRequest = 3, ///< ShowMethodsOfSendingFriendRequest. Launches the applet with the "Add Friend" menu initially selected.
FriendsLaArgType_StartFacedFriendRequest = 4, ///< StartFacedFriendRequest. Launches the applet where the "Search for Local Users" menu is initially shown. Returning from this menu will exit the applet.
FriendsLaArgType_ShowReceivedFriendRequestList = 5, ///< ShowReceivedFriendRequestList. Launches the applet where the "Received Friend Requests" menu is initially shown. Returning from this menu will exit the applet.
FriendsLaArgType_ShowBlockedUserList = 6, ///< ShowBlockedUserList. Launches the applet where the "Blocked-User List" menu is initially shown. Returning from this menu will exit the applet.
FriendsLaArgType_ShowMyProfile = 7, ///< ShowMyProfile. Launches the applet with the "Profile" menu initially selected. ShowMyProfileForHomeMenu is identical to this except for playStartupSound=true.
FriendsLaArgType_StartFriendInvitation = 8, ///< [9.0.0+] StartFriendInvitation. Launches the applet for sending online-play invites to friends, where the friends are selected via the UI.
FriendsLaArgType_StartSendingFriendInvitation = 9, ///< [9.0.0+] StartSendingFriendInvitation.
FriendsLaArgType_ShowReceivedInvitationDetail = 10, ///< [9.0.0+] ShowReceivedInvitationDetail.
} FriendsLaArgType;
/// Header for the arg struct.
typedef struct {
u32 type; ///< \ref FriendsLaArgType
u32 pad; ///< Padding.
AccountUid uid; ///< \ref AccountUid
} FriendsLaArgHeader;
/// Common data for the arg struct, for the pre-9.0.0 types.
/// This is only set for ::FriendsLaArgType_ShowUserDetailInfo/::FriendsLaArgType_StartSendingFriendRequest, for everything else this is cleared.
typedef struct {
AccountNetworkServiceAccountId id; ///< \ref AccountNetworkServiceAccountId for the other account.
FriendsInAppScreenName first_inAppScreenName; ///< First InAppScreenName.
FriendsInAppScreenName second_inAppScreenName; ///< Second InAppScreenName.
} FriendsLaArgCommonData;
/// Arg struct pushed for the applet input storage, for pre-9.0.0.
typedef struct {
FriendsLaArgHeader hdr; ///< \ref FriendsLaArgHeader
FriendsLaArgCommonData data; ///< \ref FriendsLaArgCommonData
} FriendsLaArgV1;
/// Arg struct pushed for the applet input storage, for [9.0.0+].
typedef struct {
FriendsLaArgHeader hdr; ///< \ref FriendsLaArgHeader
union {
u8 raw[0x1090]; ///< Raw data.
FriendsLaArgCommonData common; ///< \ref FriendsLaArgCommonData
struct {
s32 id_count; ///< \ref AccountNetworkServiceAccountId count, must be 1-15.
u32 pad; ///< Padding.
u64 userdata_size; ///< User-data size, must be <=0x400.
u8 userdata[0x400]; ///< Arbitrary user-data, see above size.
FriendsFriendInvitationGameModeDescription desc; ///< \ref FriendsFriendInvitationGameModeDescription
} start_friend_invitation; ///< Data for ::FriendsLaArgType_StartFriendInvitation.
struct {
s32 id_count; ///< \ref AccountNetworkServiceAccountId count, must be 1-15.
u32 pad; ///< Padding.
AccountNetworkServiceAccountId id_list[16]; ///< \ref AccountNetworkServiceAccountId list, see above count.
u64 userdata_size; ///< User-data size, must be <=0x400.
u8 userdata[0x400]; ///< Arbitrary user-data, see above size.
FriendsFriendInvitationGameModeDescription desc; ///< \ref FriendsFriendInvitationGameModeDescription
} start_sending_friend_invitation; ///< Data for ::FriendsLaArgType_StartSendingFriendInvitation.
struct {
FriendsFriendInvitationId invitation_id; ///< \ref FriendsFriendInvitationId
FriendsFriendInvitationGroupId invitation_group_id; ///< \ref FriendsFriendInvitationGroupId
} show_received_invitation_detail; ///< Data for ::FriendsLaArgType_ShowReceivedInvitationDetail.
} data; ///< Data for each \ref FriendsLaArgType.
} FriendsLaArg;
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowFriendList, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowFriendList(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowUserDetailInfo, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
* @param[in] id \ref AccountNetworkServiceAccountId for the user to show UserDetailInfo for.
* @param[in] first_inAppScreenName First \ref FriendsInAppScreenName.
* @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName.
*/
Result friendsLaShowUserDetailInfo(AccountUid uid, AccountNetworkServiceAccountId id, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName);
/**
* @brief Launches the applet with ::FriendsLaArgType_StartSendingFriendRequest, the specified input, and playStartupSound=false. On success, this will load the output Result from the output storage.
* @param[in] uid \ref AccountUid
* @param[in] id \ref AccountNetworkServiceAccountId to send the friend request to.
* @param[in] first_inAppScreenName First \ref FriendsInAppScreenName.
* @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName.
*/
Result friendsLaStartSendingFriendRequest(AccountUid uid, AccountNetworkServiceAccountId id, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowMethodsOfSendingFriendRequest, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowMethodsOfSendingFriendRequest(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_StartFacedFriendRequest, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaStartFacedFriendRequest(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowReceivedFriendRequestList, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowReceivedFriendRequestList(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowBlockedUserList, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowBlockedUserList(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowMyProfile, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowMyProfile(AccountUid uid);
/**
* @brief Same as \ref friendsLaShowMyProfile except with playStartupSound=true.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowMyProfileForHomeMenu(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_StartFriendInvitation, the specified input, and playStartupSound=false. On success, this will load the output Result from the output storage.
* @note Only available on [9.0.0+].
* @param[in] uid \ref AccountUid
* @param[in] id_count \ref AccountNetworkServiceAccountId count, must be 1-15. Number of friends to invite.
* @param[in] desc \ref FriendsFriendInvitationGameModeDescription
* @param[in] userdata Arbitrary user-data. Can be NULL.
* @param[in] userdata_size User-data size, must be <=0x400. Can be 0 if userdata is NULL.
*/
Result friendsLaStartFriendInvitation(AccountUid uid, s32 id_count, const FriendsFriendInvitationGameModeDescription *desc, const void* userdata, u64 userdata_size);
/**
* @brief Launches the applet with ::FriendsLaArgType_StartSendingFriendInvitation, the specified input, and playStartupSound=false. On success, this will load the output Result from the output storage.
* @note Only available on [9.0.0+].
* @param[in] uid \ref AccountUid
* @param[in] id_list \ref AccountNetworkServiceAccountId list.
* @param[in] id_count Size of the id_list array in entries, must be 1-15. Number of friends to invite.
* @param[in] desc \ref FriendsFriendInvitationGameModeDescription
* @param[in] userdata Arbitrary user-data. Can be NULL.
* @param[in] userdata_size User-data size, must be <=0x400. Can be 0 if userdata is NULL.
*/
Result friendsLaStartSendingFriendInvitation(AccountUid uid, const AccountNetworkServiceAccountId *id_list, s32 id_count, const FriendsFriendInvitationGameModeDescription *desc, const void* userdata, u64 userdata_size);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowReceivedInvitationDetail, the specified input, and playStartupSound=false.
* @note Only available on [9.0.0+].
* @param[in] uid \ref AccountUid
* @param[in] invitation_id \ref FriendsFriendInvitationId
* @param[in] invitation_group_id \ref FriendsFriendInvitationGroupId
*/
Result friendsLaShowReceivedInvitationDetail(AccountUid uid, FriendsFriendInvitationId invitation_id, FriendsFriendInvitationGroupId invitation_group_id);

View File

@ -0,0 +1,175 @@
/**
* @file hid_la.h
* @brief Wrapper for using the controller LibraryApplet.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/hid.h"
/// Mode values for HidLaControllerSupportArgPrivate::mode.
typedef enum {
HidLaControllerSupportMode_ShowControllerSupport = 0, ///< ShowControllerSupport
HidLaControllerSupportMode_ShowControllerStrapGuide = 1, ///< [3.0.0+] ShowControllerStrapGuide
HidLaControllerSupportMode_ShowControllerFirmwareUpdate = 2, ///< [3.0.0+] ShowControllerFirmwareUpdate
HidLaControllerSupportMode_ShowControllerKeyRemappingForSystem = 4, ///< [11.0.0+] ShowControllerKeyRemappingForSystem
} HidLaControllerSupportMode;
/// ControllerSupportCaller
typedef enum {
HidLaControllerSupportCaller_Application = 0, ///< Application, this is the default.
HidLaControllerSupportCaller_System = 1, ///< System. Skips the firmware-update confirmation dialog. This has the same affect as using the controller-update option from qlaunch System Settings.
} HidLaControllerSupportCaller;
/// ControllerSupportArgPrivate
typedef struct {
u32 private_size; ///< Size of this ControllerSupportArgPrivate struct.
u32 arg_size; ///< Size of the storage following this one (\ref HidLaControllerSupportArg or \ref HidLaControllerFirmwareUpdateArg).
u8 flag0; ///< Flag0
u8 flag1; ///< Flag1
u8 mode; ///< \ref HidLaControllerSupportMode
u8 controller_support_caller; ///< \ref HidLaControllerSupportCaller. Always zero except with \ref hidLaShowControllerFirmwareUpdateForSystem, which sets this to the input param.
u32 npad_style_set; ///< Output from \ref hidGetSupportedNpadStyleSet. With ShowControllerSupportForSystem on pre-3.0.0 this is value 0.
u32 npad_joy_hold_type; ///< Output from \ref hidGetNpadJoyHoldType. With ShowControllerSupportForSystem on pre-3.0.0 this is value 1.
} HidLaControllerSupportArgPrivate;
/// Common header used by HidLaControllerSupportArg*.
/// max_supported_players is 4 on pre-8.0.0, 8 on [8.0.0+]. player_count_min and player_count_max are overriden with value 4 when larger than value 4, during conversion handling for \ref HidLaControllerSupportArg on pre-8.0.0.
typedef struct {
s8 player_count_min; ///< playerCountMin. Must be >=0 and <=max_supported_players.
s8 player_count_max; ///< playerCountMax. Must be >=1 and <=max_supported_players.
u8 enable_take_over_connection; ///< enableTakeOverConnection, non-zero to enable. Disconnects the controllers when not enabled.
u8 enable_left_justify; ///< enableLeftJustify, non-zero to enable.
u8 enable_permit_joy_dual; ///< enablePermitJoyDual, non-zero to enable.
u8 enable_single_mode; ///< enableSingleMode, non-zero to enable. Enables using a single player in handheld-mode, dual-mode, or single-mode (player_count_* are overridden). Using handheld-mode is not allowed if this is not enabled.
u8 enable_identification_color; ///< When non-zero enables using identification_color.
} HidLaControllerSupportArgHeader;
/// Identification color used by HidLaControllerSupportArg*. When HidLaControllerSupportArgHeader::enable_identification_color is set this controls the color of the UI player box outline.
typedef struct {
u8 r; ///< Red color component.
u8 g; ///< Green color component.
u8 b; ///< Blue color component.
u8 a; ///< Alpha color component.
} HidLaControllerSupportArgColor;
/// ControllerSupportArg for [1.0.0+].
typedef struct {
HidLaControllerSupportArgHeader hdr; ///< \ref HidLaControllerSupportArgHeader
HidLaControllerSupportArgColor identification_color[4]; ///< \ref HidLaControllerSupportArgColor for each player, see HidLaControllerSupportArgHeader::enable_identification_color.
u8 enable_explain_text; ///< Enables using the ExplainText data when non-zero.
char explain_text[4][0x81]; ///< ExplainText for each player, NUL-terminated UTF-8 strings.
} HidLaControllerSupportArgV3;
/// ControllerSupportArg for [8.0.0+], converted to \ref HidLaControllerSupportArgV3 on pre-8.0.0.
typedef struct {
HidLaControllerSupportArgHeader hdr; ///< \ref HidLaControllerSupportArgHeader
HidLaControllerSupportArgColor identification_color[8]; ///< \ref HidLaControllerSupportArgColor for each player, see HidLaControllerSupportArgHeader::enable_identification_color.
u8 enable_explain_text; ///< Enables using the ExplainText data when non-zero.
char explain_text[8][0x81]; ///< ExplainText for each player, NUL-terminated UTF-8 strings.
} HidLaControllerSupportArg;
/// ControllerFirmwareUpdateArg
typedef struct {
u8 enable_force_update; ///< enableForceUpdate, non-zero to enable. Default is 0. Forces a firmware update when enabled, without an UI option to skip it.
u8 pad[3]; ///< Padding.
} HidLaControllerFirmwareUpdateArg;
/// ControllerKeyRemappingArg
typedef struct {
u64 unk_x0; ///< Unknown
u32 unk_x8; ///< Unknown
u8 pad[0x4]; ///< Padding
} HidLaControllerKeyRemappingArg;
/// ControllerSupportResultInfo. First 8-bytes from the applet output storage.
typedef struct {
s8 player_count; ///< playerCount.
u8 pad[3]; ///< Padding.
u32 selected_id; ///< \ref HidNpadIdType, selectedId.
} HidLaControllerSupportResultInfo;
/// Struct for the applet output storage.
typedef struct {
HidLaControllerSupportResultInfo info; ///< \ref HidLaControllerSupportResultInfo
u32 res; ///< Output res value.
} HidLaControllerSupportResultInfoInternal;
/**
* @brief Initializes a \ref HidLaControllerSupportArg with the defaults.
* @note This clears the arg, then does: HidLaControllerSupportArgHeader::player_count_min = 0, HidLaControllerSupportArgHeader::player_count_max = 4, HidLaControllerSupportArgHeader::enable_take_over_connection = 1, HidLaControllerSupportArgHeader::enable_left_justify = 1, and HidLaControllerSupportArgHeader::enable_permit_joy_dual = 1.
* @note If preferred, you can also memset \ref HidLaControllerSupportArg manually and initialize it yourself.
* @param[out] arg \ref HidLaControllerSupportArg
*/
void hidLaCreateControllerSupportArg(HidLaControllerSupportArg *arg);
/**
* @brief Initializes a \ref HidLaControllerFirmwareUpdateArg with the defaults.
* @note This just uses memset() with the arg.
* @param[out] arg \ref HidLaControllerFirmwareUpdateArg
*/
void hidLaCreateControllerFirmwareUpdateArg(HidLaControllerFirmwareUpdateArg *arg);
/**
* @brief Initializes a \ref HidLaControllerKeyRemappingArg with the defaults.
* @note This just uses memset() with the arg.
* @param[out] arg \ref HidLaControllerKeyRemappingArg
*/
void hidLaCreateControllerKeyRemappingArg(HidLaControllerKeyRemappingArg *arg);
/**
* @brief Sets the ExplainText for the specified player and \ref HidLaControllerSupportArg.
* @note This string is displayed in the UI box for the player.
* @note HidLaControllerSupportArg::enable_explain_text must be set, otherwise this ExplainText is ignored.
* @param arg \ref HidLaControllerSupportArg
* @param[in] str Input ExplainText UTF-8 string, max length is 0x80 excluding NUL-terminator.
+ @oaram[in] id Player controller, must be <8.
*/
Result hidLaSetExplainText(HidLaControllerSupportArg *arg, const char *str, HidNpadIdType id);
/**
* @brief Launches the applet for ControllerSupport.
* @note This seems to only display the applet UI when doing so is actually needed? This doesn't apply to \ref hidLaShowControllerSupportForSystem.
* @param[out] result_info \ref HidLaControllerSupportResultInfo. Optional, can be NULL.
* @param[in] arg \ref HidLaControllerSupportArg
*/
Result hidLaShowControllerSupport(HidLaControllerSupportResultInfo *result_info, const HidLaControllerSupportArg *arg);
/**
* @brief Launches the applet for ControllerStrapGuide.
* @note Only available on [3.0.0+].
*/
Result hidLaShowControllerStrapGuide(void);
/**
* @brief Launches the applet for ControllerFirmwareUpdate.
* @note Only available on [3.0.0+].
* @param[in] arg \ref HidLaControllerFirmwareUpdateArg
*/
Result hidLaShowControllerFirmwareUpdate(const HidLaControllerFirmwareUpdateArg *arg);
/**
* @brief This is the system version of \ref hidLaShowControllerSupport.
* @param[out] result_info \ref HidLaControllerSupportResultInfo. Optional, can be NULL.
* @param[in] arg \ref HidLaControllerSupportArg
* @param[in] flag Input flag. When true, the applet displays the menu as if launched by qlaunch.
*/
Result hidLaShowControllerSupportForSystem(HidLaControllerSupportResultInfo *result_info, const HidLaControllerSupportArg *arg, bool flag);
/**
* @brief This is the system version of \ref hidLaShowControllerFirmwareUpdate.
* @note Only available on [3.0.0+].
* @param[in] arg \ref HidLaControllerFirmwareUpdateArg
* @param[in] caller \ref HidLaControllerSupportCaller
*/
Result hidLaShowControllerFirmwareUpdateForSystem(const HidLaControllerFirmwareUpdateArg *arg, HidLaControllerSupportCaller caller);
/**
* @brief Launches the applet for ControllerKeyRemappingForSystem.
* @note Only available on [11.0.0+].
* @param[in] arg \ref HidLaControllerKeyRemappingArg
* @param[in] caller \ref HidLaControllerSupportCaller
*/
Result hidLaShowControllerKeyRemappingForSystem(const HidLaControllerKeyRemappingArg *arg, HidLaControllerSupportCaller caller);

View File

@ -0,0 +1,136 @@
/**
* @file libapplet.h
* @brief LibraryApplet wrapper.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/applet.h"
#include "../services/acc.h"
/// CommonArguments
typedef struct {
u32 CommonArgs_version; ///< \ref libappletArgsCreate sets this to 1, and \ref libappletArgsPop requires value 1. v0 is not supported.
u32 CommonArgs_size; ///< Size of this struct.
u32 LaVersion; ///< LibraryApplet API version.
s32 ExpectedThemeColor; ///< Set to the output from \ref appletGetThemeColorType by \ref libappletArgsCreate.
u8 PlayStartupSound; ///< bool flag, default is false.
u8 pad[7]; ///< Padding.
u64 tick; ///< System tick. Set to the output from \ref armGetSystemTick during \ref libappletArgsPush.
} LibAppletArgs;
/**
* @brief Creates a LibAppletArgs struct.
* @param a LibAppletArgs struct.
* @param version LaVersion for \ref LibAppletArgs.
*/
void libappletArgsCreate(LibAppletArgs* a, u32 version);
/**
* @brief Sets the PlayStartupSound field in \ref LibAppletArgs.
* @param a LibAppletArgs struct.
* @param flag Value for \ref LibAppletArgs PlayStartupSound.
*/
void libappletArgsSetPlayStartupSound(LibAppletArgs* a, bool flag);
/**
* @brief Creates an AppletStorage with the specified size and writes the buffer contents to that storage at offset 0.
* @param[out] s Storage object.
* @param buffer Input buffer.
* @param size Size to write.
*/
Result libappletCreateWriteStorage(AppletStorage* s, const void* buffer, size_t size);
/**
* @brief Reads data from offset 0 from the specified storage into the buffer. If the storage-size is smaller than the size param, the storage-size is used instead.
* @param s Storage object.
* @param buffer Output buffer.
* @param size Size to read.
* @param transfer_size Optional output size field for the actual size used for the read, can be NULL.
*/
Result libappletReadStorage(AppletStorage* s, void* buffer, size_t size, size_t *transfer_size);
/**
* @brief Sets the tick field in LibAppletArgs, then creates a storage with it which is pushed to the AppletHolder via \ref appletHolderPushInData.
* @param a LibAppletArgs struct.
* @param h AppletHolder object.
*/
Result libappletArgsPush(LibAppletArgs* a, AppletHolder *h);
/**
* @brief Uses \ref appletPopInData and reads it to the specified LibAppletArgs. The LibAppletArgs is validated, an error is thrown when invalid.
* @param[out] a LibAppletArgs struct.
*/
Result libappletArgsPop(LibAppletArgs* a);
/**
* @brief Creates a storage using the input buffer which is pushed to the AppletHolder via \ref appletHolderPushInData.
* @param h AppletHolder object.
* @param buffer Input data buffer.
* @param size Input data size.
*/
Result libappletPushInData(AppletHolder *h, const void* buffer, size_t size);
/**
* @brief Pops a storage via \ref appletHolderPopOutData, uses \ref libappletReadStorage, then closes the storage.
* @param h AppletHolder object.
* @param buffer Output buffer.
* @param size Size to read.
* @param transfer_size Optional output size field for the actual size used for the read, can be NULL.
*/
Result libappletPopOutData(AppletHolder *h, void* buffer, size_t size, size_t *transfer_size);
/**
* @brief Sets whether \ref libappletStart uses \ref appletHolderJump.
* @param flag Flag. Value true should not be used unless running as AppletType_LibraryApplet.
*/
void libappletSetJumpFlag(bool flag);
/**
* @brief If the flag from \ref libappletSetJumpFlag is set, this just uses \ref appletHolderJump. Otherwise, starts the applet and waits for it to finish, then checks the \ref LibAppletExitReason.
* @note Uses \ref appletHolderStart and \ref appletHolderJoin.
* @param h AppletHolder object.
*/
Result libappletStart(AppletHolder *h);
/**
* @brief Creates a LibraryApplet with the specified input storage data, uses \ref libappletStart, and reads the output storage reply data via \ref libappletPopOutData.
* @param id \ref AppletId
* @param commonargs \ref LibAppletArgs struct.
* @param arg Input storage data buffer. Optional, can be NULL.
* @param arg_size Size of the arg buffer.
* @param reply Output storage data buffer. Optional, can be NULL.
* @param reply_size Size to read for the reply buffer.
* @param out_reply_size Actual read reply data size, see \ref libappletPopOutData.
*/
Result libappletLaunch(AppletId id, LibAppletArgs *commonargs, const void* arg, size_t arg_size, void* reply, size_t reply_size, size_t *out_reply_size);
/// Wrapper for \ref appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.
/// Returns to the main Home Menu, equivalent to pressing the HOME button.
Result libappletRequestHomeMenu(void);
/// Wrapper for \ref appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.
/// Equivalent to entering "System Update" under System Settings. When leaving this, it returns to the main Home Menu.
Result libappletRequestJumpToSystemUpdate(void);
/**
* @brief Wrapper for \ref appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.
* @note Only available on [11.0.0+].
* @param[in] application_id ApplicationId
* @param[in] uid \ref AccountUid
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size.
* @param[in] sender LaunchApplicationRequestSender
*/
Result libappletRequestToLaunchApplication(u64 application_id, AccountUid uid, const void* buffer, size_t size, u32 sender);
/**
* @brief Wrapper for \ref appletPushToGeneralChannel, see appletPushToGeneralChannel regarding the requirements for using this.
* @note Only available on [11.0.0+].
* @param[in] uid \ref AccountUid
* @param[in] application_id Optional ApplicationId, can be 0.
*/
Result libappletRequestJumpToStory(AccountUid uid, u64 application_id);

View File

@ -0,0 +1,101 @@
/**
* @file mii_la.h
* @brief Wrapper for using the MiiEdit LibraryApplet.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/mii.h"
/// AppletMode
typedef enum {
MiiLaAppletMode_ShowMiiEdit = 0, ///< ShowMiiEdit
MiiLaAppletMode_AppendMii = 1, ///< AppendMii
MiiLaAppletMode_AppendMiiImage = 2, ///< AppendMiiImage
MiiLaAppletMode_UpdateMiiImage = 3, ///< UpdateMiiImage
MiiLaAppletMode_CreateMii = 4, ///< [10.2.0+] CreateMii
MiiLaAppletMode_EditMii = 5, ///< [10.2.0+] EditMii
} MiiLaAppletMode;
/// AppletInput
typedef struct {
s32 version; ///< Version
u32 mode; ///< \ref MiiLaAppletMode
s32 special_key_code; ///< \ref MiiSpecialKeyCode
union {
Uuid valid_uuid_array[8]; ///< ValidUuidArray. Only used with \ref MiiLaAppletMode ::NfpLaMiiLaAppletMode_AppendMiiImage / ::NfpLaMiiLaAppletMode_UpdateMiiImage.
struct {
MiiCharInfo char_info; ///< \ref MiiCharInfo
u8 unused_x64[0x28]; ///< Unused
} char_info;
};
Uuid used_uuid; ///< UsedUuid. Only used with \ref MiiLaAppletMode ::NfpLaMiiLaAppletMode_UpdateMiiImage.
u8 unk_x9C[0x64]; ///< Unused
} MiiLaAppletInput;
/// AppletOutput
typedef struct {
u32 res; ///< Result: 0 = Success, 1 = Cancel.
s32 index; ///< Index. Only set when Result is Success, where \ref MiiLaAppletMode isn't ::NfpLaMiiLaAppletMode_ShowMiiEdit.
u8 unk_x8[0x18]; ///< Unused
} MiiLaAppletOutput;
/// AppletOutputForCharInfoEditing
typedef struct {
u32 res; ///< MiiLaAppletOutput::res
MiiCharInfo char_info; ///< \ref MiiCharInfo
u8 unused[0x24]; ///< Unused
} MiiLaAppletOutputForCharInfoEditing;
/**
* @brief Launches the applet for ShowMiiEdit.
* @param[in] special_key_code \ref MiiSpecialKeyCode
*/
Result miiLaShowMiiEdit(MiiSpecialKeyCode special_key_code);
/**
* @brief Launches the applet for AppendMii.
* @param[in] special_key_code \ref MiiSpecialKeyCode
* @param[out] index Output Index.
*/
Result miiLaAppendMii(MiiSpecialKeyCode special_key_code, s32 *index);
/**
* @brief Launches the applet for AppendMiiImage.
* @param[in] special_key_code \ref MiiSpecialKeyCode
* @param[in] valid_uuid_array Input array of Uuid.
* @param[in] count Total entries for the valid_uuid_array. Must be 0-8.
* @param[out] index Output Index.
*/
Result miiLaAppendMiiImage(MiiSpecialKeyCode special_key_code, const Uuid *valid_uuid_array, s32 count, s32 *index);
/**
* @brief Launches the applet for UpdateMiiImage.
* @param[in] special_key_code \ref MiiSpecialKeyCode
* @param[in] valid_uuid_array Input array of Uuid.
* @param[in] count Total entries for the valid_uuid_array. Must be 0-8.
* @param[in] used_uuid UsedUuid
* @param[out] index Output Index.
*/
Result miiLaUpdateMiiImage(MiiSpecialKeyCode special_key_code, const Uuid *valid_uuid_array, s32 count, Uuid used_uuid, s32 *index);
/**
* @brief Launches the applet for CreateMii.
* @note This creates a Mii and returns it, without saving it in the database.
* @note Only available on [10.2.0+].
* @param[in] special_key_code \ref MiiSpecialKeyCode
* @param[out] out_char \ref MiiCharInfo
*/
Result miiLaCreateMii(MiiSpecialKeyCode special_key_code, MiiCharInfo *out_char);
/**
* @brief Launches the applet for EditMii.
* @note This edits the specified Mii and returns it, without saving it in the database.
* @note Only available on [10.2.0+].
* @param[in] special_key_code \ref MiiSpecialKeyCode
* @param[in] in_char \ref MiiCharInfo
* @param[out] out_char \ref MiiCharInfo
*/
Result miiLaEditMii(MiiSpecialKeyCode special_key_code, const MiiCharInfo *in_char, MiiCharInfo *out_char);

View File

@ -0,0 +1,89 @@
/**
* @file nfp_la.h
* @brief Wrapper for using the cabinet (amiibo) LibraryApplet.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/nfc.h"
/// Values for NfpLaStartParamForAmiiboSettings::type.
typedef enum {
NfpLaStartParamTypeForAmiiboSettings_NicknameAndOwnerSettings = 0, ///< NicknameAndOwnerSettings
NfpLaStartParamTypeForAmiiboSettings_GameDataEraser = 1, ///< GameDataEraser
NfpLaStartParamTypeForAmiiboSettings_Restorer = 2, ///< Restorer
NfpLaStartParamTypeForAmiiboSettings_Formatter = 3, ///< Formatter
} NfpLaStartParamTypeForAmiiboSettings;
/// AmiiboSettingsStartParam
typedef struct {
u8 unk_x0[0x8]; ///< Unknown
u8 unk_x8[0x20]; ///< Unknown
u8 unk_x28; ///< Unknown
} NfpLaAmiiboSettingsStartParam;
/// StartParamForAmiiboSettings
typedef struct {
u8 unk_x0; ///< Unknown
u8 type; ///< \ref NfpLaStartParamTypeForAmiiboSettings
u8 flags; ///< Flags
u8 unk_x3; ///< NfpLaAmiiboSettingsStartParam::unk_x28
u8 unk_x4[0x8]; ///< NfpLaAmiiboSettingsStartParam::unk_x0
NfpTagInfo tag_info; ///< \ref NfpTagInfo, only enabled when flags bit1 is set.
NfpRegisterInfo register_info; ///< \ref NfpRegisterInfo, only enabled when flags bit2 is set.
u8 unk_x164[0x20]; ///< NfpLaAmiiboSettingsStartParam::unk_x8
u8 unk_x184[0x24]; ///< Unknown
} NfpLaStartParamForAmiiboSettings;
/// ReturnValueForAmiiboSettings
typedef struct {
u8 flags; ///< 0 = error, non-zero = success.
u8 pad[3]; ///< Padding
NfcDeviceHandle handle; ///< \ref NfcDeviceHandle
NfpTagInfo tag_info; ///< \ref NfpTagInfo
NfpRegisterInfo register_info; ///< \ref NfpRegisterInfo, only available when flags bit2 is set.
u8 unk_x164[0x24]; ///< Unknown
} NfpLaReturnValueForAmiiboSettings;
/**
* @brief Launches the applet for NicknameAndOwnerSettings.
* @note Official sw does not expose functionality for using input/output \ref NfpTagInfo at the same time.
* @param[in] in_param \ref NfpLaAmiiboSettingsStartParam
* @param[in] in_tag_info \ref NfpTagInfo. Optional, can be NULL. If specified, this must match the scanned amiibo.
* @param[in] in_reg_info \ref NfpRegisterInfo. Optional, can be NULL. If specified, this sets the \ref NfpRegisterInfo which will be used for writing, with an option for the user to change it.
* @param[out] out_tag_info \ref NfpTagInfo. Optional, can be NULL.
* @param[out] handle \ref NfcDeviceHandle
* @param[out] reg_info_flag Flag indicating whether the data for out_reg_info is set. Optional, can be NULL.
* @param[out] out_reg_info \ref NfpRegisterInfo, see reg_info_flag. Optional, can be NULL.
*/
Result nfpLaStartNicknameAndOwnerSettings(const NfpLaAmiiboSettingsStartParam *in_param, const NfpTagInfo *in_tag_info, const NfpRegisterInfo *in_reg_info, NfpTagInfo *out_tag_info, NfcDeviceHandle *handle, bool *reg_info_flag, NfpRegisterInfo *out_reg_info);
/**
* @brief Launches the applet for GameDataEraser.
* @note Official sw does not expose functionality for using input/output \ref NfpTagInfo at the same time.
* @param[in] in_param \ref NfpLaAmiiboSettingsStartParam
* @param[in] in_tag_info \ref NfpTagInfo. Optional, can be NULL. If specified, this must match the scanned amiibo.
* @param[out] out_tag_info \ref NfpTagInfo. Optional, can be NULL.
* @param[out] handle \ref NfcDeviceHandle
*/
Result nfpLaStartGameDataEraser(const NfpLaAmiiboSettingsStartParam *in_param, const NfpTagInfo *in_tag_info, NfpTagInfo *out_tag_info, NfcDeviceHandle *handle);
/**
* @brief Launches the applet for Restorer.
* @note Official sw does not expose functionality for using input/output \ref NfpTagInfo at the same time.
* @param[in] in_param \ref NfpLaAmiiboSettingsStartParam
* @param[in] in_tag_info \ref NfpTagInfo. Optional, can be NULL. If specified, this must match the scanned amiibo.
* @param[out] out_tag_info \ref NfpTagInfo. Optional, can be NULL.
* @param[out] handle \ref NfcDeviceHandle
*/
Result nfpLaStartRestorer(const NfpLaAmiiboSettingsStartParam *in_param, const NfpTagInfo *in_tag_info, NfpTagInfo *out_tag_info, NfcDeviceHandle *handle);
/**
* @brief Launches the applet for Formatter.
* @param[in] in_param \ref NfpLaAmiiboSettingsStartParam
* @param[out] out_tag_info \ref NfpTagInfo
* @param[out] handle \ref NfcDeviceHandle
*/
Result nfpLaStartFormatter(const NfpLaAmiiboSettingsStartParam *in_param, NfpTagInfo *out_tag_info, NfcDeviceHandle *handle);

View File

@ -0,0 +1,16 @@
/**
* @file nifm_la.h
* @brief Wrapper for using the nifm LibraryApplet (the launched applet varies).
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/nifm.h"
/**
* @brief Uses \ref nifmGetResult, then on failure launches the applet.
* @param r \ref NifmRequest
*/
Result nifmLaHandleNetworkRequestResult(NifmRequest* r);

View File

@ -0,0 +1,58 @@
/**
* @file pctlauth.h
* @brief Wrapper for using the Parental Controls authentication LibraryApplet. This applet is used by qlaunch.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/// Type values for PctlAuthArg::type.
typedef enum {
PctlAuthType_Show = 0, ///< ShowParentalAuthentication
PctlAuthType_RegisterPasscode = 1, ///< RegisterParentalPasscode
PctlAuthType_ChangePasscode = 2, ///< ChangeParentalPasscode
} PctlAuthType;
/// Input arg storage for the applet.
typedef struct {
u32 unk_x0; ///< Always set to 0 by the user-process.
PctlAuthType type; ///< \ref PctlAuthType
u8 arg0; ///< Arg0
u8 arg1; ///< Arg1
u8 arg2; ///< Arg2
u8 pad; ///< Padding
} PctlAuthArg;
/**
* @brief Launches the applet.
* @note Should not be used if a PIN is not already registered. See \ref pctlIsRestrictionEnabled.
* @param flag Input flag. false = temporarily disable Parental Controls. true = validate the input PIN.
*/
Result pctlauthShow(bool flag);
/**
* @brief Launches the applet. Only available with [4.0.0+].
* @param arg0 Value for PctlAuthArg.arg0.
* @param arg1 Value for PctlAuthArg.arg1.
* @param arg2 Value for PctlAuthArg.arg2.
*/
Result pctlauthShowEx(u8 arg0, u8 arg1, u8 arg2);
/**
* @brief Just calls: pctlauthShowEx(1, 0, 1). Launches the applet for checking the PIN, used when changing system-settings.
* @note Should not be used if a PIN is not already registered. See \ref pctlIsRestrictionEnabled.
*/
Result pctlauthShowForConfiguration(void);
/**
* @brief Launches the applet for registering the Parental Controls PIN.
*/
Result pctlauthRegisterPasscode(void);
/**
* @brief Launches the applet for changing the Parental Controls PIN.
* @note Should not be used if a PIN is not already registered. See \ref pctlIsRestrictionEnabled.
*/
Result pctlauthChangePasscode(void);

View File

@ -0,0 +1,210 @@
/**
* @file psel.h
* @brief Wrapper for using the playerSelect (user selection) LibraryApplet.
* @author XorTroll, yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/acc.h"
/// playerSelect UI modes.
typedef enum {
PselUiMode_UserSelector = 0, ///< UserSelector
PselUiMode_UserCreator = 1, ///< UserCreator
PselUiMode_EnsureNetworkServiceAccountAvailable = 2, ///< EnsureNetworkServiceAccountAvailable
PselUiMode_UserIconEditor = 3, ///< UserIconEditor
PselUiMode_UserNicknameEditor = 4, ///< UserNicknameEditor
PselUiMode_UserCreatorForStarter = 5, ///< UserCreatorForStarter
PselUiMode_NintendoAccountAuthorizationRequestContext = 6, ///< NintendoAccountAuthorizationRequestContext
PselUiMode_IntroduceExternalNetworkServiceAccount = 7, ///< IntroduceExternalNetworkServiceAccount
PselUiMode_IntroduceExternalNetworkServiceAccountForRegistration = 8, ///< [6.0.0+] IntroduceExternalNetworkServiceAccountForRegistration
PselUiMode_NintendoAccountNnidLinker = 9, ///< [6.0.0+] NintendoAccountNnidLinker
PselUiMode_LicenseRequirementsForNetworkService = 10, ///< [6.0.0+] LicenseRequirementsForNetworkService
PselUiMode_LicenseRequirementsForNetworkServiceWithUserContextImpl = 11, ///< [7.0.0+] LicenseRequirementsForNetworkServiceWithUserContextImpl
PselUiMode_UserCreatorForImmediateNaLoginTest = 12, ///< [7.0.0+] UserCreatorForImmediateNaLoginTest
PselUiMode_UserQualificationPromoter = 13, ///< [13.0.0+] UserQualificationPromoter
} PselUiMode;
/// UI message text to display with ::PselUiMode_UserSelector. Invalid values are handled as ::PselUserSelectionPurpose_General.
typedef enum {
PselUserSelectionPurpose_General = 0, ///< "Select a user."
PselUserSelectionPurpose_GameCardRegistration = 1, ///< [2.0.0+] "Who will receive the points?"
PselUserSelectionPurpose_EShopLaunch = 2, ///< [2.0.0+] "Who is using Nintendo eShop?"
PselUserSelectionPurpose_EShopItemShow = 3, ///< [2.0.0+] "Who is making this purchase?"
PselUserSelectionPurpose_PicturePost = 4, ///< [2.0.0+] "Who is posting?"
PselUserSelectionPurpose_NintendoAccountLinkage = 5, ///< [2.0.0+] "Select a user to link to a Nintendo Account."
PselUserSelectionPurpose_SettingsUpdate = 6, ///< [2.0.0+] "Change settings for which user?"
PselUserSelectionPurpose_SaveDataDeletion = 7, ///< [2.0.0+] "Format data for which user?"
PselUserSelectionPurpose_UserMigration = 8, ///< [4.0.0+] "Which user will be transferred to another console?"
PselUserSelectionPurpose_SaveDataTransfer = 9, ///< [8.0.0+] "Send save data for which user?"
} PselUserSelectionPurpose;
/// NintendoAccountStartupDialogType
typedef enum {
PselNintendoAccountStartupDialogType_LoginAndCreate = 0, ///< LoginAndCreate
PselNintendoAccountStartupDialogType_Login = 1, ///< Login
PselNintendoAccountStartupDialogType_Create = 2, ///< Create
} PselNintendoAccountStartupDialogType;
/// Base UI settings for playerSelect.
typedef struct {
u32 mode; ///< \ref PselUiMode
u32 pad; ///< Padding.
AccountUid invalid_uid_list[ACC_USER_LIST_SIZE]; ///< List of \ref AccountUid. TODO: This is only correct for ::PselUiMode_UserSelector, for other modes this is a single uid, followed by mode-specific data (if any).
u64 application_id; ///< ApplicationId with \ref pselShowUserSelectorForLauncher.
u8 is_network_service_account_required; ///< PselUserSelectionSettings::is_network_service_account_required.
u8 is_skip_enabled; ///< PselUserSelectionSettings::is_skip_enabled
u8 unk_x92; ///< Set to value 1 by \ref pselShowUserSelectorForSystem / \ref pselShowUserSelectorForLauncher.
u8 is_permitted; ///< isPermitted. With ::PselUiMode_UserSelector: enables the option to create a new user. Set to the output from \ref accountIsUserRegistrationRequestPermitted with pselShowUserSelector*. When not set, a dialog will be displayed when the user attempts to create an user.
u8 show_skip_button; ///< PselUserSelectionSettings::show_skip_button
u8 additional_select; ///< PselUserSelectionSettings::additional_select
u8 unk_x96; ///< [2.0.0+] Set to PselUserSelectionSettingsForSystemService::enable_user_creation_button. \ref pselShowUserSelectorForLauncher / \ref pselShowUserSelector sets this to value 1.
u8 unk_x97; ///< [6.0.0+] Set to PselUserSelectionSettings::is_unqualified_user_selectable ^ 1.
} PselUiSettingsV1;
/// UI settings for versions starting with 0x10000.
typedef struct {
PselUiSettingsV1 settings; ///< \ref PselUiSettingsV1
u32 unk_x98; ///< [2.0.0+] Set to PselUserSelectionSettingsForSystemService::purpose.
u8 unk_x9c[0x4]; ///< Unknown.
} PselUiSettings;
/// UserSelectionSettings
typedef struct {
AccountUid invalid_uid_list[ACC_USER_LIST_SIZE]; ///< invalidUidList.
u8 is_skip_enabled; ///< isSkipEnabled. When set, the first user in invalid_uid_list must not be set, and additional_select must be 0. When enabled \ref accountTrySelectUserWithoutInteraction will be used to select the user, in this case the applet will only be launched if \ref accountTrySelectUserWithoutInteraction doesn't return an user.
u8 is_network_service_account_required; ///< isNetworkServiceAccountRequired. Whether the user needs to be linked to a Nintendo account.
u8 show_skip_button; ///< showSkipButton. Enables the option to skip user selection with a button.
u8 additional_select; ///< additionalSelect.
u8 is_unqualified_user_selectable; ///< [6.0.0+] isUnqualifiedUserSelectable
} PselUserSelectionSettings;
/// [2.0.0+] UserSelectionSettingsForSystemService
typedef struct {
u32 purpose; ///< \ref PselUserSelectionPurpose
u8 enable_user_creation_button; ///< Enables the user-creation button when set. Whether user-creation when pressing the button is actually allowed is controlled by PselUiSettingsV1::is_permitted.
u8 pad[0x3]; ///< Padding.
} PselUserSelectionSettingsForSystemService;
/// Return data sent after execution.
typedef struct {
Result res; ///< Result.
AccountUid user_id; ///< Selected \ref AccountUid.
} PselUiReturnArg;
/**
* @brief Creates a new UI config for the playerSelect applet with the specified mode.
* @param ui PseluiSettings struct.
* @param mode playerSelect UI mode.
*/
Result pselUiCreate(PselUiSettings *ui, PselUiMode mode);
/**
* @brief Adds an user to the user list of the applet.
* @param ui PselUiSettings struct.
* @param[in] user_id user ID.
* @note The users will be treated as invalid users for user selection mode, and as the input user for other modes.
*/
void pselUiAddUser(PselUiSettings *ui, AccountUid user_id);
/**
* @brief Sets whether users can be created in the applet.
* @param ui PselUiSettings struct.
* @param flag Flag value.
* @note Only used for ::PselUiMode_SelectUser.
*/
NX_CONSTEXPR void pselUiSetAllowUserCreation(PselUiSettings *ui, bool flag) {
if(ui->settings.mode == PselUiMode_UserSelector) {
ui->settings.is_permitted = flag!=0;
}
}
/**
* @brief Sets whether users need to be linked to a Nintendo account.
* @param ui PselUiSettings struct.
* @param flag Flag value.
*/
NX_CONSTEXPR void pselUiSetNetworkServiceRequired(PselUiSettings *ui, bool flag) {
ui->settings.is_network_service_account_required = flag;
}
/**
* @brief Sets whether selection can be skipped with a button.
* @param ui PselUiSettings struct.
* @param flag Flag value.
*/
NX_CONSTEXPR void pselUiSetSkipButtonEnabled(PselUiSettings *ui, bool flag) {
ui->settings.show_skip_button = flag!=0;
}
/**
* @brief Shows the applet with the specified UI settings.
* @param ui PselUiSettings struct.
* @param out_user Selected user ID.
* @note If user skips (see \ref pselUiSetSkipEnabled) this will return successfully but the output ID will be 0.
*/
Result pselUiShow(PselUiSettings *ui, AccountUid *out_user);
/**
* @brief This is the System version of \ref pselShowUserSelector.
* @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. See also the docs for PselUserSelectionSettings::is_skip_enabled.
* @param[out] out_user Returned selected user ID.
* @param[in] settings \ref PselUserSelectionSettings
* @param[in] settings_system [2.0.0+] \ref PselUserSelectionSettingsForSystemService, ignored on prior versions.
*/
Result pselShowUserSelectorForSystem(AccountUid *out_user, const PselUserSelectionSettings *settings, const PselUserSelectionSettingsForSystemService *settings_system);
/**
* @brief This is the Launcher version of \ref pselShowUserSelector.
* @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. See also the docs for PselUserSelectionSettings::is_skip_enabled.
* @param[out] out_user Returned selected user ID.
* @param[in] settings \ref PselUserSelectionSettings
* @param[in] application_id ApplicationId
*/
Result pselShowUserSelectorForLauncher(AccountUid *out_user, const PselUserSelectionSettings *settings, u64 application_id);
/**
* @brief Shows the applet to select a user.
* @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. See also the docs for PselUserSelectionSettings::is_skip_enabled.
* @param[out] out_user Returned selected user ID.
* @param[in] settings \ref PselUserSelectionSettings
*/
Result pselShowUserSelector(AccountUid *out_user, const PselUserSelectionSettings *settings);
/**
* @brief Shows the applet to create a user.
* @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. If the output flag is 0, an error will be thrown.
*/
Result pselShowUserCreator(void);
/**
* @brief Shows the applet to change a user's icon.
* @param[in] user Input user ID.
*/
Result pselShowUserIconEditor(AccountUid user);
/**
* @brief Shows the applet to change a user's nickname.
* @param[in] user Input user ID.
*/
Result pselShowUserNicknameEditor(AccountUid user);
/**
* @brief Shows the applet to create a user. Used by the starter applet during system setup.
*/
Result pselShowUserCreatorForStarter(void);
/**
* @brief Shows the applet for Nintendo Account Nnid linking.
* @note Only available on [6.0.0+].
* @param[in] user Input user ID.
*/
Result pselShowNintendoAccountNnidLinker(AccountUid user);
/**
* @brief Shows the applet for UserQualificationPromoter.
* @note Only available on [13.0.0+].
* @param[in] user Input user ID.
*/
Result pselShowUserQualificationPromoter(AccountUid user);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,862 @@
/**
* @file web.h
* @brief Wrapper for using the web LibraryApplets. See also: https://switchbrew.org/wiki/Internet_Browser
* @author p-sam, yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/applet.h"
#include "../services/caps.h"
#include "../services/acc.h"
#include "../kernel/mutex.h"
/// This indicates the type of web-applet.
typedef enum {
WebShimKind_Shop = 1,
WebShimKind_Login = 2,
WebShimKind_Offline = 3,
WebShimKind_Share = 4,
WebShimKind_Web = 5,
WebShimKind_Wifi = 6,
WebShimKind_Lobby = 7,
} WebShimKind;
/// ExitReason
typedef enum {
WebExitReason_ExitButton = 0x0, ///< User pressed the X button to exit.
WebExitReason_BackButton = 0x1, ///< User pressed the B button to exit, on the initial page.
WebExitReason_Requested = 0x2, ///< The applet exited since \ref webConfigRequestExit was used.
WebExitReason_LastUrl = 0x3, ///< The applet exited due to LastUrl handling, see \ref webReplyGetLastUrl.
WebExitReason_ErrorDialog = 0x7, ///< The applet exited after displaying an error dialog.
WebExitReason_UnknownE = 0xE, ///< Unknown
} WebExitReason;
/// Button values for \ref webConfigSetBootFooterButtonVisible.
typedef enum {
WebFooterButtonId_None = 0, ///< None, for empty \ref WebBootFooterButtonEntry. Invalid for \ref webConfigSetBootFooterButtonVisible input.
WebFooterButtonId_Type1 = 1, ///< Unknown button Id 1.
WebFooterButtonId_Type2 = 2, ///< Unknown button Id 2.
WebFooterButtonId_Type3 = 3, ///< Unknown button Id 3.
WebFooterButtonId_Type4 = 4, ///< Unknown button Id 4.
WebFooterButtonId_Type5 = 5, ///< Unknown button Id 5.
WebFooterButtonId_Type6 = 6, ///< Unknown button Id 6.
WebFooterButtonId_Max, ///< Values starting with this are invalid.
} WebFooterButtonId;
/// WebSessionBootMode
typedef enum {
WebSessionBootMode_AllForeground = 0, ///< AllForeground. This is the default.
WebSessionBootMode_AllForegroundInitiallyHidden = 1, ///< AllForegroundInitiallyHidden
} WebSessionBootMode;
/// WebSessionSendMessageKind
typedef enum {
WebSessionSendMessageKind_BrowserEngineContent = 0x0, ///< BrowserEngine Content
WebSessionSendMessageKind_SystemMessageAppear = 0x100, ///< SystemMessage Appear
WebSessionSendMessageKind_Ack = 0x1000, ///< Ack
} WebSessionSendMessageKind;
/// WebSessionReceiveMessageKind
typedef enum {
WebSessionReceiveMessageKind_BrowserEngineContent = 0x0, ///< BrowserEngine Content
WebSessionReceiveMessageKind_AckBrowserEngine = 0x1000, ///< Ack BrowserEngine
WebSessionReceiveMessageKind_AckSystemMessage = 0x1001, ///< Ack SystemMessage
} WebSessionReceiveMessageKind;
/// Struct for the WebWifi applet input storage.
typedef struct {
u32 unk_x0; ///< Official sw sets this to 0 with appletStorageWrite, separately from the rest of the config struct.
char conntest_url[0x100]; ///< Connection-test URL.
char initial_url[0x400]; ///< Initial URL navigated to by the applet.
Uuid uuid; ///< NIFM Network UUID. Only used by the applet when conntest_url is set.
u32 rev; ///< Input value for nifm cmd SetRequirementByRevision. Only used by the applet when conntest_url is set.
} WebWifiPageArg;
/// Struct for the WebWifi applet output storage.
typedef struct {
u32 unk_x0; ///< Unknown.
Result res; ///< Result
} WebWifiReturnValue;
/// Config for WebWifi.
typedef struct {
WebWifiPageArg arg; ///< Arg data.
} WebWifiConfig;
/// TLV storage, starts with \ref WebArgHeader followed by \ref WebArgTLV entries.
typedef struct {
u8 data[0x2000]; ///< Raw TLV data storage.
} WebCommonTLVStorage;
/// Common struct for the applet output storage, for non-TLV-storage.
typedef struct {
WebExitReason exitReason; ///< ExitReason
u32 pad; ///< Padding
char lastUrl[0x1000]; ///< LastUrl string
u64 lastUrlSize; ///< Size of LastUrl, including NUL-terminator.
} NX_PACKED WebCommonReturnValue;
/// Header struct at offset 0 in the web Arg storage (non-webWifi).
typedef struct {
u16 total_entries; ///< Total \ref WebArgTLV entries following this struct.
u16 pad; ///< Padding
WebShimKind shimKind; ///< ShimKind
} NX_PACKED WebArgHeader;
/// Web TLV used in the web Arg storage.
typedef struct {
u16 type; ///< Type of this arg.
u16 size; ///< Size of the arg data following this struct.
u8 pad[4]; ///< Padding
} NX_PACKED WebArgTLV;
/// Config struct for web applets, non-WebWifi.
typedef struct {
WebCommonTLVStorage arg; ///< TLV storage.
AppletId appletid; ///< AppletId
u32 version; ///< CommonArgs applet version.
AppletHolder holder; ///< AppletHolder
} WebCommonConfig;
/// Common container struct for applets' reply data, from the output storage.
typedef struct {
bool type; ///< Type of reply: false = ret, true = storage.
WebShimKind shimKind; ///< ShimKind
WebCommonReturnValue ret; ///< Reply data for reply=false.
WebCommonTLVStorage storage; ///< Reply data for reply=true.
} WebCommonReply;
/// Entry data for ::WebArgType_BootFooterButton.
typedef struct {
WebFooterButtonId id;
u8 visible;
u16 unk_x5;
u8 unk_x7;
} NX_PACKED WebBootFooterButtonEntry;
/// StorageHandleQueue
typedef struct {
s32 read_pos;
s32 write_pos;
s32 max_storages;
bool is_full;
AppletStorage storages[0x10];
} WebSessionStorageHandleQueue;
/// WebSession
typedef struct {
Mutex mutex;
WebCommonConfig *config;
struct {
u32 count;
u32 cur_size;
} queue[2];
WebSessionStorageHandleQueue storage_queue;
} WebSession;
/// SessionMessageHeader
typedef struct {
u32 kind; ///< Message Kind (\ref WebSessionSendMessageKind / \ref WebSessionReceiveMessageKind)
u32 size; ///< Data size following the header.
u8 reserved[0x8]; ///< Unused
} WebSessionMessageHeader;
/// Types for \ref WebArgTLV, input storage.
typedef enum {
WebArgType_Url = 0x1, ///< [1.0.0+] String, size 0xC00. Initial URL.
WebArgType_CallbackUrl = 0x3, ///< [1.0.0+] String, size 0x400.
WebArgType_CallbackableUrl = 0x4, ///< [1.0.0+] String, size 0x400.
WebArgType_ApplicationId = 0x5, ///< [1.0.0+] Offline-applet, u64 ApplicationId
WebArgType_DocumentPath = 0x6, ///< [1.0.0+] Offline-applet, string with size 0xC00.
WebArgType_DocumentKind = 0x7, ///< [1.0.0+] Offline-applet, u32 enum \WebDocumentKind.
WebArgType_SystemDataId = 0x8, ///< [1.0.0+] Offline-applet, u64 SystemDataId
WebArgType_ShareStartPage = 0x9, ///< [1.0.0+] u32 enum \WebShareStartPage
WebArgType_Whitelist = 0xA, ///< [1.0.0+] String, size 0x1000.
WebArgType_NewsFlag = 0xB, ///< [1.0.0+] u8 bool
WebArgType_UnknownC = 0xC, ///< [1.0.0+] u8
WebArgType_UnknownD = 0xD, ///< [1.0.0+] u8
WebArgType_Uid = 0xE, ///< [1.0.0+] \ref AccountUid, controls which user-specific savedata to mount.
WebArgType_AlbumEntry0 = 0xF, ///< [1.0.0+] Share-applet caps AlbumEntry, entry 0.
WebArgType_ScreenShot = 0x10, ///< [1.0.0+] u8 bool
WebArgType_EcClientCert = 0x11, ///< [1.0.0+] u8 bool
WebArgType_Unknown12 = 0x12, ///< [1.0.0+] u8
WebArgType_PlayReport = 0x13, ///< [1.0.0+] u8 bool
WebArgType_Unknown14 = 0x14, ///< [1.0.0+] u8
WebArgType_Unknown15 = 0x15, ///< [1.0.0+] u8
WebArgType_BootDisplayKind = 0x17, ///< [1.0.0+] u32 enum \ref WebBootDisplayKind
WebArgType_BackgroundKind = 0x18, ///< [1.0.0+] u32 enum \ref WebBackgroundKind
WebArgType_Footer = 0x19, ///< [1.0.0+] u8 bool
WebArgType_Pointer = 0x1A, ///< [1.0.0+] u8 bool
WebArgType_LeftStickMode = 0x1B, ///< [1.0.0+] u32 enum \ref WebLeftStickMode
WebArgType_KeyRepeatFrame0 = 0x1C, ///< [1.0.0+] s32 KeyRepeatFrame, first param
WebArgType_KeyRepeatFrame1 = 0x1D, ///< [1.0.0+] s32 KeyRepeatFrame, second param
WebArgType_BootAsMediaPlayerInverted = 0x1E, ///< [1.0.0+] u8 bool. With News on [3.0.0+] this is set after BootAsMediaPlayer with the value inverted.
WebArgType_DisplayUrlKind = 0x1F, ///< [1.0.0+] u8 bool, DisplayUrlKind (value = (input_enumval==0x1)).
WebArgType_BootAsMediaPlayer = 0x21, ///< [2.0.0+] u8 bool
WebArgType_ShopJump = 0x22, ///< [2.0.0+] u8 bool
WebArgType_MediaPlayerUserGestureRestriction = 0x23, ///< [2.0.0-5.1.0] u8 bool
WebArgType_MediaAutoPlay = 0x23, ///< [6.0.0+] u8 bool
WebArgType_LobbyParameter = 0x24, ///< [2.0.0+] String, size 0x100.
WebArgType_ApplicationAlbumEntry = 0x26, ///< [3.0.0+] Share-applet caps ApplicationAlbumEntry
WebArgType_JsExtension = 0x27, ///< [3.0.0+] u8 bool
WebArgType_AdditionalCommentText = 0x28, ///< [4.0.0+] String, size 0x100. Share-applet AdditionalCommentText.
WebArgType_TouchEnabledOnContents = 0x29, ///< [4.0.0+] u8 bool
WebArgType_UserAgentAdditionalString = 0x2A, ///< [4.0.0+] String, size 0x80.
WebArgType_AdditionalMediaData0 = 0x2B, ///< [4.0.0+] Share-applet 0x10-byte u8 array, AdditionalMediaData. Entry 0. If the user-input size is less than 0x10, the remaining data used for the TLV is cleared.
WebArgType_MediaPlayerAutoClose = 0x2C, ///< [4.0.0+] u8 bool
WebArgType_PageCache = 0x2D, ///< [4.0.0+] u8 bool
WebArgType_WebAudio = 0x2E, ///< [4.0.0+] u8 bool
WebArgType_2F = 0x2F, ///< [5.0.0+] u8
WebArgType_YouTubeVideoFlag = 0x31, ///< [5.0.0+] u8 bool Indicates that the built-in whitelist for YouTubeVideo should be used.
WebArgType_FooterFixedKind = 0x32, ///< [5.0.0+] u32 enum \ref WebFooterFixedKind
WebArgType_PageFade = 0x33, ///< [5.0.0+] u8 bool
WebArgType_MediaCreatorApplicationRatingAge = 0x34, ///< [5.0.0+] Share-applet 0x20-byte s8 array, MediaCreatorApplicationRatingAge.
WebArgType_BootLoadingIcon = 0x35, ///< [5.0.0+] u8 bool
WebArgType_PageScrollIndicator = 0x36, ///< [5.0.0+] u8 bool
WebArgType_MediaPlayerSpeedControl = 0x37, ///< [6.0.0+] u8 bool
WebArgType_AlbumEntry1 = 0x38, ///< [6.0.0+] Share-applet caps AlbumEntry, entry 1.
WebArgType_AlbumEntry2 = 0x39, ///< [6.0.0+] Share-applet caps AlbumEntry, entry 2.
WebArgType_AlbumEntry3 = 0x3A, ///< [6.0.0+] Share-applet caps AlbumEntry, entry 3.
WebArgType_AdditionalMediaData1 = 0x3B, ///< [6.0.0+] Share-applet 0x10-byte u8 array, AdditionalMediaData. Entry 1.
WebArgType_AdditionalMediaData2 = 0x3C, ///< [6.0.0+] Share-applet 0x10-byte u8 array, AdditionalMediaData. Entry 2.
WebArgType_AdditionalMediaData3 = 0x3D, ///< [6.0.0+] Share-applet 0x10-byte u8 array, AdditionalMediaData. Entry 3.
WebArgType_BootFooterButton = 0x3E, ///< [6.0.0+] Array of \ref WebBootFooterButtonEntry with 0x10 entries.
WebArgType_OverrideWebAudioVolume = 0x3F, ///< [6.0.0+] float
WebArgType_OverrideMediaAudioVolume = 0x40, ///< [6.0.0+] float
WebArgType_SessionBootMode = 0x41, ///< [7.0.0+] u32 enum \ref WebSessionBootMode
WebArgType_SessionFlag = 0x42, ///< [7.0.0+] u8 bool, enables using WebSession when set.
WebArgType_MediaPlayerUi = 0x43, ///< [8.0.0+] u8 bool
WebArgType_TransferMemory = 0x44, ///< [11.0.0+] u8 bool
} WebArgType;
/// Types for \ref WebArgTLV, output storage.
typedef enum {
WebReplyType_ExitReason = 0x1, ///< [3.0.0+] u32 ExitReason
WebReplyType_LastUrl = 0x2, ///< [3.0.0+] string
WebReplyType_LastUrlSize = 0x3, ///< [3.0.0+] u64
WebReplyType_SharePostResult = 0x4, ///< [3.0.0+] u32 SharePostResult
WebReplyType_PostServiceName = 0x5, ///< [3.0.0+] string
WebReplyType_PostServiceNameSize = 0x6, ///< [3.0.0+] u64
WebReplyType_PostId = 0x7, ///< [3.0.0+] string
WebReplyType_PostIdSize = 0x8, ///< [3.0.0+] u64
WebReplyType_MediaPlayerAutoClosedByCompletion = 0x9, ///< [8.0.0+] u8 bool
} WebReplyType;
/// This controls the kind of content to mount with Offline-applet.
typedef enum {
WebDocumentKind_OfflineHtmlPage = 0x1, ///< Use the HtmlDocument NCA content from the application.
WebDocumentKind_ApplicationLegalInformation = 0x2, ///< Use the LegalInformation NCA content from the application.
WebDocumentKind_SystemDataPage = 0x3, ///< Use the Data NCA content from the specified SystemData, see also: https://switchbrew.org/wiki/Title_list#System_Data_Archives
} WebDocumentKind;
/// This controls the initial page for ShareApplet, used by \ref webShareCreate.
typedef enum {
WebShareStartPage_Default = 0, ///< The default "/" page.
WebShareStartPage_Settings = 1, ///< The "/settings/" page.
} WebShareStartPage;
/// Kind values for \ref webConfigSetBootDisplayKind. Controls the background color while displaying the loading screen during applet boot. Also controls the BackgroundKind when value is non-zero.
typedef enum {
WebBootDisplayKind_Default = 0, ///< Default. BackgroundKind is controlled by \ref WebBackgroundKind.
WebBootDisplayKind_White = 1, ///< White background. Used by \ref webOfflineCreate for docKind ::WebDocumentKind_ApplicationLegalInformation/::WebDocumentKind_SystemDataPage.
WebBootDisplayKind_Black = 2, ///< Black background.
WebBootDisplayKind_Unknown3 = 3, ///< Unknown. Used by \ref webShareCreate.
WebBootDisplayKind_Unknown4 = 4, ///< Unknown. Used by \ref webLobbyCreate.
} WebBootDisplayKind;
/// Kind values for \ref webConfigSetBackgroundKind. Controls the background color while displaying the loading screen during applet boot. Only used when \ref WebBootDisplayKind is ::WebBootDisplayKind_Default. If the applet was not launched by an Application, the applet will only use WebBackgroundKind_Default.
typedef enum {
WebBackgroundKind_Default = 0, ///< Default. Same as ::WebBootDisplayKind_White/::WebBootDisplayKind_Black, determined via ::WebArgType_BootAsMediaPlayer.
WebBackgroundKind_Unknown1 = 1, ///< Unknown. Same as ::WebBootDisplayKind_Unknown3.
WebBackgroundKind_Unknown2 = 2, ///< Unknown. Same as ::WebBootDisplayKind_Unknown4. Used by \ref webLobbyCreate.
} WebBackgroundKind;
/// Mode values for \ref webConfigSetLeftStickMode. Controls the initial mode, this can be toggled by the user via the pressing the left-stick button. If the Pointer flag is set to false (\ref webConfigSetPointer), only ::WebLeftStickMode_Cursor will be used and mode toggle by the user is disabled (input value ignored).
typedef enum {
WebLeftStickMode_Pointer = 0, ///< The user can directly control the pointer via the left-stick.
WebLeftStickMode_Cursor = 1, ///< The user can only select elements on the page via the left-stick.
} WebLeftStickMode;
/// Kind values for \ref webConfigSetFooterFixedKind. Controls UI footer display behaviour.
typedef enum {
WebFooterFixedKind_Default = 0, ///< Default. Footer is hidden while scrolling.
WebFooterFixedKind_Always = 1, ///< Footer is always displayed regardless of scrolling.
WebFooterFixedKind_Hidden = 2, ///< Footer is hidden regardless of scrolling.
} WebFooterFixedKind;
/**
* @brief Creates the config for WifiWebAuthApplet. This is the captive portal applet.
* @param config WebWifiConfig object.
* @param conntest_url URL used for the connection-test requests. When empty/NULL the applet will test the connection with nifm and throw an error on failure.
* @param initial_url Initial URL navigated to by the applet.
* @param uuid NIFM Network UUID, for nifm cmd SetNetworkProfileId. Value 0 can be used. Only used by the applet when conntest_url is set.
* @param rev Input value for nifm cmd SetRequirementByRevision. Value 0 can be used. Only used by the applet when conntest_url is set.
*/
void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, Uuid uuid, u32 rev);
/**
* @brief Launches WifiWebAuthApplet with the specified config and waits for it to exit.
* @param config WebWifiConfig object.
* @param out Optional output applet reply data, can be NULL.
*/
Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out);
/**
* @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host Application, which is only loaded when running under an Application.
* @note Sets ::WebArgType_UnknownD, and ::WebArgType_Unknown12 on pre-3.0.0, to value 1.
* @param config WebCommonConfig object.
* @param url Initial URL navigated to by the applet.
*/
Result webPageCreate(WebCommonConfig* config, const char* url);
/**
* @brief Creates the config for WebApplet. This is based on \ref webPageCreate, for News. Hence other functions referencing \ref webPageCreate also apply to this.
* @note The domain from the input URL is automatically whitelisted, in addition to any already loaded whitelist.
* @note Sets ::WebArgType_UnknownD to value 1, and sets ::WebArgType_NewsFlag to true. Also uses \ref webConfigSetEcClientCert and \ref webConfigSetShopJump with flag=true.
* @param config WebCommonConfig object.
* @param url Initial URL navigated to by the applet.
*/
Result webNewsCreate(WebCommonConfig* config, const char* url);
/**
* @brief Creates the config for WebApplet. This is based on \ref webPageCreate, for YouTubeVideo. Hence other functions referencing \ref webPageCreate also apply to this. This uses a whitelist which essentially only allows youtube embed/ URLs (without mounting content from the host Application).
* @note This is only available on [5.0.0+].
* @note Sets ::WebArgType_UnknownD to value 1, and sets ::WebArgType_YouTubeVideoFlag to true. Also uses \ref webConfigSetBootAsMediaPlayer with flag=true.
* @param config WebCommonConfig object.
* @param url Initial URL navigated to by the applet.
*/
Result webYouTubeVideoCreate(WebCommonConfig* config, const char* url);
/**
* @brief Creates the config for Offline-applet. This applet uses data loaded from content.
* @note Uses \ref webConfigSetLeftStickMode with ::WebLeftStickMode_Cursor and sets ::WebArgType_BootAsMediaPlayerInverted to false. Uses \ref webConfigSetPointer with flag = docKind == ::WebDocumentKind_OfflineHtmlPage.
* @note For docKind ::WebDocumentKind_ApplicationLegalInformation / ::WebDocumentKind_SystemDataPage, uses \ref webConfigSetFooter with flag=true and \ref webConfigSetBackgroundKind with ::WebBackgroundKind_Default.
* @note For docKind ::WebDocumentKind_SystemDataPage, uses \ref webConfigSetBootDisplayKind with ::WebBootDisplayKind_White.
* @note Sets ::WebArgType_Unknown14/::WebArgType_Unknown15 to value 1. With docKind ::WebDocumentKind_ApplicationLegalInformation, uses \ref webConfigSetBootDisplayKind with ::WebBootDisplayKind_White.
* @note Sets ::WebArgType_UnknownC to value 1.
* @note With docKind ::WebDocumentKind_ApplicationLegalInformation, uses \ref webConfigSetEcClientCert with flag=true.
* @note With docKind ::WebDocumentKind_OfflineHtmlPage on pre-3.0.0, sets ::WebArgType_Unknown12 to value 1.
* @note Lastly, sets the TLVs as needed for the input params.
* @param config WebCommonConfig object.
* @param docKind \ref WebDocumentKind
* @param id Id to load the content from. With docKind = ::WebDocumentKind_OfflineHtmlPage, id=0 should be used to specify the user-process application (non-zero is ignored with this docKind).
* @param docPath Initial document path in RomFS, without the leading '/'. For ::WebDocumentKind_OfflineHtmlPage, this is relative to "html-document/" in RomFS. For the other docKind values, this is relative to "/" in RomFS. This path must contain ".htdocs/".
*/
Result webOfflineCreate(WebCommonConfig* config, WebDocumentKind docKind, u64 id, const char* docPath);
/**
* @brief Creates the config for ShareApplet. This applet is for social media posting/settings.
* @note If a non-zero uid isn't set with \ref webConfigSetUid prior to using \ref webConfigShow, the applet will launch the profile-selector applet to select an account.
* @note An error will be displayed if neither \ref webConfigSetAlbumEntry, nor \ref webConfigSetApplicationAlbumEntry, nor \ref webConfigAddAlbumEntryAndMediaData are used prior to using \ref webConfigShow, with ::WebShareStartPage_Default.
* @note Uses \ref webConfigSetLeftStickMode with ::WebLeftStickMode_Cursor, \ref webConfigSetUid with uid=0, \ref webConfigSetDisplayUrlKind with kind=true, and sets ::WebArgType_Unknown14/::WebArgType_Unknown15 to value 1. Uses \ref webConfigSetBootDisplayKind with ::WebBootDisplayKind_Unknown3.
* @param config WebCommonConfig object.
* @param page \ref WebShareStartPage
*/
Result webShareCreate(WebCommonConfig* config, WebShareStartPage page);
/**
* @brief Creates the config for LobbyApplet. This applet is for "Nintendo Switch Online Lounge".
* @note Only available on [2.0.0+].
* @note If a non-zero uid isn't set with \ref webConfigSetUid prior to using \ref webConfigShow, the applet will launch the profile-selector applet to select an account.
* @note Uses \ref webConfigSetLeftStickMode with ::WebLeftStickMode_Cursor, \ref webConfigSetPointer with flag=false on [3.0.0+], \ref webConfigSetUid with uid=0, and sets ::WebArgType_Unknown14/::WebArgType_Unknown15 to value 1. Uses \ref webConfigSetBootDisplayKind with ::WebBootDisplayKind_Unknown4, \ref webConfigSetBackgroundKind with ::WebBackgroundKind_Unknown2, and sets ::WebArgType_BootAsMediaPlayerInverted to false.
* @param config WebCommonConfig object.
*/
Result webLobbyCreate(WebCommonConfig* config);
/**
* @brief Sets the CallbackUrl. See also \ref webReplyGetLastUrl.
* @note With Offline-applet for LastUrl handling, it compares the domain with "localhost" instead.
* @note Only available with config created by \ref webPageCreate or with Share-applet.
* @param config WebCommonConfig object.
* @param url URL
*/
Result webConfigSetCallbackUrl(WebCommonConfig* config, const char* url);
/**
* @brief Sets the CallbackableUrl.
* @note Only available with config created by \ref webPageCreate.
* @param config WebCommonConfig object.
* @param url URL
*/
Result webConfigSetCallbackableUrl(WebCommonConfig* config, const char* url);
/**
* @brief Sets the whitelist.
* @note Only available with config created by \ref webPageCreate.
* @note If the whitelist isn't formatted properly, the applet will exit briefly after the applet is launched.
* @param config WebCommonConfig object.
* @param whitelist Whitelist string, each line is a regex for each whitelisted URL.
*/
Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
/**
* @brief Sets the account uid. Controls which user-specific savedata to mount.
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Share-applet.
* @note Used automatically by \ref webShareCreate and \ref webLobbyCreate with uid=0.
* @param config WebCommonConfig object.
* @param uid \ref AccountUid
*/
Result webConfigSetUid(WebCommonConfig* config, AccountUid uid);
/**
* @brief Sets the Share CapsAlbumEntry.
* @note Only available with config created by \ref webShareCreate.
* @param config WebCommonConfig object.
* @param entry \ref CapsAlbumEntry
*/
Result webConfigSetAlbumEntry(WebCommonConfig* config, const CapsAlbumEntry *entry);
/**
* @brief Sets the ScreenShot flag, which controls whether screen-shot capture is allowed.
* @note Only available with config created by \ref webPageCreate.
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetScreenShot(WebCommonConfig* config, bool flag);
/**
* @brief Sets the EcClientCert flag.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate.
* @note Used automatically by \ref webOfflineCreate, depending on the docKind.
* @note Used automatically by \ref webNewsCreate with flag=true.
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag);
/**
* @brief Sets whether PlayReport is enabled.
* @note Only available with config created by \ref webOfflineCreate.
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetPlayReport(WebCommonConfig* config, bool flag);
/**
* @brief Sets the BootDisplayKind.
* @note Only available with config created by \ref webOfflineCreate, \ref webShareCreate, \ref webPageCreate, or \ref webLobbyCreate..
* @note Used automatically by \ref webOfflineCreate, depending on the docKind.
* @note Used automatically by \ref webShareCreate with kind=::WebBootDisplayKind_Unknown3.
* @note Used automatically by \ref webLobbyCreate with kind=::WebBootDisplayKind_Unknown4.
* @param config WebCommonConfig object.
* @param kind \ref WebBootDisplayKind
*/
Result webConfigSetBootDisplayKind(WebCommonConfig* config, WebBootDisplayKind kind);
/**
* @brief Sets the BackgroundKind.
* @note Only available with config created by \ref webOfflineCreate, \ref webPageCreate, or \ref webLobbyCreate.
* @note Used automatically by \ref webOfflineCreate, depending on the docKind.
* @note Used automatically by \ref webLobbyCreate with kind=2.
* @param config WebCommonConfig object.
* @param kind \ref WebBackgroundKind
*/
Result webConfigSetBackgroundKind(WebCommonConfig* config, WebBackgroundKind kind);
/**
* @brief Sets the whether the UI footer is enabled.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate.
* @note Used automatically by \ref webOfflineCreate, depending on the docKind.
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetFooter(WebCommonConfig* config, bool flag);
/**
* @brief Sets the whether the Pointer is enabled. See also \ref WebLeftStickMode.
* @note Only available with config created by \ref webOfflineCreate, \ref webPageCreate, or \ref webLobbyCreate.
* @note Used automatically by \ref webOfflineCreate.
* @note Used automatically by \ref webLobbyCreate with flag=false on [3.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetPointer(WebCommonConfig* config, bool flag);
/**
* @brief Sets the LeftStickMode.
* @note Only available with config created by \ref webOfflineCreate, \ref webShareCreate, \ref webPageCreate, or \ref webLobbyCreate.
* @note Used automatically by \ref webOfflineCreate, \ref webShareCreate, and \ref webLobbyCreate with ::WebLeftStickMode_Cursor.
* @param config WebCommonConfig object.
* @param mode Mode, different enums for Web and Offline.
*/
Result webConfigSetLeftStickMode(WebCommonConfig* config, WebLeftStickMode mode);
/**
* @brief Sets the KeyRepeatFrame.
* @note Only available with config created by \ref webOfflineCreate.
* @param config WebCommonConfig object.
* @param inval0 First input param.
* @param inval1 Second input param.
*/
Result webConfigSetKeyRepeatFrame(WebCommonConfig* config, s32 inval0, s32 inval1);
/**
* @brief Sets the DisplayUrlKind.
* @note Only available with config created by \ref webShareCreate or \ref webPageCreate.
* @param config WebCommonConfig object.
* @note Used automatically by \ref webShareCreate with kind=true.
* @param kind Kind
*/
Result webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind);
/**
* @brief Sets the BootAsMediaPlayer flag.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [2.0.0+].
* @note With config created by \ref webNewsCreate on [3.0.0+], this also sets ::WebArgType_BootAsMediaPlayerInverted to !flag.
* @param config WebCommonConfig object.
* @param flag Flag. true = BootAsMediaPlayer, false = BootAsWebPage.
*/
Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag);
/**
* @brief Sets the ShopJump flag.
* @note Only available with config created by \ref webPageCreate on [2.0.0+].
* @note Used automatically by \ref webNewsCreate with flag=true.
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetShopJump(WebCommonConfig* config, bool flag);
/**
* @brief Sets the MediaPlayerUserGestureRestriction flag.
* @note Only available with config created by \ref webPageCreate on [2.0.0-5.1.0].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetMediaPlayerUserGestureRestriction(WebCommonConfig* config, bool flag);
/**
* @brief Sets whether MediaAutoPlay is enabled.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [6.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetMediaAutoPlay(WebCommonConfig* config, bool flag);
/**
* @brief Sets the LobbyParameter.
* @note Only available with config created by \ref webLobbyCreate.
* @param config WebCommonConfig object.
* @param str String
*/
Result webConfigSetLobbyParameter(WebCommonConfig* config, const char* str);
/**
* @brief Sets the Share CapsApplicationAlbumEntry.
* @note Only available with config created by \ref webShareCreate on [3.0.0+].
* @param config WebCommonConfig object.
* @param entry \ref CapsApplicationAlbumEntry, see also capssu.h.
*/
Result webConfigSetApplicationAlbumEntry(WebCommonConfig* config, CapsApplicationAlbumEntry *entry);
/**
* @brief Sets whether JsExtension is enabled.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [3.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetJsExtension(WebCommonConfig* config, bool flag);
/**
* @brief Sets the Share AdditionalCommentText.
* @note Only available with config created by \ref webShareCreate on [4.0.0+].
* @param config WebCommonConfig object.
* @param str String
*/
Result webConfigSetAdditionalCommentText(WebCommonConfig* config, const char* str);
/**
* @brief Sets the TouchEnabledOnContents flag.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [4.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetTouchEnabledOnContents(WebCommonConfig* config, bool flag);
/**
* @brief Sets the UserAgentAdditionalString. " " followed by this string are appended to the normal User-Agent string.
* @note Only available with config created by \ref webPageCreate on [4.0.0+].
* @param config WebCommonConfig object.
* @param str String
*/
Result webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char* str);
/**
* @brief Sets the Share AdditionalMediaData.
* @note Only available with config created by \ref webShareCreate on [4.0.0+].
* @param config WebCommonConfig object.
* @param data Input data
* @param size Size of the input data, max size is 0x10.
*/
Result webConfigSetAdditionalMediaData(WebCommonConfig* config, const u8* data, size_t size);
/**
* @brief Sets the MediaPlayerAutoClose flag.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [4.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetMediaPlayerAutoClose(WebCommonConfig* config, bool flag);
/**
* @brief Sets whether PageCache is enabled.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [4.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetPageCache(WebCommonConfig* config, bool flag);
/**
* @brief Sets whether WebAudio is enabled.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [4.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetWebAudio(WebCommonConfig* config, bool flag);
/**
* @brief Sets the FooterFixedKind.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [5.0.0+].
* @param config WebCommonConfig object.
* @param kind \ref WebFooterFixedKind
*/
Result webConfigSetFooterFixedKind(WebCommonConfig* config, WebFooterFixedKind kind);
/**
* @brief Sets the PageFade flag.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [5.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetPageFade(WebCommonConfig* config, bool flag);
/**
* @brief Sets the Share MediaCreatorApplicationRatingAge.
* @note Only available with config created by \ref webShareCreate on [5.0.0+].
* @param config WebCommonConfig object.
* @param data 0x20-byte input data
*/
Result webConfigSetMediaCreatorApplicationRatingAge(WebCommonConfig* config, const s8 *data);
/**
* @brief Sets the BootLoadingIcon flag.
* @note Only available with config created by \ref webOfflineCreate on [5.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetBootLoadingIcon(WebCommonConfig* config, bool flag);
/**
* @brief Sets the PageScrollIndicator flag.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [5.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetPageScrollIndicator(WebCommonConfig* config, bool flag);
/**
* @brief Sets whether MediaPlayerSpeedControl is enabled.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [6.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetMediaPlayerSpeedControl(WebCommonConfig* config, bool flag);
/**
* @brief Adds a pair of Share CapsAlbumEntry + optionally AdditionalMediaData. This can be used up to 4 times, for setting multiple pairs.
* @note Only available with config created by \ref webShareCreate on [6.0.0+].
* @param config WebCommonConfig object.
* @param entry \ref CapsAlbumEntry
* @param data Input data for AdditionalMediaData. Optional, can be NULL.
* @param size Size of the input data, max size is 0x10. Optional, can be 0.
*/
Result webConfigAddAlbumEntryAndMediaData(WebCommonConfig* config, const CapsAlbumEntry *entry, const u8* data, size_t size);
/**
* @brief Sets whether the specified BootFooterButton is visible.
* @note Only available with config created by \ref webOfflineCreate on [6.0.0+].
* @param config WebCommonConfig object.
* @param button \ref WebFooterButtonId
* @param visible Visible flag.
*/
Result webConfigSetBootFooterButtonVisible(WebCommonConfig* config, WebFooterButtonId button, bool visible);
/**
* @brief Sets OverrideWebAudioVolume.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [6.0.0+].
* @param config WebCommonConfig object.
* @param value Value
*/
Result webConfigSetOverrideWebAudioVolume(WebCommonConfig* config, float value);
/**
* @brief Sets OverrideMediaAudioVolume.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [6.0.0+].
* @param config WebCommonConfig object.
* @param value Value
*/
Result webConfigSetOverrideMediaAudioVolume(WebCommonConfig* config, float value);
/**
* @brief Sets \ref WebSessionBootMode.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [7.0.0+].
* @param config WebCommonConfig object.
* @param mode \ref WebSessionBootMode
*/
Result webConfigSetBootMode(WebCommonConfig* config, WebSessionBootMode mode);
/**
* @brief Sets whether MediaPlayerUi is enabled.
* @note Only available with config created by \ref webOfflineCreate on [8.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetMediaPlayerUi(WebCommonConfig* config, bool flag);
/**
* @brief Sets whether TransferMemory is enabled.
* @note Only available with config created by \ref webPageCreate on [11.0.0+].
* @param config WebCommonConfig object.
* @param flag Flag
*/
Result webConfigSetTransferMemory(WebCommonConfig* config, bool flag);
/**
* @brief Launches the {web applet} with the specified config and waits for it to exit.
* @param config WebCommonConfig object.
* @param out Optional output applet reply data, can be NULL.
*/
Result webConfigShow(WebCommonConfig* config, WebCommonReply *out);
/**
* @brief Request the applet to exit after \ref webConfigShow was used, while the applet is still running. This is for use from another thread.
* @param config WebCommonConfig object.
*/
Result webConfigRequestExit(WebCommonConfig* config);
/**
* @brief Gets the ExitReason from the specified reply.
* @param reply WebCommonReply object.
* @param exitReason Output \ref WebExitReason
*/
Result webReplyGetExitReason(WebCommonReply *reply, WebExitReason *exitReason);
/**
* @brief Gets the LastUrl from the specified reply. When the applet loads a page where the beginning of the URL matches the URL from \ref webConfigSetCallbackUrl, the applet will exit and set LastUrl to that URL (exit doesn't occur when \ref webConfigSetCallbackableUrl was used).
* @note This is only available with ::WebExitReason_LastUrl (string is empty otherwise).
* @note If you want to allocate a string buffer on heap, you can call this with outstr=NULL/outstr_maxsize=0 to get the out_size, then call it again with the allocated buffer.
* @param reply WebCommonReply object.
* @param outstr Output string buffer. If NULL, the string is not loaded.
* @param outstr_maxsize Size of the buffer, including NUL-terminator. If outstr is set, this size must be >1. The size used for the actual string-copy is this size-1, to make sure the output is NUL-terminated (the entire buffer is cleared first).
* @param out_size Output string length including NUL-terminator, for the original input string in the reply loaded from a separate size field.
*/
Result webReplyGetLastUrl(WebCommonReply *reply, char *outstr, size_t outstr_maxsize, size_t *out_size);
/**
* @brief Gets the SharePostResult from the specified reply.
* @note Only available with reply data from ShareApplet on [3.0.0+].
* @param reply WebCommonReply object.
* @param sharePostResult Output sharePostResult
*/
Result webReplyGetSharePostResult(WebCommonReply *reply, u32 *sharePostResult);
/**
* @brief Gets the PostServiceName from the specified reply.
* @note Only available with reply data from ShareApplet on [3.0.0+].
* @note If you want to allocate a string buffer on heap, you can call this with outstr=NULL/outstr_maxsize=0 to get the out_size, then call it again with the allocated buffer.
* @param reply WebCommonReply object.
* @param outstr Output string buffer. If NULL, the string is not loaded.
* @param outstr_maxsize Size of the buffer, including NUL-terminator. If outstr is set, this size must be >1. The size used for the actual string-copy is this size-1, to make sure the output is NUL-terminated (the entire buffer is cleared first).
* @param out_size Output string length including NUL-terminator, for the original input string in the reply loaded from a separate size field.
*/
Result webReplyGetPostServiceName(WebCommonReply *reply, char *outstr, size_t outstr_maxsize, size_t *out_size);
/**
* @brief Gets the PostId from the specified reply.
* @note Only available with reply data from ShareApplet on [3.0.0+].
* @note If you want to allocate a string buffer on heap, you can call this with outstr=NULL/outstr_maxsize=0 to get the out_size, then call it again with the allocated buffer.
* @param reply WebCommonReply object.
* @param outstr Output string buffer. If NULL, the string is not loaded.
* @param outstr_maxsize Size of the buffer, including NUL-terminator. If outstr is set, this size must be >1. The size used for the actual string-copy is this size-1, to make sure the output is NUL-terminated (the entire buffer is cleared first).
* @param out_size Output string length including NUL-terminator, for the original input string in the reply loaded from a separate size field.
*/
Result webReplyGetPostId(WebCommonReply *reply, char *outstr, size_t outstr_maxsize, size_t *out_size);
/**
* @brief Gets the MediaPlayerAutoClosedByCompletion flag from the specified reply.
* @note Only available with reply data from Web on [8.0.0+].
* @param reply WebCommonReply object.
* @param flag Output flag
*/
Result webReplyGetMediaPlayerAutoClosedByCompletion(WebCommonReply *reply, bool *flag);
/**
* @brief Creates a \ref WebSession object.
* @param s \ref WebSession
* @param config WebCommonConfig object.
*/
void webSessionCreate(WebSession *s, WebCommonConfig* config);
/**
* @brief Closes a \ref WebSession object.
* @param s \ref WebSession
*/
void webSessionClose(WebSession *s);
/**
* @brief Launches the applet for \ref WebSession.
* @note Only available with config created by \ref webOfflineCreate or \ref webPageCreate, on [7.0.0+].
* @note Do not use \ref webConfigShow when using WebSession.
* @param s \ref WebSession
* @param[out] out_event Output Event with autoclear=false, from \ref appletHolderGetExitEvent. Optional, can be NULL.
*/
Result webSessionStart(WebSession *s, Event **out_event);
/**
* @brief Waits for the applet to exit.
* @note This must be used before \ref webSessionClose, when \ref webSessionStart was used successfully.
* @param s \ref WebSession
* @param out Optional output applet reply data, can be NULL.
*/
Result webSessionWaitForExit(WebSession *s, WebCommonReply *out);
/**
* @brief Request the applet to exit.
* @note Use this instead of \ref webConfigRequestExit, when using WebSession.
* @param s \ref WebSession
*/
Result webSessionRequestExit(WebSession *s);
/**
* @brief Request the applet to Appear, this is only needed with ::WebSessionBootMode_AllForegroundInitiallyHidden.
* @note This should not be used before \ref webSessionStart.
* @param s \ref WebSession
* @param[out] flag Whether the message was sent successfully.
*/
Result webSessionAppear(WebSession *s, bool *flag);
/**
* @brief TrySendContentMessage
* @note This should not be used before \ref webSessionStart.
* @note The JS-side for this is only available when JsExtension is enabled via \ref webConfigSetJsExtension.
* @note The JS-side may ignore this if it's sent too soon after the applet launches.
* @param s \ref WebSession
* @param[in] content Input content NUL-terminated string.
* @param[in] size Size of content.
* @param[out] flag Whether the message was sent successfully.
*/
Result webSessionTrySendContentMessage(WebSession *s, const char *content, u32 size, bool *flag);
/**
* @brief TryReceiveContentMessage
* @note This should not be used before \ref webSessionStart.
* @note The JS-side for this is only available when JsExtension is enabled via \ref webConfigSetJsExtension.
* @param s \ref WebSession
* @param[out] content Output content string, always NUL-terminated.
* @param[in] size Max size of content.
* @param[out] out_size Original content size, prior to being clamped to the specified size param.
* @param[out] flag Whether the message was received successfully.
*/
Result webSessionTryReceiveContentMessage(WebSession *s, char *content, u64 size, u64 *out_size, bool *flag);

View File

@ -0,0 +1,46 @@
/**
* @file counter.h
* @brief AArch64 system counter-timer.
* @author fincs
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/**
* @brief Gets the current system tick.
* @return The current system tick.
*/
static inline u64 armGetSystemTick(void) {
u64 ret;
__asm__ __volatile__ ("mrs %x[data], cntpct_el0" : [data] "=r" (ret));
return ret;
}
/**
* @brief Gets the system counter-timer frequency
* @return The system counter-timer frequency, in Hz.
*/
static inline u64 armGetSystemTickFreq(void) {
u64 ret;
__asm__ ("mrs %x[data], cntfrq_el0" : [data] "=r" (ret));
return ret;
}
/**
* @brief Converts from nanoseconds to CPU ticks unit.
* @param ns Time in nanoseconds.
* @return Time in CPU ticks.
*/
static inline u64 armNsToTicks(u64 ns) {
return (ns * 12) / 625;
}
/**
* @brief Converts from CPU ticks unit to nanoseconds.
* @param tick Time in ticks.
* @return Time in nanoseconds.
*/
static inline u64 armTicksToNs(u64 tick) {
return (tick * 625) / 12;
}

View File

@ -0,0 +1,130 @@
/**
* @file thread_context.h
* @brief AArch64 register dump format and related definitions.
* @author TuxSH
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/// Armv8 CPU register.
typedef union {
u64 x; ///< 64-bit AArch64 register view.
u32 w; ///< 32-bit AArch64 register view.
u32 r; ///< AArch32 register view.
} CpuRegister;
/// Armv8 NEON register.
typedef union {
u128 v; ///< 128-bit vector view.
double d; ///< 64-bit double-precision view.
float s; ///< 32-bit single-precision view.
} FpuRegister;
/// Armv8 register group. @ref svcGetThreadContext3 uses @ref RegisterGroup_All.
typedef enum {
RegisterGroup_CpuGprs = BIT(0), ///< General-purpose CPU registers (x0..x28 or r0..r10,r12).
RegisterGroup_CpuSprs = BIT(1), ///< Special-purpose CPU registers (fp, lr, sp, pc, PSTATE or cpsr, TPIDR_EL0).
RegisterGroup_FpuGprs = BIT(2), ///< General-purpose NEON registers.
RegisterGroup_FpuSprs = BIT(3), ///< Special-purpose NEON registers.
RegisterGroup_CpuAll = RegisterGroup_CpuGprs | RegisterGroup_CpuSprs, ///< All CPU registers.
RegisterGroup_FpuAll = RegisterGroup_FpuGprs | RegisterGroup_FpuSprs, ///< All NEON registers.
RegisterGroup_All = RegisterGroup_CpuAll | RegisterGroup_FpuAll, ///< All registers.
} RegisterGroup;
/// This is for \ref ThreadExceptionDump error_desc.
typedef enum {
ThreadExceptionDesc_InstructionAbort = 0x100, ///< Instruction abort
ThreadExceptionDesc_MisalignedPC = 0x102, ///< Misaligned PC
ThreadExceptionDesc_MisalignedSP = 0x103, ///< Misaligned SP
ThreadExceptionDesc_SError = 0x106, ///< SError [not in 1.0.0?]
ThreadExceptionDesc_BadSVC = 0x301, ///< Bad SVC
ThreadExceptionDesc_Trap = 0x104, ///< Uncategorized, CP15RTTrap, CP15RRTTrap, CP14RTTrap, CP14RRTTrap, IllegalState, SystemRegisterTrap
ThreadExceptionDesc_Other = 0x101, ///< None of the above, EC <= 0x34 and not a breakpoint
} ThreadExceptionDesc;
/// Thread context structure (register dump)
typedef struct {
CpuRegister cpu_gprs[29]; ///< GPRs 0..28. Note: also contains AArch32 SPRs.
u64 fp; ///< Frame pointer (x29) (AArch64). For AArch32, check r11.
u64 lr; ///< Link register (x30) (AArch64). For AArch32, check r14.
u64 sp; ///< Stack pointer (AArch64). For AArch32, check r13.
CpuRegister pc; ///< Program counter.
u32 psr; ///< PSTATE or cpsr.
FpuRegister fpu_gprs[32]; ///< 32 general-purpose NEON registers.
u32 fpcr; ///< Floating-point control register.
u32 fpsr; ///< Floating-point status register.
u64 tpidr; ///< EL0 Read/Write Software Thread ID Register.
} ThreadContext;
/// Thread exception dump structure.
typedef struct {
u32 error_desc; ///< See \ref ThreadExceptionDesc.
u32 pad[3];
CpuRegister cpu_gprs[29]; ///< GPRs 0..28. Note: also contains AArch32 registers.
CpuRegister fp; ///< Frame pointer.
CpuRegister lr; ///< Link register.
CpuRegister sp; ///< Stack pointer.
CpuRegister pc; ///< Program counter (elr_el1).
u64 padding;
FpuRegister fpu_gprs[32]; ///< 32 general-purpose NEON registers.
u32 pstate; ///< pstate & 0xFF0FFE20
u32 afsr0;
u32 afsr1;
u32 esr;
CpuRegister far; ///< Fault Address Register.
} ThreadExceptionDump;
typedef struct {
u64 cpu_gprs[9]; ///< GPRs 0..8.
u64 lr;
u64 sp;
u64 elr_el1;
u32 pstate; ///< pstate & 0xFF0FFE20
u32 afsr0;
u32 afsr1;
u32 esr;
u64 far;
} ThreadExceptionFrameA64;
typedef struct {
u32 cpu_gprs[8]; ///< GPRs 0..7.
u32 sp;
u32 lr;
u32 elr_el1;
u32 tpidr_el0; ///< tpidr_el0 = 1
u32 cpsr; ///< cpsr & 0xFF0FFE20
u32 afsr0;
u32 afsr1;
u32 esr;
u32 far;
} ThreadExceptionFrameA32;
/**
* @brief Determines whether a thread context belong to an AArch64 process based on the PSR.
* @param[in] ctx Thread context to which PSTATE/cspr has been dumped to.
* @return true if and only if the thread context belongs to an AArch64 process.
*/
static inline bool threadContextIsAArch64(const ThreadContext *ctx)
{
return (ctx->psr & 0x10) == 0;
}
/**
* @brief Determines whether a ThreadExceptionDump belongs to an AArch64 process based on the PSTATE.
* @param[in] ctx ThreadExceptionDump.
* @return true if and only if the ThreadExceptionDump belongs to an AArch64 process.
*/
static inline bool threadExceptionIsAArch64(const ThreadExceptionDump *ctx)
{
return (ctx->pstate & 0x10) == 0;
}

View File

@ -0,0 +1,25 @@
/**
* @file audio.h
* @brief Global audio service.
* @author hexkyz
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/// PcmFormat
typedef enum {
PcmFormat_Invalid = 0,
PcmFormat_Int8 = 1,
PcmFormat_Int16 = 2,
PcmFormat_Int24 = 3,
PcmFormat_Int32 = 4,
PcmFormat_Float = 5,
PcmFormat_Adpcm = 6,
} PcmFormat;
/// AudioDeviceName
typedef struct {
char name[0x100];
} AudioDeviceName;

View File

@ -0,0 +1,145 @@
/**
* @file driver.h
* @brief Audio driver (audren wrapper).
* @author fincs
* @copyright libnx Authors
*/
#pragma once
#include "../services/audren.h"
typedef struct AudioDriverEtc AudioDriverEtc;
typedef struct {
AudioDriverEtc* etc;
AudioRendererConfig config;
AudioRendererMemPoolInfoIn* in_mempools;
AudioRendererChannelInfoIn* in_channels;
AudioRendererVoiceInfoIn* in_voices;
AudioRendererMixInfoIn* in_mixes;
AudioRendererSinkInfoIn* in_sinks;
} AudioDriver;
Result audrvCreate(AudioDriver* d, const AudioRendererConfig* config, int num_final_mix_channels);
Result audrvUpdate(AudioDriver* d);
void audrvClose(AudioDriver* d);
//-----------------------------------------------------------------------------
int audrvMemPoolAdd(AudioDriver* d, void* buffer, size_t size);
bool audrvMemPoolRemove(AudioDriver* d, int id);
bool audrvMemPoolAttach(AudioDriver* d, int id);
bool audrvMemPoolDetach(AudioDriver* d, int id);
//-----------------------------------------------------------------------------
typedef enum {
AudioDriverWaveBufState_Free,
AudioDriverWaveBufState_Waiting,
AudioDriverWaveBufState_Queued,
AudioDriverWaveBufState_Playing,
AudioDriverWaveBufState_Done,
} AudioDriverWaveBufState;
typedef struct AudioDriverWaveBuf AudioDriverWaveBuf;
struct AudioDriverWaveBuf {
union {
s16* data_pcm16;
u8* data_adpcm;
const void* data_raw;
};
u64 size;
s32 start_sample_offset;
s32 end_sample_offset;
const void* context_addr;
u64 context_sz;
AudioDriverWaveBufState state : 8;
bool is_looping;
u32 sequence_id;
AudioDriverWaveBuf* next;
};
bool audrvVoiceInit(AudioDriver* d, int id, int num_channels, PcmFormat format, int sample_rate);
void audrvVoiceDrop(AudioDriver* d, int id);
void audrvVoiceStop(AudioDriver* d, int id);
bool audrvVoiceIsPaused(AudioDriver* d, int id);
bool audrvVoiceIsPlaying(AudioDriver* d, int id);
bool audrvVoiceAddWaveBuf(AudioDriver* d, int id, AudioDriverWaveBuf* wavebuf);
u32 audrvVoiceGetWaveBufSeq(AudioDriver* d, int id);
u32 audrvVoiceGetPlayedSampleCount(AudioDriver* d, int id);
u32 audrvVoiceGetVoiceDropsCount(AudioDriver* d, int id);
void audrvVoiceSetBiquadFilter(AudioDriver* d, int id, int biquad_id, float a0, float a1, float a2, float b0, float b1, float b2);
static inline void audrvVoiceSetExtraParams(AudioDriver* d, int id, const void* params, size_t params_size)
{
d->in_voices[id].extra_params_ptr = params;
d->in_voices[id].extra_params_sz = params_size;
}
static inline void audrvVoiceSetDestinationMix(AudioDriver* d, int id, int mix_id)
{
d->in_voices[id].dest_mix_id = mix_id;
d->in_voices[id].dest_splitter_id = AUDREN_UNUSED_SPLITTER_ID;
}
static inline void audrvVoiceSetMixFactor(AudioDriver* d, int id, float factor, int src_channel_id, int dest_channel_id)
{
int channel_id = d->in_voices[id].channel_ids[src_channel_id];
d->in_channels[channel_id].mix[dest_channel_id] = factor;
}
static inline void audrvVoiceSetVolume(AudioDriver* d, int id, float volume)
{
d->in_voices[id].volume = volume;
}
static inline void audrvVoiceSetPitch(AudioDriver* d, int id, float pitch)
{
d->in_voices[id].pitch = pitch;
}
static inline void audrvVoiceSetPriority(AudioDriver* d, int id, int priority)
{
d->in_voices[id].priority = priority;
}
static inline void audrvVoiceClearBiquadFilter(AudioDriver* d, int id, int biquad_id)
{
d->in_voices[id].biquads[biquad_id].enable = false;
}
static inline void audrvVoiceSetPaused(AudioDriver* d, int id, bool paused)
{
d->in_voices[id].state = paused ? AudioRendererVoicePlayState_Paused : AudioRendererVoicePlayState_Started;
}
static inline void audrvVoiceStart(AudioDriver* d, int id)
{
audrvVoiceSetPaused(d, id, false);
}
//-----------------------------------------------------------------------------
int audrvMixAdd(AudioDriver* d, int sample_rate, int num_channels);
void audrvMixRemove(AudioDriver* d, int id);
static inline void audrvMixSetDestinationMix(AudioDriver* d, int id, int mix_id)
{
d->in_mixes[id].dest_mix_id = mix_id;
d->in_mixes[id].dest_splitter_id = AUDREN_UNUSED_SPLITTER_ID;
}
static inline void audrvMixSetMixFactor(AudioDriver* d, int id, float factor, int src_channel_id, int dest_channel_id)
{
d->in_mixes[id].mix[src_channel_id][dest_channel_id] = factor;
}
static inline void audrvMixSetVolume(AudioDriver* d, int id, float volume)
{
d->in_mixes[id].volume = volume;
}
//-----------------------------------------------------------------------------
int audrvDeviceSinkAdd(AudioDriver* d, const char* device_name, int num_channels, const u8* channel_ids);
void audrvSinkRemove(AudioDriver* d, int id);

View File

@ -0,0 +1,74 @@
/**
* @file aes.h
* @brief Hardware accelerated AES-ECB implementation.
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#ifndef AES_BLOCK_SIZE
#define AES_BLOCK_SIZE 0x10
#endif
#ifndef AES_128_KEY_SIZE
#define AES_128_KEY_SIZE 0x10
#endif
#ifndef AES_128_U32_PER_KEY
#define AES_128_U32_PER_KEY (AES_128_KEY_SIZE / sizeof(u32))
#endif
#ifndef AES_128_NUM_ROUNDS
#define AES_128_NUM_ROUNDS 10
#endif
#ifndef AES_192_KEY_SIZE
#define AES_192_KEY_SIZE 0x18
#endif
#ifndef AES_192_U32_PER_KEY
#define AES_192_U32_PER_KEY (AES_192_KEY_SIZE / sizeof(u32))
#endif
#ifndef AES_192_NUM_ROUNDS
#define AES_192_NUM_ROUNDS 12
#endif
#ifndef AES_256_KEY_SIZE
#define AES_256_KEY_SIZE 0x20
#endif
#ifndef AES_256_U32_PER_KEY
#define AES_256_U32_PER_KEY (AES_256_KEY_SIZE / sizeof(u32))
#endif
#ifndef AES_256_NUM_ROUNDS
#define AES_256_NUM_ROUNDS 14
#endif
/// Context for AES-128 operations.
typedef struct {
u8 round_keys[AES_128_NUM_ROUNDS+1][AES_BLOCK_SIZE];
} Aes128Context;
/// Context for AES-192 operations.
typedef struct {
u8 round_keys[AES_192_NUM_ROUNDS+1][AES_BLOCK_SIZE];
} Aes192Context;
/// Context for AES-256 operations.
typedef struct {
u8 round_keys[AES_256_NUM_ROUNDS+1][AES_BLOCK_SIZE];
} Aes256Context;
/// Initialize a 128-bit AES context.
void aes128ContextCreate(Aes128Context *out, const void *key, bool is_encryptor);
/// Encrypt using an AES context (Requires is_encryptor when initializing)
void aes128EncryptBlock(const Aes128Context *ctx, void *dst, const void *src);
/// Decrypt using an AES context (Requires !is_encryptor when initializing)
void aes128DecryptBlock(const Aes128Context *ctx, void *dst, const void *src);
/// Initialize a 192-bit AES context.
void aes192ContextCreate(Aes192Context *out, const void *key, bool is_encryptor);
/// Encrypt using an AES context (Requires is_encryptor when initializing)
void aes192EncryptBlock(const Aes192Context *ctx, void *dst, const void *src);
/// Decrypt using an AES context (Requires !is_encryptor when initializing)
void aes192DecryptBlock(const Aes192Context *ctx, void *dst, const void *src);
/// Initialize a 256-bit AES context.
void aes256ContextCreate(Aes256Context *out, const void *key, bool is_encryptor);
/// Encrypt using an AES context (Requires is_encryptor when initializing)
void aes256EncryptBlock(const Aes256Context *ctx, void *dst, const void *src);
/// Decrypt using an AES context (Requires !is_encryptor when initializing)
void aes256DecryptBlock(const Aes256Context *ctx, void *dst, const void *src);

View File

@ -0,0 +1,49 @@
/**
* @file aes_cbc.h
* @brief Hardware accelerated AES-CBC implementation.
* @copyright libnx Authors
*/
#pragma once
#include "aes.h"
/// Context for AES-128 CBC.
typedef struct {
Aes128Context aes_ctx;
u8 iv[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
} Aes128CbcContext;
/// Context for AES-192 CBC.
typedef struct {
Aes192Context aes_ctx;
u8 iv[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
} Aes192CbcContext;
/// Context for AES-256 CBC.
typedef struct {
Aes256Context aes_ctx;
u8 iv[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
} Aes256CbcContext;
/// 128-bit CBC API.
void aes128CbcContextCreate(Aes128CbcContext *out, const void *key, const void *iv, bool is_encryptor);
void aes128CbcContextResetIv(Aes128CbcContext *ctx, const void *iv);
size_t aes128CbcEncrypt(Aes128CbcContext *ctx, void *dst, const void *src, size_t size);
size_t aes128CbcDecrypt(Aes128CbcContext *ctx, void *dst, const void *src, size_t size);
/// 192-bit CBC API.
void aes192CbcContextCreate(Aes192CbcContext *out, const void *key, const void *iv, bool is_encryptor);
void aes192CbcContextResetIv(Aes192CbcContext *ctx, const void *iv);
size_t aes192CbcEncrypt(Aes192CbcContext *ctx, void *dst, const void *src, size_t size);
size_t aes192CbcDecrypt(Aes192CbcContext *ctx, void *dst, const void *src, size_t size);
/// 256-bit CBC API.
void aes256CbcContextCreate(Aes256CbcContext *out, const void *key, const void *iv, bool is_encryptor);
void aes256CbcContextResetIv(Aes256CbcContext *ctx, const void *iv);
size_t aes256CbcEncrypt(Aes256CbcContext *ctx, void *dst, const void *src, size_t size);
size_t aes256CbcDecrypt(Aes256CbcContext *ctx, void *dst, const void *src, size_t size);

View File

@ -0,0 +1,46 @@
/**
* @file aes_ctr.h
* @brief Hardware accelerated AES-CTR implementation.
* @copyright libnx Authors
*/
#pragma once
#include "aes.h"
/// Context for AES-128 CTR.
typedef struct {
Aes128Context aes_ctx;
u8 ctr[AES_BLOCK_SIZE];
u8 enc_ctr_buffer[AES_BLOCK_SIZE];
size_t buffer_offset;
} Aes128CtrContext;
/// Context for AES-192 CTR.
typedef struct {
Aes192Context aes_ctx;
u8 ctr[AES_BLOCK_SIZE];
u8 enc_ctr_buffer[AES_BLOCK_SIZE];
size_t buffer_offset;
} Aes192CtrContext;
/// Context for AES-256 CTR.
typedef struct {
Aes256Context aes_ctx;
u8 ctr[AES_BLOCK_SIZE];
u8 enc_ctr_buffer[AES_BLOCK_SIZE];
size_t buffer_offset;
} Aes256CtrContext;
/// 128-bit CTR API.
void aes128CtrContextCreate(Aes128CtrContext *out, const void *key, const void *ctr);
void aes128CtrContextResetCtr(Aes128CtrContext *ctx, const void *ctr);
void aes128CtrCrypt(Aes128CtrContext *ctx, void *dst, const void *src, size_t size);
/// 192-bit CTR API.
void aes192CtrContextCreate(Aes192CtrContext *out, const void *key, const void *ctr);
void aes192CtrContextResetCtr(Aes192CtrContext *ctx, const void *ctr);
void aes192CtrCrypt(Aes192CtrContext *ctx, void *dst, const void *src, size_t size);
/// 256-bit CTR API.
void aes256CtrContextCreate(Aes256CtrContext *out, const void *key, const void *ctr);
void aes256CtrContextResetCtr(Aes256CtrContext *ctx, const void *ctr);
void aes256CtrCrypt(Aes256CtrContext *ctx, void *dst, const void *src, size_t size);

View File

@ -0,0 +1,55 @@
/**
* @file aes_xts.h
* @brief Hardware accelerated AES-XTS implementation.
* @copyright libnx Authors
*/
#pragma once
#include "aes.h"
/// Context for AES-128 XTS.
typedef struct {
Aes128Context aes_ctx;
Aes128Context tweak_ctx;
u8 tweak[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
} Aes128XtsContext;
/// Context for AES-192 XTS.
typedef struct {
Aes192Context aes_ctx;
Aes192Context tweak_ctx;
u8 tweak[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
} Aes192XtsContext;
/// Context for AES-256 XTS.
typedef struct {
Aes256Context aes_ctx;
Aes256Context tweak_ctx;
u8 tweak[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
} Aes256XtsContext;
/// 128-bit XTS API.
void aes128XtsContextCreate(Aes128XtsContext *out, const void *key0, const void *key1, bool is_encryptor);
void aes128XtsContextResetTweak(Aes128XtsContext *ctx, const void *tweak);
void aes128XtsContextResetSector(Aes128XtsContext *ctx, uint64_t sector, bool is_nintendo);
size_t aes128XtsEncrypt(Aes128XtsContext *ctx, void *dst, const void *src, size_t size);
size_t aes128XtsDecrypt(Aes128XtsContext *ctx, void *dst, const void *src, size_t size);
/// 192-bit XTS API.
void aes192XtsContextCreate(Aes192XtsContext *out, const void *key0, const void *key1, bool is_encryptor);
void aes192XtsContextResetTweak(Aes192XtsContext *ctx, const void *tweak);
void aes192XtsContextResetSector(Aes192XtsContext *ctx, uint64_t sector, bool is_nintendo);
size_t aes192XtsEncrypt(Aes192XtsContext *ctx, void *dst, const void *src, size_t size);
size_t aes192XtsDecrypt(Aes192XtsContext *ctx, void *dst, const void *src, size_t size);
/// 256-bit XTS API.
void aes256XtsContextCreate(Aes256XtsContext *out, const void *key0, const void *key1, bool is_encryptor);
void aes256XtsContextResetTweak(Aes256XtsContext *ctx, const void *tweak);
void aes256XtsContextResetSector(Aes256XtsContext *ctx, uint64_t sector, bool is_nintendo);
size_t aes256XtsEncrypt(Aes256XtsContext *ctx, void *dst, const void *src, size_t size);
size_t aes256XtsDecrypt(Aes256XtsContext *ctx, void *dst, const void *src, size_t size);

View File

@ -0,0 +1,67 @@
/**
* @file cmac.h
* @brief Hardware accelerated AES-CMAC implementation.
* @copyright libnx Authors
*/
#pragma once
#include "aes.h"
/// Context for AES-128 CMAC.
typedef struct {
Aes128Context ctx;
u8 subkey[AES_BLOCK_SIZE];
u8 mac[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
bool finalized;
} Aes128CmacContext;
/// Context for AES-192 CMAC.
typedef struct {
Aes192Context ctx;
u8 subkey[AES_BLOCK_SIZE];
u8 mac[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
bool finalized;
} Aes192CmacContext;
/// Context for AES-256 CMAC.
typedef struct {
Aes256Context ctx;
u8 subkey[AES_BLOCK_SIZE];
u8 mac[AES_BLOCK_SIZE];
u8 buffer[AES_BLOCK_SIZE];
size_t num_buffered;
bool finalized;
} Aes256CmacContext;
/// Initialize an AES-128-CMAC context.
void cmacAes128ContextCreate(Aes128CmacContext *out, const void *key);
/// Updates AES-128-CMAC context with data to hash
void cmacAes128ContextUpdate(Aes128CmacContext *ctx, const void *src, size_t size);
/// Gets the context's output mac, finalizes the context.
void cmacAes128ContextGetMac(Aes128CmacContext *ctx, void *dst);
/// Simple all-in-one AES-128-CMAC calculator.
void cmacAes128CalculateMac(void *dst, const void *key, const void *src, size_t size);
/// Initialize an AES-192-CMAC context.
void cmacAes192ContextCreate(Aes192CmacContext *out, const void *key);
/// Updates AES-192-CMAC context with data to hash
void cmacAes192ContextUpdate(Aes192CmacContext *ctx, const void *src, size_t size);
/// Gets the context's output mac, finalizes the context.
void cmacAes192ContextGetMac(Aes192CmacContext *ctx, void *dst);
/// Simple all-in-one AES-192-CMAC calculator.
void cmacAes192CalculateMac(void *dst, const void *key, const void *src, size_t size);
/// Initialize an AES-256-CMAC context.
void cmacAes256ContextCreate(Aes256CmacContext *out, const void *key);
/// Updates AES-256-CMAC context with data to hash
void cmacAes256ContextUpdate(Aes256CmacContext *ctx, const void *src, size_t size);
/// Gets the context's output mac, finalizes the context.
void cmacAes256ContextGetMac(Aes256CmacContext *ctx, void *dst);
/// Simple all-in-one AES-256-CMAC calculator.
void cmacAes256CalculateMac(void *dst, const void *key, const void *src, size_t size);

View File

@ -0,0 +1,86 @@
/**
* @file crc.h
* @brief Hardware accelerated CRC32 implementation.
* @copyright libnx Authors
*/
#pragma once
#include <arm_acle.h>
#include "../types.h"
#define _CRC_ALIGN(sz, insn) \
do { \
if (((uintptr_t)src_u8 & sizeof(sz)) && (u64)len >= sizeof(sz)) { \
crc = __crc32##insn(crc, *((const sz *)src_u8)); \
src_u8 += sizeof(sz); \
len -= sizeof(sz); \
} \
} while (0)
#define _CRC_REMAINDER(sz, insn) \
do { \
if (len & sizeof(sz)) { \
crc = __crc32##insn(crc, *((const sz *)src_u8)); \
src_u8 += sizeof(sz); \
} \
} while (0)
/// Calculate a CRC32 over data using a seed.
/// Can be used to calculate a CRC32 in chunks using an initial seed of zero for the first chunk.
static inline u32 crc32CalculateWithSeed(u32 seed, const void *src, size_t size) {
const u8 *src_u8 = (const u8 *)src;
u32 crc = ~seed;
s64 len = size;
_CRC_ALIGN(u8, b);
_CRC_ALIGN(u16, h);
_CRC_ALIGN(u32, w);
while ((len -= sizeof(u64)) >= 0) {
crc = __crc32d(crc, *((const u64 *)src_u8));
src_u8 += sizeof(u64);
}
_CRC_REMAINDER(u32, w);
_CRC_REMAINDER(u16, h);
_CRC_REMAINDER(u8, b);
return ~crc;
}
/// Calculate a CRC32 over data.
static inline u32 crc32Calculate(const void *src, size_t size) {
return crc32CalculateWithSeed(0, src, size);
}
/// Calculate a CRC32C over data using a seed.
/// Can be used to calculate a CRC32C in chunks using an initial seed of zero for the first chunk.
static inline u32 crc32cCalculateWithSeed(u32 seed, const void *src, size_t size) {
const u8 *src_u8 = (const u8 *)src;
u32 crc = ~seed;
s64 len = size;
_CRC_ALIGN(u8, cb);
_CRC_ALIGN(u16, ch);
_CRC_ALIGN(u32, cw);
while ((len -= sizeof(u64)) >= 0) {
crc = __crc32cd(crc, *((const u64 *)src_u8));
src_u8 += sizeof(u64);
}
_CRC_REMAINDER(u32, cw);
_CRC_REMAINDER(u16, ch);
_CRC_REMAINDER(u8, cb);
return ~crc;
}
/// Calculate a CRC32C over data.
static inline u32 crc32cCalculate(const void *src, size_t size) {
return crc32cCalculateWithSeed(0, src, size);
}
#undef _CRC_REMAINDER
#undef _CRC_ALIGN

View File

@ -0,0 +1,51 @@
/**
* @file hmac.h
* @brief Hardware accelerated HMAC-SHA(1, 256) implementation.
* @copyright libnx Authors
*/
#pragma once
#include "sha1.h"
#include "sha256.h"
/// Context for HMAC-SHA1 operations.
typedef struct {
Sha1Context sha_ctx;
u32 key[SHA1_BLOCK_SIZE / sizeof(u32)];
u32 mac[SHA1_HASH_SIZE / sizeof(u32)];
bool finalized;
} HmacSha1Context;
/// Context for HMAC-SHA256 operations.
typedef struct {
Sha256Context sha_ctx;
u32 key[SHA256_BLOCK_SIZE / sizeof(u32)];
u32 mac[SHA256_HASH_SIZE / sizeof(u32)];
bool finalized;
} HmacSha256Context;
#ifndef HMAC_SHA1_KEY_MAX
#define HMAC_SHA1_KEY_MAX (sizeof(((HmacSha1Context *)NULL)->key))
#endif
#ifndef HMAC_SHA256_KEY_MAX
#define HMAC_SHA256_KEY_MAX (sizeof(((HmacSha256Context *)NULL)->key))
#endif
/// Initialize a HMAC-SHA256 context.
void hmacSha256ContextCreate(HmacSha256Context *out, const void *key, size_t key_size);
/// Updates HMAC-SHA256 context with data to hash
void hmacSha256ContextUpdate(HmacSha256Context *ctx, const void *src, size_t size);
/// Gets the context's output mac, finalizes the context.
void hmacSha256ContextGetMac(HmacSha256Context *ctx, void *dst);
/// Simple all-in-one HMAC-SHA256 calculator.
void hmacSha256CalculateMac(void *dst, const void *key, size_t key_size, const void *src, size_t size);
/// Initialize a HMAC-SHA1 context.
void hmacSha1ContextCreate(HmacSha1Context *out, const void *key, size_t key_size);
/// Updates HMAC-SHA1 context with data to hash
void hmacSha1ContextUpdate(HmacSha1Context *ctx, const void *src, size_t size);
/// Gets the context's output mac, finalizes the context.
void hmacSha1ContextGetMac(HmacSha1Context *ctx, void *dst);
/// Simple all-in-one HMAC-SHA1 calculator.
void hmacSha1CalculateMac(void *dst, const void *key, size_t key_size, const void *src, size_t size);

View File

@ -0,0 +1,34 @@
/**
* @file sha1.h
* @brief Hardware accelerated SHA1 implementation.
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#ifndef SHA1_HASH_SIZE
#define SHA1_HASH_SIZE 0x14
#endif
#ifndef SHA1_BLOCK_SIZE
#define SHA1_BLOCK_SIZE 0x40
#endif
/// Context for SHA1 operations.
typedef struct {
u32 intermediate_hash[SHA1_HASH_SIZE / sizeof(u32)];
u8 buffer[SHA1_BLOCK_SIZE];
u64 bits_consumed;
size_t num_buffered;
bool finalized;
} Sha1Context;
/// Initialize a SHA1 context.
void sha1ContextCreate(Sha1Context *out);
/// Updates SHA1 context with data to hash
void sha1ContextUpdate(Sha1Context *ctx, const void *src, size_t size);
/// Gets the context's output hash, finalizes the context.
void sha1ContextGetHash(Sha1Context *ctx, void *dst);
/// Simple all-in-one SHA1 calculator.
void sha1CalculateHash(void *dst, const void *src, size_t size);

View File

@ -0,0 +1,35 @@
/**
* @file sha256.h
* @brief Hardware accelerated SHA256 implementation.
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#ifndef SHA256_HASH_SIZE
#define SHA256_HASH_SIZE 0x20
#endif
#ifndef SHA256_BLOCK_SIZE
#define SHA256_BLOCK_SIZE 0x40
#endif
/// Context for SHA256 operations.
typedef struct {
u32 intermediate_hash[SHA256_HASH_SIZE / sizeof(u32)];
u8 buffer[SHA256_BLOCK_SIZE];
u64 bits_consumed;
size_t num_buffered;
bool finalized;
} Sha256Context;
/// Initialize a SHA256 context.
void sha256ContextCreate(Sha256Context *out);
/// Updates SHA256 context with data to hash
void sha256ContextUpdate(Sha256Context *ctx, const void *src, size_t size);
/// Gets the context's output hash, finalizes the context.
void sha256ContextGetHash(Sha256Context *ctx, void *dst);
/// Simple all-in-one SHA256 calculator.
void sha256CalculateHash(void *dst, const void *src, size_t size);

View File

@ -0,0 +1,51 @@
#pragma once
#include "../types.h"
#include "../kernel/event.h"
#include "../sf/service.h"
#define BINDER_FIRST_CALL_TRANSACTION 0x1
typedef struct {
bool created;
bool initialized;
s32 id;
size_t dummy;
Service* relay;
} Binder;
// Note: binderClose will not close the session_handle provided to binderCreate.
void binderCreate(Binder* b, s32 id);
void binderClose(Binder* b);
Result binderInitSession(Binder* b, Service* relay);
Result binderTransactParcel(
Binder* b, u32 code,
void* parcel_data, size_t parcel_data_size,
void* parcel_reply, size_t parcel_reply_size,
u32 flags);
Result binderConvertErrorCode(s32 code);
Result binderAdjustRefcount(Binder* b, s32 addval, s32 type);
Result binderGetNativeHandle(Binder* b, u32 unk0, Event *event_out);
static inline Result binderIncreaseWeakRef(Binder* b)
{
return binderAdjustRefcount(b, 1, 0);
}
static inline Result binderDecreaseWeakRef(Binder* b)
{
return binderAdjustRefcount(b, -1, 0);
}
static inline Result binderIncreaseStrongRef(Binder* b)
{
return binderAdjustRefcount(b, 1, 1);
}
static inline Result binderDecreaseStrongRef(Binder* b)
{
return binderAdjustRefcount(b, -1, 1);
}

View File

@ -0,0 +1,49 @@
#pragma once
#include "types.h"
#include "binder.h"
#include "../nvidia/fence.h"
typedef struct {
s32 left;
s32 top;
s32 right;
s32 bottom;
} BqRect;
typedef struct {
struct { s64 timestamp; } NX_PACKED;
s32 isAutoTimestamp;
BqRect crop;
s32 scalingMode;
u32 transform; // See the NATIVE_WINDOW_TRANSFORM_* enums.
u32 stickyTransform;
u32 unk;
u32 swapInterval;
NvMultiFence fence;
} BqBufferInput;
typedef struct {
u32 width;
u32 height;
u32 transformHint;
u32 numPendingBuffers;
} BqBufferOutput;
typedef struct {
u32 width;
u32 height;
u32 stride;
u32 format;
u32 usage;
NativeHandle* native_handle;
} BqGraphicBuffer;
Result bqRequestBuffer(Binder *b, s32 bufferIdx, BqGraphicBuffer *buf);
Result bqDequeueBuffer(Binder *b, bool async, u32 width, u32 height, s32 format, u32 usage, s32 *buf, NvMultiFence *fence);
Result bqDetachBuffer(Binder *b, s32 slot);
Result bqQueueBuffer(Binder *b, s32 buf, const BqBufferInput *input, BqBufferOutput *output);
Result bqCancelBuffer(Binder *b, s32 buf, const NvMultiFence *fence);
Result bqQuery(Binder *b, s32 what, s32* value);
Result bqConnect(Binder *b, s32 api, bool producerControlledByApp, BqBufferOutput *output);
Result bqDisconnect(Binder *b, s32 api);
Result bqSetPreallocatedBuffer(Binder *b, s32 buf, const BqGraphicBuffer *input);

View File

@ -0,0 +1,104 @@
/**
* @file framebuffer.h
* @brief Framebuffer wrapper object, providing support for software rendered graphics.
* @author fincs
* @copyright libnx Authors
*/
#pragma once
#include "../nvidia/map.h"
#include "native_window.h"
/// Converts red/green/blue/alpha components to packed RGBA8 (i.e. \ref PIXEL_FORMAT_RGBA_8888).
#define RGBA8(r,g,b,a) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(((a)&0xff)<<24))
/// Same as \ref RGBA8 except with alpha=0xff.
#define RGBA8_MAXALPHA(r,g,b) RGBA8((r),(g),(b),0xff)
/// Converts red/green/blue to packed RGBX8 (i.e. \ref PIXEL_FORMAT_RGBX_8888).
#define RGBX8(r,g,b) RGBA8((r),(g),(b),0)
/// Converts red/green/blue components to packed RGB565 (i.e. \ref PIXEL_FORMAT_RGB_565)
#define RGB565(r,g,b) (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11))
/// Same as \ref RGB565 but accepting 8-bit components as input instead.
#define RGB565_FROM_RGB8(r,g,b) RGB565((r)>>3,(g)>>2,(b)>>3)
/// Converts red/green/blue/alpha components to packed BGR8 (i.e. \ref PIXEL_FORMAT_BGRA_8888).
#define BGRA8(r,g,b,a) RGBA8((b),(g),(r),(a))
/// Same as \ref BGRA8 except with alpha=0xff.
#define BGRA8_MAXALPHA(r,g,b) RGBA8((b),(g),(r),0xff)
/// Converts red/green/blue/alpha components to packed RGBA4 (i.e. \ref PIXEL_FORMAT_RGBA_4444).
#define RGBA4(r,g,b,a) (((r)&0xf)|(((g)&0xf)<<4)|(((b)&0xf)<<8)|(((a)&0xf)<<12))
/// Same as \ref RGBA4 except with alpha=0xf.
#define RGBA4_MAXALPHA(r,g,b) RGBA4((r),(g),(b),0xf)
/// Same as \ref RGBA4 but accepting 8-bit components as input instead.
#define RGBA4_FROM_RGBA8(r,g,b,a) RGBA4((r)>>4,(g)>>4,(b)>>4,(a)>>4)
/// Same as \ref RGBA4_MAXALPHA except with alpha=0xff.
#define RGBA4_FROM_RGBA8_MAXALPHA(r,g,b) RGBA4_MAXALPHA((r)>>4,(g)>>4,(b)>>4)
/// Framebuffer structure.
typedef struct Framebuffer {
NWindow *win;
NvMap map;
void* buf;
void* buf_linear;
u32 stride;
u32 width_aligned;
u32 height_aligned;
u32 num_fbs;
u32 fb_size;
bool has_init;
} Framebuffer;
/**
* @brief Creates a \ref Framebuffer object.
* @param[out] fb Output \ref Framebuffer structure.
* @param[in] win Pointer to the \ref NWindow to which the \ref Framebuffer will be registered.
* @param[in] width Desired width of the framebuffer (usually 1280).
* @param[in] height Desired height of the framebuffer (usually 720).
* @param[in] format Desired pixel format (see PIXEL_FORMAT_* enum).
* @param[in] num_fbs Number of buffers to create. Pass 1 for single-buffering, 2 for double-buffering or 3 for triple-buffering.
* @note Framebuffer images are stored in Tegra block linear format with 16Bx2 sector ordering, read TRM chapter 20.1 for more details.
* In order to use regular linear layout, consider calling \ref framebufferMakeLinear after the \ref Framebuffer object is created.
* @note Presently, only the following pixel formats are supported:
* \ref PIXEL_FORMAT_RGBA_8888
* \ref PIXEL_FORMAT_RGBX_8888
* \ref PIXEL_FORMAT_RGB_565
* \ref PIXEL_FORMAT_BGRA_8888
* \ref PIXEL_FORMAT_RGBA_4444
*/
Result framebufferCreate(Framebuffer* fb, NWindow *win, u32 width, u32 height, u32 format, u32 num_fbs);
/// Enables linear framebuffer mode in a \ref Framebuffer, allocating a shadow buffer in the process.
Result framebufferMakeLinear(Framebuffer* fb);
/// Closes a \ref Framebuffer object, freeing all resources associated with it.
void framebufferClose(Framebuffer* fb);
/**
* @brief Begins rendering a frame in a \ref Framebuffer.
* @param[in] fb Pointer to \ref Framebuffer structure.
* @param[out] out_stride Output variable containing the distance in bytes between rows of pixels in memory.
* @return Pointer to buffer to which new graphics data should be written to.
* @note When this function is called, a buffer will be dequeued from the corresponding \ref NWindow.
* @note This function will return pointers to different buffers, depending on the number of buffers it was initialized with.
* @note If \ref framebufferMakeLinear was used, this function will instead return a pointer to the shadow linear buffer.
* In this case, the offset of a pixel is \p y * \p out_stride + \p x * \p bytes_per_pixel.
* @note Each call to \ref framebufferBegin must be paired with a \ref framebufferEnd call.
*/
void* framebufferBegin(Framebuffer* fb, u32* out_stride);
/**
* @brief Finishes rendering a frame in a \ref Framebuffer.
* @param[in] fb Pointer to \ref Framebuffer structure.
* @note When this function is called, the written image data will be flushed and queued (presented) in the corresponding \ref NWindow.
* @note If \ref framebufferMakeLinear was used, this function will copy the image from the shadow linear buffer to the actual framebuffer,
* converting it in the process to the layout expected by the compositor.
* @note Each call to \ref framebufferBegin must be paired with a \ref framebufferEnd call.
*/
void framebufferEnd(Framebuffer* fb);

View File

@ -0,0 +1,190 @@
/**
* @file native_window.h
* @brief Native window (NWindow) wrapper object, used for presenting images to the display (or other sinks).
* @author fincs
* @copyright libnx Authors
*/
#pragma once
#include "../kernel/mutex.h"
#include "../kernel/event.h"
#include "../services/vi.h"
#include "../nvidia/graphic_buffer.h"
#include "types.h"
#include "binder.h"
#include "buffer_producer.h"
/// Native window structure.
typedef struct NWindow {
u32 magic;
Binder bq;
Event event;
Mutex mutex;
u64 slots_configured;
u64 slots_requested;
s32 cur_slot;
u32 width;
u32 height;
u32 format;
u32 usage;
BqRect crop;
u32 scaling_mode;
u32 transform;
u32 sticky_transform;
u32 default_width;
u32 default_height;
u32 swap_interval;
bool is_connected;
bool producer_controlled_by_app;
bool consumer_running_behind;
} NWindow;
///@name Basic functions
///@{
/// Checks whether a pointer refers to a valid \ref NWindow object.
bool nwindowIsValid(NWindow* nw);
/**
* @brief Retrieves the default \ref NWindow object.
* @return Pointer to the default \ref NWindow object.
* @note When this function is used/referenced, libnx will initialize VI services
* and create a \ref NWindow object from a \ref ViLayer created on the default \ref ViDisplay;
* all of this happening automatically during application startup (i.e. before main is called).
* If creating the default \ref NWindow fails, libnx will throw a LibnxError_BadGfxInit fatal error.
* Likewise, after main returns (or exit is called) libnx will clean up all resources used by it.
*/
NWindow* nwindowGetDefault(void);
/**
* @brief Creates a \ref NWindow.
* @param[out] nw Output \ref NWindow structure.
* @param[in] binder_session Service object for the Android IGraphicBufferProducer binder session.
* @param[in] binder_id Android IGraphicBufferProducer binder session ID.
* @param[in] producer_controlled_by_app Specifies whether the producer is controlled by the application.
*/
Result nwindowCreate(NWindow* nw, Service* binder_session, s32 binder_id, bool producer_controlled_by_app);
/**
* @brief Creates a \ref NWindow operating on a \ref ViLayer.
* @param[out] nw Output \ref NWindow structure.
* @param[in] layer Pointer to \ref ViLayer structure (such as the one returned by \ref viCreateLayer).
*/
Result nwindowCreateFromLayer(NWindow* nw, const ViLayer* layer);
/// Closes a \ref NWindow, freeing all resources associated with it.
void nwindowClose(NWindow* nw);
///@}
///@name Window configuration
///@{
/**
* @brief Retrieves the dimensions of a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[out] out_width Output variable containing the width of the \ref NWindow.
* @param[out] out_height Output variable containing the height of the \ref NWindow.
* @note After creation, a \ref NWindow reports a default size (usually 1280x720).
* This size can be overriden by calling \ref nwindowSetDimensions.
*/
Result nwindowGetDimensions(NWindow* nw, u32* out_width, u32* out_height);
/**
* @brief Sets the dimensions of a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] width Desired width of the \ref NWindow.
* @param[in] height Desired width of the \ref NWindow.
* @note This function cannot be called when there are buffers registered with the \ref NWindow.
*/
Result nwindowSetDimensions(NWindow* nw, u32 width, u32 height);
/**
* @brief Configures the crop applied to images presented through a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] left X coordinate of the left margin of the crop bounding box.
* @param[in] top Y coordinate of the top margin of the crop bounding box.
* @param[in] right X coordinate of the right margin of the crop bounding box.
* @param[in] bottom Y coordinate of the bottom margin of the crop bounding box.
* @note Passing zero to all parameters disables the crop functionality. This is also the default.
* @note The bounding box defined by the parameters will be adjusted to fit within the dimensions of the \ref NWindow.
* @note \p left must be less or equal than \p right.
* @note \p top must be less or equal than \p bottom.
*/
Result nwindowSetCrop(NWindow* nw, s32 left, s32 top, s32 right, s32 bottom);
/**
* @brief Configures the transformation applied to images presented through a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] transform Android transformation mode (see NATIVE_WINDOW_TRANSFORM_* enum)
* @note The default transformation is 0 (i.e. no transformation applied)
*/
Result nwindowSetTransform(NWindow* nw, u32 transform);
/**
* @brief Configures the swap interval of a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] swap_interval Value specifying the number of display refreshes (VBlanks) that must occur between presenting images.
* @note The default swap interval is 1.
* @note If the \ref NWindow has three or more buffers configured (with \ref nwindowConfigureBuffer), it is possible to pass 0
* to disable the swap interval feature and present images as fast as allowed by the compositor. Otherwise, the system
* enforces a minimum of 1 as the swap interval.
*/
Result nwindowSetSwapInterval(NWindow* nw, u32 swap_interval);
/// Checks whether the consumer of a \ref NWindow is running behind.
static inline bool nwindowIsConsumerRunningBehind(NWindow* nw)
{
return nw->consumer_running_behind;
}
///@}
///@name Buffer configuration and presentation
///@{
/**
* @brief Registers a \ref NvGraphicBuffer with a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] slot ID of the slot to configure (starting from 0).
* @param[in] buf Pointer to \ref NvGraphicBuffer structure.
* @note When a buffer is registered, it is added to the internal queue of buffers used for presenting.
* @note All buffers registered with a \ref NWindow must have the same dimensions, format and usage.
* If \ref nwindowSetDimensions has not been previously called, the \ref NWindow will automatically
* adopt the dimensions of the first buffer registered with it. Otherwise, said buffer will need
* to match the dimensions that were previously configured.
*/
Result nwindowConfigureBuffer(NWindow* nw, s32 slot, NvGraphicBuffer* buf);
/**
* @brief Dequeues a buffer from a \ref NWindow.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[out] out_slot Output variable containing the ID of the slot that has been dequeued.
* @param[out] out_fence Output variable containing a \ref NvMultiFence that will be signalled by
* the compositor when the buffer is ready to be written to. Pass NULL to wait instead
* on this fence before this function returns.
* @note For \p out_fence=NULL to work, \ref nvFenceInit must have been previously called.
*/
Result nwindowDequeueBuffer(NWindow* nw, s32* out_slot, NvMultiFence* out_fence);
/**
* @brief Cancels a buffer previously dequeued with \ref nwindowDequeueBuffer.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] slot ID of the slot to cancel. This must match the output of the previous \ref nwindowDequeueBuffer call.
* @param[in] fence Pointer to the \ref NvMultiFence that will be waited on by the compositor before cancelling the buffer.
* Pass NULL if there is no such fence.
*/
Result nwindowCancelBuffer(NWindow* nw, s32 slot, const NvMultiFence* fence);
/**
* @brief Queues a buffer previously dequeued with \ref nwindowDequeueBuffer, making it ready for presentation.
* @param[in] nw Pointer to \ref NWindow structure.
* @param[in] slot ID of the slot to queue. This must match the output of the previous \ref nwindowDequeueBuffer call.
* @param[in] fence Pointer to the \ref NvMultiFence that will be waited on by the compositor before queuing/presenting the buffer.
* Pass NULL if there is no such fence.
*/
Result nwindowQueueBuffer(NWindow* nw, s32 slot, const NvMultiFence* fence);
/// Releases all buffers registered with a \ref NWindow.
Result nwindowReleaseBuffers(NWindow* nw);
///@}

View File

@ -1,21 +1,30 @@
#pragma once
#include "../result.h"
#include "../gfx/binder.h"
#include "../display/binder.h"
typedef struct {
u8 payload[0x400];
u32 capacity;
u32 size;
u32 pos;
u32 payload_size;
u32 payload_off;
u32 objects_size;
u32 objects_off;
} ParcelHeader;
u8 *ParcelObjects;
u32 ParcelObjectsSize;
#define PARCEL_MAX_PAYLOAD 0x400
typedef struct {
u8 payload[PARCEL_MAX_PAYLOAD];
u32 payload_size;
u8* objects;
u32 objects_size;
u32 capacity;
u32 pos;
} Parcel;
void parcelInitialize(Parcel *ctx);
void parcelCreate(Parcel *ctx);
Result parcelTransact(Binder *session, u32 code, Parcel *in_parcel, Parcel *reply_parcel);
void* parcelWriteData(Parcel *ctx, void* data, size_t data_size);
void* parcelWriteData(Parcel *ctx, const void* data, size_t data_size);
void* parcelReadData(Parcel *ctx, void* data, size_t data_size);
void parcelWriteInt32(Parcel *ctx, s32 val);
@ -27,5 +36,5 @@ u32 parcelReadUInt32(Parcel *ctx);
void parcelWriteInterfaceToken(Parcel *ctx, const char *str);
void* parcelReadFlattenedObject(Parcel *ctx, size_t *size);
void* parcelWriteFlattenedObject(Parcel *ctx, void* data, size_t size);
void* parcelWriteFlattenedObject(Parcel *ctx, const void* data, size_t size);

View File

@ -0,0 +1,147 @@
/**
* @file display/types.h
* @brief Definitions for Android-related types and enumerations.
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
// From Android PixelFormat.h & graphics-base-v1.0.h.
enum {
PIXEL_FORMAT_RGBA_8888 = 1U,
PIXEL_FORMAT_RGBX_8888 = 2U,
PIXEL_FORMAT_RGB_888 = 3U,
PIXEL_FORMAT_RGB_565 = 4U,
PIXEL_FORMAT_BGRA_8888 = 5U,
PIXEL_FORMAT_RGBA_5551 = 6U,
PIXEL_FORMAT_RGBA_4444 = 7U,
PIXEL_FORMAT_YCRCB_420_SP = 17U,
PIXEL_FORMAT_RAW16 = 32U,
PIXEL_FORMAT_BLOB = 33U,
PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 34U,
PIXEL_FORMAT_YCBCR_420_888 = 35U,
PIXEL_FORMAT_Y8 = 0x20203859U,
PIXEL_FORMAT_Y16 = 0x20363159U,
PIXEL_FORMAT_YV12 = 0x32315659U,
};
// From Android gralloc.h.
enum {
/* buffer is never read in software */
GRALLOC_USAGE_SW_READ_NEVER = 0x00000000U,
/* buffer is rarely read in software */
GRALLOC_USAGE_SW_READ_RARELY = 0x00000002U,
/* buffer is often read in software */
GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
/* mask for the software read values */
GRALLOC_USAGE_SW_READ_MASK = 0x0000000FU,
/* buffer is never written in software */
GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000U,
/* buffer is rarely written in software */
GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020U,
/* buffer is often written in software */
GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
/* mask for the software write values */
GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0U,
/* buffer will be used as an OpenGL ES texture */
GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
/* buffer will be used as an OpenGL ES render target */
GRALLOC_USAGE_HW_RENDER = 0x00000200U,
/* buffer will be used by the 2D hardware blitter */
GRALLOC_USAGE_HW_2D = 0x00000400U,
/* buffer will be used by the HWComposer HAL module */
GRALLOC_USAGE_HW_COMPOSER = 0x00000800U,
/* buffer will be used with the framebuffer device */
GRALLOC_USAGE_HW_FB = 0x00001000U,
/* buffer should be displayed full-screen on an external display when
* possible */
GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000U,
/* Must have a hardware-protected path to external display sink for
* this buffer. If a hardware-protected path is not available, then
* either don't composite only this buffer (preferred) to the
* external sink, or (less desirable) do not route the entire
* composition to the external sink. */
GRALLOC_USAGE_PROTECTED = 0x00004000U,
/* buffer may be used as a cursor */
GRALLOC_USAGE_CURSOR = 0x00008000U,
/* buffer will be used with the HW video encoder */
GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000U,
/* buffer will be written by the HW camera pipeline */
GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000U,
/* buffer will be read by the HW camera pipeline */
GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000U,
/* buffer will be used as part of zero-shutter-lag queue */
GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000U,
/* mask for the camera access values */
GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000U,
/* mask for the software usage bit-mask */
GRALLOC_USAGE_HW_MASK = 0x00071F00U,
/* buffer will be used as a RenderScript Allocation */
GRALLOC_USAGE_RENDERSCRIPT = 0x00100000U,
};
// From Android window.h.
/* attributes queriable with query() */
enum {
NATIVE_WINDOW_WIDTH = 0,
NATIVE_WINDOW_HEIGHT = 1,
NATIVE_WINDOW_FORMAT = 2,
//...
// NATIVE_WINDOW_DEFAULT_WIDTH = 6, //These two return invalid data.
// NATIVE_WINDOW_DEFAULT_HEIGHT = 7,
};
// From Android window.h.
/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
enum {
//...
/* Buffers will be queued after being filled using the CPU
*/
NATIVE_WINDOW_API_CPU = 2,
//...
};
// From Android hardware.h.
/**
* Transformation definitions
*
* IMPORTANT NOTE:
* HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
*
*/
enum {
/* flip source image horizontally (around the vertical axis) */
HAL_TRANSFORM_FLIP_H = 0x01,
/* flip source image vertically (around the horizontal axis)*/
HAL_TRANSFORM_FLIP_V = 0x02,
/* rotate source image 90 degrees clockwise */
HAL_TRANSFORM_ROT_90 = 0x04,
/* rotate source image 180 degrees */
HAL_TRANSFORM_ROT_180 = 0x03,
/* rotate source image 270 degrees clockwise */
HAL_TRANSFORM_ROT_270 = 0x07,
};
// From Android window.h.
/* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */
enum {
/* flip source image horizontally */
NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
/* flip source image vertically */
NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
/* rotate source image 90 degrees clock-wise */
NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
/* rotate source image 180 degrees */
NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
/* rotate source image 270 degrees clock-wise */
NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
};
// From Android native_handle.h.
typedef struct {
int version;
int num_fds;
int num_ints;
} NativeHandle;

View File

@ -1,29 +0,0 @@
#pragma once
#include "../types.h"
#define BINDER_FIRST_CALL_TRANSACTION 0x1
typedef struct {
bool created;
bool initialized;
Handle sessionHandle;
s32 id;
Handle nativeHandle;
size_t ipcBufferSize;
bool hasTransactAuto;
} Binder;
// binderExitSession will not close the sessionHandle since it's user-specified via binderCreateSession and may be used elsewhere.
void binderCreateSession(Binder *session, Handle sessionHandle, s32 ID);
Result binderInitSession(Binder *session, u32 unk0);
void binderExitSession(Binder *session);
Result binderTransactParcel(
Binder *session, u32 code,
void* parcel_data, size_t parcel_data_size,
void* parcel_reply, size_t parcel_reply_size,
u32 flags);
Result binderAdjustRefcount(Binder *session, s32 addval, s32 type);
Result binderGetNativeHandle(Binder *session, u32 unk0, Handle *handle_out);

View File

@ -1,151 +0,0 @@
#pragma once
#include "../gfx/nvioctl.h"
typedef struct {
u32 is_valid;
nvioctl_fence nv_fences[4];
} PACKED bufferProducerFence;
typedef struct {
s32 left;
s32 top;
s32 right;
s32 bottom;
} PACKED bufferProducerRect;
typedef struct {
s64 timestamp;
s32 isAutoTimestamp;
bufferProducerRect crop;
s32 scalingMode;
u32 transform;//See the NATIVE_WINDOW_TRANSFORM_* enums.
u32 stickyTransform;
u32 unk[2];
bufferProducerFence fence;
} PACKED bufferProducerQueueBufferInput;
typedef struct {
u32 width;
u32 height;
u32 transformHint;
u32 numPendingBuffers;
} PACKED bufferProducerQueueBufferOutput;
typedef struct {
u32 magic;
u32 width;
u32 height;
u32 stride;
u32 format;
u32 usage;
u32 pid;
u32 refcount;
u32 numFds;
u32 numInts;
struct {//Actual size is numFds*4 + numInts*4.
u32 unk_x0;
u32 nvmap_handle0;
u32 unk_x8;
u32 unk_xc;
u32 unk_x10;
u32 unk_x14;
u32 unk_x18;
u32 unk_x1c;
u32 unk_x20;
u32 width_unk0;
u32 buffer_size0;
u32 unk_x2c;
u32 unk_x30;
u32 width_unk1;
u32 height_unk;
u32 flags;
u32 unk_x40;
u32 unk_x44;
u32 byte_stride;
u32 nvmap_handle1;
u32 buffer_offset;
u32 unk_x54;
u32 unk_x58;
u32 unk_x5c;
u32 unk_x60;
u32 unk_x64;
u32 unk_x68;
u32 buffer_size1;
u32 unk_x70[0x33];//Normally all-zero.
u64 timestamp;
} PACKED data;
} PACKED bufferProducerGraphicBuffer;
//From Android window.h.
/* attributes queriable with query() */
enum {
NATIVE_WINDOW_WIDTH = 0,
NATIVE_WINDOW_HEIGHT = 1,
NATIVE_WINDOW_FORMAT = 2,
//...
// NATIVE_WINDOW_DEFAULT_WIDTH = 6, //These two return invalid data.
// NATIVE_WINDOW_DEFAULT_HEIGHT = 7,
};
//From Android window.h.
/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
enum {
//...
/* Buffers will be queued after being filled using the CPU
*/
NATIVE_WINDOW_API_CPU = 2,
//...
};
//From Android hardware.h.
/**
* Transformation definitions
*
* IMPORTANT NOTE:
* HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
*
*/
enum {
/* flip source image horizontally (around the vertical axis) */
HAL_TRANSFORM_FLIP_H = 0x01,
/* flip source image vertically (around the horizontal axis)*/
HAL_TRANSFORM_FLIP_V = 0x02,
/* rotate source image 90 degrees clockwise */
HAL_TRANSFORM_ROT_90 = 0x04,
/* rotate source image 180 degrees */
HAL_TRANSFORM_ROT_180 = 0x03,
/* rotate source image 270 degrees clockwise */
HAL_TRANSFORM_ROT_270 = 0x07,
};
//From Android window.h.
/* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */
enum {
/* flip source image horizontally */
NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
/* flip source image vertically */
NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
/* rotate source image 90 degrees clock-wise */
NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
/* rotate source image 180 degrees */
NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
/* rotate source image 270 degrees clock-wise */
NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
};
Result bufferProducerInitialize(Binder *session);
void bufferProducerExit(void);
Result bufferProducerRequestBuffer(s32 bufferIdx, bufferProducerGraphicBuffer *buf);
Result bufferProducerDequeueBuffer(bool async, u32 width, u32 height, s32 format, u32 usage, s32 *buf, bufferProducerFence *fence);
Result bufferProducerDetachBuffer(s32 slot);
Result bufferProducerQueueBuffer(s32 buf, bufferProducerQueueBufferInput *input, bufferProducerQueueBufferOutput *output);
Result bufferProducerQuery(s32 what, s32* value);
Result bufferProducerConnect(s32 api, bool producerControlledByApp, bufferProducerQueueBufferOutput *output);
Result bufferProducerDisconnect(s32 api);
Result bufferProducerGraphicBufferInit(s32 buf, bufferProducerGraphicBuffer *input);

View File

@ -1,108 +0,0 @@
/**
* @file gfx.h
* @brief High-level graphics API.
* This API exposes a framebuffer (technically speaking, a windowbuffer) to be used for drawing graphics.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
/// Converts red, green, blue, and alpha components to packed RGBA8.
#define RGBA8(r,g,b,a) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(((a)&0xff)<<24))
/// Same as \ref RGBA8 except with alpha=0xff.
#define RGBA8_MAXALPHA(r,g,b) RGBA8(r,g,b,0xff)
/// GfxMode set by \ref gfxSetMode. The default is GfxMode_LinearDouble. Note that the text-console (see console.h) sets this to GfxMode_TiledSingle.
typedef enum
{
GfxMode_TiledSingle, ///< Single-buffering with raw tiled (block-linear) framebuffer.
GfxMode_TiledDouble, ///< Double-buffering with raw tiled (block-linear) framebuffer.
GfxMode_LinearDouble ///< Double-buffering with linear framebuffer, which is transferred to the actual framebuffer by \ref gfxFlushBuffers().
} GfxMode;
/**
* @brief Initializes the graphics subsystem.
* @warning Do not use \ref viInitialize when using this function.
*/
void gfxInitDefault(void);
/**
* @brief Uninitializes the graphics subsystem.
* @warning Do not use \ref viExit when using this function.
*/
void gfxExit(void);
/**
* @brief Sets the resolution to be used when initializing the graphics subsystem.
* @param[in] width Horizontal resolution, in pixels.
* @param[in] height Vertical resolution, in pixels.
* @note The default resolution is 720p.
* @note This can only be used before calling \ref gfxInitDefault, this will use \ref fatalSimple otherwise. If the input is 0, the default resolution will be used during \ref gfxInitDefault. This sets the maximum resolution for the framebuffer, used during \ref gfxInitDefault. This is also used as the current resolution when crop isn't set. The width/height are reset to the default when \ref gfxExit is used.
* @note Normally you should only use this when you need a maximum resolution larger than the default, see above.
* @note The width and height are aligned to 4.
*/
void gfxInitResolution(u32 width, u32 height);
/// Wrapper for \ref gfxInitResolution with resolution=1080p. Use this if you want to support 1080p or >720p in docked-mode.
void gfxInitResolutionDefault(void);
/// Configure framebuffer crop, by default crop is all-zero. Use all-zero input to reset to default. \ref gfxExit resets this to the default.
/// When the input is invalid this returns without changing the crop data, this includes the input values being larger than the framebuf width/height.
/// This will update the display width/height returned by \ref gfxGetFramebuffer, with that width/height being reset to the default when required.
/// \ref gfxGetFramebufferDisplayOffset uses absolute x/y, it will not adjust for non-zero crop left/top.
/// The new crop config will not take affect with double-buffering disabled. When used during frame-drawing, this should be called before \ref gfxGetFramebuffer.
/// The right and bottom params are aligned to 4.
void gfxConfigureCrop(s32 left, s32 top, s32 right, s32 bottom);
/// Wrapper for \ref gfxConfigureCrop. Use this to set the resolution, within the bounds of the maximum resolution. Use all-zero input to reset to default.
void gfxConfigureResolution(s32 width, s32 height);
/// If enabled, \ref gfxConfigureResolution will be used with the input resolution for the current OperationMode. Then \ref gfxConfigureResolution will automatically be used with the specified resolution each time OperationMode changes.
void gfxConfigureAutoResolution(bool enable, s32 handheld_width, s32 handheld_height, s32 docked_width, s32 docked_height);
/// Wrapper for \ref gfxConfigureAutoResolution. handheld_resolution=720p, docked_resolution={all-zero for using current maximum resolution}.
void gfxConfigureAutoResolutionDefault(bool enable);
/// Waits for vertical sync.
void gfxWaitForVsync(void);
/// Swaps the framebuffers (for double-buffering).
void gfxSwapBuffers(void);
/// Get the current framebuffer address, with optional output ptrs for the display framebuffer width/height. The display width/height is adjusted by \ref gfxConfigureCrop and \ref gfxConfigureResolution.
u8* gfxGetFramebuffer(u32* width, u32* height);
/// Get the framebuffer width/height without crop.
void gfxGetFramebufferResolution(u32* width, u32* height);
/// Use this to get the actual byte-size of the framebuffer for use with memset/etc.
size_t gfxGetFramebufferSize(void);
/// Sets the \ref GfxMode.
void gfxSetMode(GfxMode mode);
/// Flushes the framebuffer in the data cache. When \ref GfxMode is GfxMode_LinearDouble, this also transfers the linear-framebuffer to the actual framebuffer.
void gfxFlushBuffers(void);
/// Use this to get the pixel-offset in the framebuffer. Returned value is in pixels, not bytes.
/// This implements tegra blocklinear, with hard-coded constants etc.
/// Do not use this when \ref GfxMode is GfxMode_LinearDouble.
static inline u32 gfxGetFramebufferDisplayOffset(u32 x, u32 y) {
u32 tmp_pos;
extern size_t g_gfx_framebuf_aligned_width;
extern size_t g_gfx_framebuf_display_height;
//if (x >= g_gfx_framebuf_width || y >= g_gfx_framebuf_display_height) return (gfxGetFramebufferSize()-4)/4;//Return the last pixel-offset in the buffer, the data located here is not displayed due to alignment. (Disabled for perf)
y = g_gfx_framebuf_display_height-1-y;
tmp_pos = ((y & 127) / 16) + (x/16*8) + ((y/16/8)*(g_gfx_framebuf_aligned_width/16*8));
tmp_pos *= 16*16 * 4;
tmp_pos += ((y%16)/8)*512 + ((x%16)/8)*256 + ((y%8)/2)*64 + ((x%8)/4)*32 + (y%2)*16 + (x%4)*4;//This line is a modified version of code from the Tegra X1 datasheet.
return tmp_pos / 4;
}

View File

@ -1,47 +0,0 @@
#pragma once
//The below defines are based on Linux kernel ioctl.h.
#define _NV_IOC_NRBITS 8
#define _NV_IOC_TYPEBITS 8
#define _NV_IOC_SIZEBITS 14
#define _NV_IOC_DIRBITS 2
#define _NV_IOC_NRMASK ((1 << _NV_IOC_NRBITS)-1)
#define _NV_IOC_TYPEMASK ((1 << _NV_IOC_TYPEBITS)-1)
#define _NV_IOC_SIZEMASK ((1 << _NV_IOC_SIZEBITS)-1)
#define _NV_IOC_DIRMASK ((1 << _NV_IOC_DIRBITS)-1)
#define _NV_IOC_NRSHIFT 0
#define _NV_IOC_TYPESHIFT (_NV_IOC_NRSHIFT+_NV_IOC_NRBITS)
#define _NV_IOC_SIZESHIFT (_NV_IOC_TYPESHIFT+_NV_IOC_TYPEBITS)
#define _NV_IOC_DIRSHIFT (_NV_IOC_SIZESHIFT+_NV_IOC_SIZEBITS)
/*
* Direction bits.
*/
#define _NV_IOC_NONE 0U
#define _NV_IOC_WRITE 1U
#define _NV_IOC_READ 2U
#define _NV_IOC(dir,type,nr,size) \
(((dir) << _NV_IOC_DIRSHIFT) | \
((type) << _NV_IOC_TYPESHIFT) | \
((nr) << _NV_IOC_NRSHIFT) | \
((size) << _NV_IOC_SIZESHIFT))
/* used to create numbers */
#define _NV_IO(type,nr) _NV_IOC(_NV_IOC_NONE,(type),(nr),0)
#define _NV_IOR(type,nr,size) _NV_IOC(_NV_IOC_READ,(type),(nr),sizeof(size))
#define _NV_IOW(type,nr,size) _NV_IOC(_NV_IOC_WRITE,(type),(nr),sizeof(size))
#define _NV_IOWR(type,nr,size) _NV_IOC(_NV_IOC_READ|_NV_IOC_WRITE,(type),(nr),sizeof(size))
/* used to decode ioctl numbers.. */
#define _NV_IOC_DIR(nr) (((nr) >> _NV_IOC_DIRSHIFT) & _NV_IOC_DIRMASK)
#define _NV_IOC_TYPE(nr) (((nr) >> _NV_IOC_TYPESHIFT) & _NV_IOC_TYPEMASK)
#define _NV_IOC_NR(nr) (((nr) >> _NV_IOC_NRSHIFT) & _NV_IOC_NRMASK)
#define _NV_IOC_SIZE(nr) (((nr) >> _NV_IOC_SIZESHIFT) & _NV_IOC_SIZEMASK)
#define __nv_in
#define __nv_out
#define __nv_inout

View File

@ -1,8 +0,0 @@
#pragma once
#include "../types.h"
Result nvgfxInitialize(void);
void nvgfxExit(void);
Result nvgfxEventWait(u32 syncpt_id, u32 threshold, s32 timeout);
Result nvgfxSubmitGpfifo(void);
Result nvgfxGetFramebuffer(u8 **buffer, size_t *size);

View File

@ -1,110 +0,0 @@
#pragma once
#include "../types.h"
typedef struct {
u32 arch; // 0x120 (NVGPU_GPU_ARCH_GM200)
u32 impl; // 0xB (NVGPU_GPU_IMPL_GM20B)
u32 rev; // 0xA1 (Revision A1)
u32 num_gpc; // 0x1
u64 L2_cache_size; // 0x40000
u64 on_board_video_memory_size; // 0x0 (not used)
u32 num_tpc_per_gpc; // 0x2
u32 bus_type; // 0x20 (NVGPU_GPU_BUS_TYPE_AXI)
u32 big_page_size; // 0x20000
u32 compression_page_size; // 0x20000
u32 pde_coverage_bit_count; // 0x1B
u32 available_big_page_sizes; // 0x30000
u32 gpc_mask; // 0x1
u32 sm_arch_sm_version; // 0x503 (Maxwell Generation 5.0.3?)
u32 sm_arch_spa_version; // 0x503 (Maxwell Generation 5.0.3?)
u32 sm_arch_warp_count; // 0x80
u32 gpu_va_bit_count; // 0x28
u32 reserved; // NULL
u64 flags; // 0x55
u32 twod_class; // 0x902D (FERMI_TWOD_A)
u32 threed_class; // 0xB197 (MAXWELL_B)
u32 compute_class; // 0xB1C0 (MAXWELL_COMPUTE_B)
u32 gpfifo_class; // 0xB06F (MAXWELL_CHANNEL_GPFIFO_A)
u32 inline_to_memory_class; // 0xA140 (KEPLER_INLINE_TO_MEMORY_B)
u32 dma_copy_class; // 0xB0B5 (MAXWELL_DMA_COPY_A)
u32 max_fbps_count; // 0x1
u32 fbp_en_mask; // 0x0 (disabled)
u32 max_ltc_per_fbp; // 0x2
u32 max_lts_per_ltc; // 0x1
u32 max_tex_per_tpc; // 0x0 (not supported)
u32 max_gpc_count; // 0x1
u32 rop_l2_en_mask_0; // 0x21D70 (fuse_status_opt_rop_l2_fbp_r)
u32 rop_l2_en_mask_1; // 0x0
u64 chipname; // 0x6230326D67 ("gm20b")
u64 gr_compbit_store_base_hw; // 0x0 (not supported)
} gpu_characteristics;
typedef struct {
u64 offset;
u32 page_size;
u32 pad;
u64 pages;
} nvioctl_va_region;
typedef struct {
u32 mask; // always 0x07
u32 flush; // active flush bit field
} nvioctl_l2_state;
typedef struct {
u32 id;
u32 value;
} nvioctl_fence;
typedef struct {
u32 entry0;
u32 entry1;
} nvioctl_gpfifo_entry;
//Used with nvioctlChannel_AllocObjCtx().
enum nvioctl_channel_obj_classnum {
NvChannelObjClassNum_2D = 0x902D,
NvChannelObjClassNum_3D = 0xB197,
NvChannelObjClassNum_Compute = 0xB1C0,
NvChannelObjClassNum_Kepler = 0xA140,
NvChannelObjClassNum_DMA = 0xB0B5,
NvChannelObjClassNum_ChannelGpfifo = 0xB06F
};
//Used with nvioctlChannel_SetPriority().
enum nvioctl_channel_priority {
NvChannelPriority_Low = 0x32,
NvChannelPriority_Medium = 0x64,
NvChannelPriority_High = 0x96
};
Result nvioctlNvhostCtrl_EventSignal(u32 fd, u32 event_id);
Result nvioctlNvhostCtrl_EventWait(u32 fd, u32 syncpt_id, u32 threshold, s32 timeout, u32 event_id, u32 *out);
Result nvioctlNvhostCtrl_EventRegister(u32 fd, u32 event_id);
Result nvioctlNvhostCtrlGpu_ZCullGetCtxSize(u32 fd, u32 *out);
Result nvioctlNvhostCtrlGpu_ZCullGetInfo(u32 fd, u32 out[40>>2]);
Result nvioctlNvhostCtrlGpu_GetCharacteristics(u32 fd, gpu_characteristics *out);
Result nvioctlNvhostCtrlGpu_GetTpcMasks(u32 fd, u32 inval, u32 out[24>>2]);
Result nvioctlNvhostCtrlGpu_GetL2State(u32 fd, nvioctl_l2_state *out);
Result nvioctlNvhostAsGpu_BindChannel(u32 fd, u32 channel_fd);
Result nvioctlNvhostAsGpu_AllocSpace(u32 fd, u32 pages, u32 page_size, u32 flags, u64 align, u64 *offset);
Result nvioctlNvhostAsGpu_MapBufferEx(u32 fd, u32 flags, u32 kind, u32 nvmap_handle, u32 page_size, u64 buffer_offset, u64 mapping_size, u64 input_offset, u64 *offset);
Result nvioctlNvhostAsGpu_GetVARegions(u32 fd, nvioctl_va_region regions[2]);
Result nvioctlNvhostAsGpu_InitializeEx(u32 fd, u32 big_page_size, u32 flags);
Result nvioctlNvmap_Create(u32 fd, u32 size, u32 *nvmap_handle);
Result nvioctlNvmap_FromId(u32 fd, u32 id, u32 *nvmap_handle);
Result nvioctlNvmap_Alloc(u32 fd, u32 nvmap_handle, u32 heapmask, u32 flags, u32 align, u8 kind, void* addr);
Result nvioctlNvmap_GetId(u32 fd, u32 nvmap_handle, u32 *id);
Result nvioctlChannel_SetNvmapFd(u32 fd, u32 nvmap_fd);
Result nvioctlChannel_SubmitGpfifo(u32 fd, nvioctl_gpfifo_entry *entries, u32 num_entries, u32 flags, nvioctl_fence *fence_out);
Result nvioctlChannel_AllocObjCtx(u32 fd, u32 class_num, u32 flags);
Result nvioctlChannel_ZCullBind(u32 fd, u64 gpu_va, u32 mode);
Result nvioctlChannel_SetErrorNotifier(u32 fd, u64 offset, u64 size, u32 nvmap_handle);
Result nvioctlChannel_SetPriority(u32 fd, u32 priority);
Result nvioctlChannel_AllocGpfifoEx2(u32 fd, u32 num_entries, u32 flags, u32 unk0, u32 unk1, u32 unk2, u32 unk3, nvioctl_fence *fence_out);
Result nvioctlChannel_SetUserData(u32 fd, void* addr);

View File

@ -1,483 +0,0 @@
/**
* @file ipc.h
* @brief Inter-process communication handling
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "result.h"
#include "arm/tls.h"
#include "kernel/svc.h"
/// IPC input header magic
#define SFCI_MAGIC 0x49434653
/// IPC output header magic
#define SFCO_MAGIC 0x4f434653
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
///@name IPC request building
///@{
/// IPC command (request) structure.
typedef struct {
size_t NumSend; // A
size_t NumRecv; // B
size_t NumTransfer; // W
const void* Buffers[4];
size_t BufferSizes[4];
u8 Flags[4];
size_t NumStaticIn; // X
size_t NumStaticOut; // C
const void* Statics[4];
size_t StaticSizes[4];
u8 Indices[4];
bool SendPid;
size_t NumHandlesCopy;
size_t NumHandlesMove;
Handle Handles[8];
} IpcCommand;
/**
* @brief Initializes an IPC command structure.
* @param cmd IPC command structure.
*/
static inline void ipcInitialize(IpcCommand* cmd) {
cmd->NumSend = 0;
cmd->NumRecv = 0;
cmd->NumTransfer = 0;
cmd->NumStaticIn = 0;
cmd->NumStaticOut = 0;
cmd->SendPid = false;
cmd->NumHandlesCopy = 0;
cmd->NumHandlesMove = 0;
}
/// IPC buffer descriptor.
typedef struct {
u32 Size; ///< Size of the buffer.
u32 Addr; ///< Lower 32-bits of the address of the buffer
u32 Packed; ///< Packed data (including higher bits of the address)
} IpcBufferDescriptor;
/// IPC static send-buffer descriptor.
typedef struct {
u32 Packed; ///< Packed data (including higher bits of the address)
u32 Addr; ///< Lower 32-bits of the address
} IpcStaticSendDescriptor;
/// IPC static receive-buffer descriptor.
typedef struct {
u32 Addr; ///< Lower 32-bits of the address of the buffer
u32 Packed; ///< Packed data (including higher bits of the address)
} IpcStaticRecvDescriptor;
/**
* @brief Adds a buffer to an IPC command structure.
* @param cmd IPC command structure.
* @param buffer Address of the buffer.
* @param size Size of the buffer.
* @param flags Flags to attach to the buffer.
*/
static inline void ipcAddSendBuffer(IpcCommand* cmd, const void* buffer, size_t size, u8 flags) {
size_t off = cmd->NumSend;
cmd->Buffers[off] = buffer;
cmd->BufferSizes[off] = size;
cmd->Flags[off] = flags;
cmd->NumSend++;
}
/**
* @brief Adds a receive-buffer to an IPC command structure.
* @param cmd IPC command structure.
* @param buffer Address of the buffer.
* @param size Size of the buffer.
* @param flags Flags to attach to the buffer.
*/
static inline void ipcAddRecvBuffer(IpcCommand* cmd, void* buffer, size_t size, u8 flags) {
size_t off = cmd->NumSend + cmd->NumRecv;
cmd->Buffers[off] = buffer;
cmd->BufferSizes[off] = size;
cmd->Flags[off] = flags;
cmd->NumRecv++;
}
/**
* @brief Adds a transfer-buffer to an IPC command structure.
* @param cmd IPC command structure.
* @param buffer Address of the buffer.
* @param size Size of the buffer.
* @param flags Flags to attach to the buffer.
*/
static inline void ipcAddTransferBuffer(IpcCommand* cmd, void* buffer, size_t size, u8 flags) {
size_t off = cmd->NumSend + cmd->NumRecv + cmd->NumTransfer;
cmd->Buffers[off] = buffer;
cmd->BufferSizes[off] = size;
cmd->Flags[off] = flags;
cmd->NumTransfer++;
}
/**
* @brief Adds a static-buffer to an IPC command structure.
* @param cmd IPC command structure.
* @param buffer Address of the buffer.
* @param size Size of the buffer.
* @param flags Flags to attach to the buffer.
*/
static inline void ipcAddSendStatic(IpcCommand* cmd, const void* buffer, size_t size, u8 index) {
size_t off = cmd->NumStaticIn;
cmd->Statics[off] = buffer;
cmd->StaticSizes[off] = size;
cmd->Indices[off] = index;
cmd->NumStaticIn++;
}
/**
* @brief Adds a static-receive-buffer to an IPC command structure.
* @param cmd IPC command structure.
* @param buffer Address of the buffer.
* @param size Size of the buffer.
* @param flags Flags to attach to the buffer.
*/
static inline void ipcAddRecvStatic(IpcCommand* cmd, void* buffer, size_t size, u8 index) {
size_t off = cmd->NumStaticIn + cmd->NumStaticOut;
cmd->Statics[off] = buffer;
cmd->StaticSizes[off] = size;
cmd->Indices[off] = index;
cmd->NumStaticOut++;
}
/**
* @brief Tags an IPC command structure to send the PID.
* @param cmd IPC command structure.
*/
static inline void ipcSendPid(IpcCommand* cmd) {
cmd->SendPid = true;
}
/**
* @brief Adds a copy-handle to be sent through an IPC command structure.
* @param cmd IPC command structure.
* @param h Handle to send.
* @remark The receiving process gets a copy of the handle.
*/
static inline void ipcSendHandleCopy(IpcCommand* cmd, Handle h) {
cmd->Handles[cmd->NumHandlesCopy++] = h;
}
/**
* @brief Adds a move-handle to be sent through an IPC command structure.
* @param cmd IPC command structure.
* @param h Handle to send.
* @remark The sending process loses ownership of the handle, which is transferred to the receiving process.
*/
static inline void ipcSendHandleMove(IpcCommand* cmd, Handle h) {
cmd->Handles[cmd->NumHandlesCopy + cmd->NumHandlesMove++] = h;
}
/**
* @brief Prepares the header of an IPC command structure.
* @param cmd IPC command structure.
* @param sizeof_raw Size in bytes of the raw data structure to embed inside the IPC request
* @return Pointer to the raw embedded data structure in the request, ready to be filled out.
*/
static inline void* ipcPrepareHeader(IpcCommand* cmd, size_t sizeof_raw) {
u32* buf = (u32*)armGetTls();
size_t i;
*buf++ = 4 | (cmd->NumStaticIn << 16) | (cmd->NumSend << 20) | (cmd->NumRecv << 24) | (cmd->NumTransfer << 28);
u32* fill_in_size_later = buf;
if (cmd->NumStaticOut > 0) {
*buf = (cmd->NumStaticOut + 2) << 10;
}
else {
*buf = 0;
}
if (cmd->SendPid || cmd->NumHandlesCopy > 0 || cmd->NumHandlesMove > 0) {
*buf++ |= 0x80000000;
*buf++ = (!!cmd->SendPid) | (cmd->NumHandlesCopy << 1) | (cmd->NumHandlesMove << 5);
if (cmd->SendPid)
buf += 2;
for (i=0; i<(cmd->NumHandlesCopy + cmd->NumHandlesMove); i++)
*buf++ = cmd->Handles[i];
}
else {
buf++;
}
for (i=0; i<cmd->NumStaticIn; i++, buf+=2) {
IpcStaticSendDescriptor* desc = (IpcStaticSendDescriptor*) buf;
uintptr_t ptr = (uintptr_t) cmd->Statics[i];
desc->Addr = ptr;
desc->Packed = cmd->Indices[i] | (cmd->StaticSizes[i] << 16) |
(((ptr >> 32) & 15) << 12) | (((ptr >> 36) & 15) << 6);
}
for (i=0; i<(cmd->NumSend + cmd->NumRecv + cmd->NumTransfer); i++, buf+=3) {
IpcBufferDescriptor* desc = (IpcBufferDescriptor*) buf;
desc->Size = cmd->BufferSizes[i];
uintptr_t ptr = (uintptr_t) cmd->Buffers[i];
desc->Addr = ptr;
desc->Packed = cmd->Flags[i] |
(((ptr >> 32) & 15) << 28) | ((ptr >> 36) << 2);
}
u32 padding = ((16 - (((uintptr_t) buf) & 15)) & 15) / 4;
u32* raw = (u32*) (buf + padding);
size_t raw_size = (sizeof_raw/4) + 4;
buf += raw_size;
u16* buf_u16 = (u16*) buf;
for (i=0; i<cmd->NumStaticOut; i++) {
size_t off = cmd->NumStaticIn + i;
size_t sz = (uintptr_t) cmd->StaticSizes[off];
buf_u16[i] = (sz > 0xFFFF) ? 0 : sz;
}
size_t u16s_size = ((2*cmd->NumStaticOut) + 3)/4;
buf += u16s_size;
raw_size += u16s_size;
*fill_in_size_later |= raw_size;
for (i=0; i<cmd->NumStaticOut; i++, buf+=2) {
IpcStaticRecvDescriptor* desc = (IpcStaticRecvDescriptor*) buf;
size_t off = cmd->NumStaticIn + i;
uintptr_t ptr = (uintptr_t) cmd->Statics[off];
desc->Addr = ptr;
desc->Packed = (ptr >> 32) | (cmd->StaticSizes[off] << 16);
}
return (void*) raw;
}
/**
* @brief Dispatches an IPC request.
* @param session IPC session handle.
* @return Result code.
*/
static inline Result ipcDispatch(Handle session) {
return svcSendSyncRequest(session);
}
///@}
///@name IPC response parsing
///@{
/// IPC parsed command (response) structure.
typedef struct {
bool HasPid; ///< true if the 'Pid' field is filled out.
u64 Pid; ///< PID included in the response (only if HasPid is true)
size_t NumHandles; ///< Number of handles in the response.
Handle Handles[8]; ///< Handles.
size_t NumBuffers; ///< Number of buffers in the response.
void* Buffers[4]; ///< Pointers to the buffers.
size_t BufferSizes[4]; ///< Sizes of the buffers.
void* Raw; ///< Pointer to the raw embedded data structure in the response.
size_t RawSize; ///< Size of the raw embedded data.
} IpcParsedCommand;
/**
* @brief Parse an IPC command response into an IPC parsed command structure.
* @param IPC parsed command structure to fill in.
* @return Result code.
*/
static inline Result ipcParse(IpcParsedCommand* r) {
u32* buf = (u32*)armGetTls();
u32 ctrl0 = *buf++;
u32 ctrl1 = *buf++;
size_t i;
r->HasPid = false;
r->RawSize = (ctrl1 & 0x1ff) * 4;
r->NumHandles = 0;
if (ctrl1 & 0x80000000) {
u32 ctrl2 = *buf++;
if (ctrl2 & 1) {
r->HasPid = true;
r->Pid = *buf++;
r->Pid |= ((u64)(*buf++)) << 32;
}
size_t num_handles = ((ctrl2 >> 1) & 15) + ((ctrl2 >> 5) & 15);
buf += num_handles;
if (num_handles > 8)
num_handles = 8;
for (i=0; i<num_handles; i++)
r->Handles[i] = *(buf-num_handles+i);
r->NumHandles = num_handles;
}
size_t num_statics = (ctrl0 >> 16) & 15;
buf += num_statics*2;
size_t num_bufs = ((ctrl0 >> 20) & 15) + ((ctrl0 >> 24) & 15) + (((ctrl0 >> 28) & 15));
r->Raw = (void*)(((uintptr_t)(buf + num_bufs*3) + 15) &~ 15);
if (num_bufs > 4)
num_bufs = 4;
for (i=0; i<num_bufs; i++, buf+=3) {
IpcBufferDescriptor* desc = (IpcBufferDescriptor*) buf;
u64 packed = (u64) desc->Packed;
r->Buffers[i] = (void*) (desc->Addr | ((packed >> 28) << 32) | (((packed >> 2) & 15) << 36));
r->BufferSizes[i] = desc->Size;
// todo: Do we care about buffer type?
}
r->NumBuffers = num_bufs;
return 0;
}
/**
* @brief Queries the size of an IPC pointer buffer.
* @param session IPC session handle.
* @param size Output variable in which to store the size.
* @return Result code.
*/
static inline Result ipcQueryPointerBufferSize(Handle session, size_t *size) {
u32* buf = (u32*)armGetTls();
buf[0] = 5;
buf[1] = 8;
buf[2] = 0;
buf[3] = 0;
buf[4] = SFCI_MAGIC;
buf[5] = 0;
buf[6] = 3;
buf[7] = 0;
Result rc = ipcDispatch(session);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct ipcQueryPointerBufferSizeResponse {
u64 magic;
u64 result;
u32 size;
} *raw = (struct ipcQueryPointerBufferSizeResponse*)r.Raw;
rc = raw->result;
if (R_SUCCEEDED(rc)) {
*size = raw->size & 0xffff;
}
}
return rc;
}
///@}
///@name IPC domain handling
///@{
/**
* @brief Converts an IPC session handle into a domain.
* @param session IPC session handle.
* @param object_id_out Output variable in which to store the object ID.
* @return Result code.
*/
static inline Result ipcConvertSessionToDomain(Handle session, u32* object_id_out) {
u32* buf = (u32*)armGetTls();
buf[0] = 5;
buf[1] = 8;
buf[4] = SFCI_MAGIC;
buf[5] = 0;
buf[6] = 0;
buf[7] = 0;
Result rc = ipcDispatch(session);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct ipcConvertSessionToDomainResponse {
u64 magic;
u64 result;
u32 object_id;
} *raw = (struct ipcConvertSessionToDomainResponse*) r.Raw;
rc = raw->result;
if (R_SUCCEEDED(rc)) {
*object_id_out = raw->object_id;
}
}
return rc;
}
/// IPC domain message header.
typedef struct {
u8 Type;
u8 Pad0;
u16 Length;
u32 ObjectId;
u32 Pad1[2];
} DomainMessageHeader;
/**
* @brief Prepares the header of an IPC command structure (domain version).
* @param cmd IPC command structure.
* @param sizeof_raw Size in bytes of the raw data structure to embed inside the IPC request
* @oaram object_id Domain object ID.
* @return Pointer to the raw embedded data structure in the request, ready to be filled out.
*/
static inline void* ipcPrepareHeaderForDomain(IpcCommand* cmd, size_t sizeof_raw, size_t object_id) {
void* raw = ipcPrepareHeader(cmd, sizeof_raw + sizeof(DomainMessageHeader));
DomainMessageHeader* hdr = (DomainMessageHeader*) raw;
hdr->Type = 1;
hdr->Length = sizeof_raw;
hdr->ObjectId = object_id;
hdr->Pad0 = hdr->Pad1[0] = hdr->Pad1[1] = 0;
return (void*)(((uintptr_t) raw) + sizeof(DomainMessageHeader));
}
/**
* @brief Parse an IPC command response into an IPC parsed command structure (domain version).
* @param IPC parsed command structure to fill in.
* @return Result code.
*/
static inline Result ipcParseForDomain(IpcParsedCommand* r) {
Result rc = ipcParse(r);
if (R_SUCCEEDED(rc)) {
r->Raw = (void*)(((uintptr_t) r->Raw) + sizeof(DomainMessageHeader));
}
return rc;
}
///@}

View File

@ -0,0 +1,30 @@
/**
* @file barrier.h
* @brief Multi-threading Barrier
* @author tatehaga
* @copyright libnx Authors
*/
#pragma once
#include "mutex.h"
#include "condvar.h"
/// Barrier structure.
typedef struct Barrier {
u64 count; ///< Number of threads to reach the barrier.
u64 total; ///< Number of threads to wait on.
Mutex mutex;
CondVar condvar;
} Barrier;
/**
* @brief Initializes a barrier and the number of threads to wait on.
* @param b Barrier object.
* @param thread_count Initial value for the number of threads the barrier must wait for.
*/
void barrierInit(Barrier *b, u64 thread_count);
/**
* @brief Forces threads to wait until all threads have called barrierWait.
* @param b Barrier object.
*/
void barrierWait(Barrier *b);

View File

@ -4,40 +4,43 @@
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../kernel/svc.h"
#include "../kernel/mutex.h"
/// Condition variable structure.
typedef struct {
u32 tag;
Mutex* mutex;
} CondVar;
/// Condition variable.
typedef u32 CondVar;
/**
* @brief Initializes a condition variable.
* @param[in] c Condition variable object.
* @param[in] m Mutex object to use inside the condition variable.
*/
void condvarInit(CondVar* c, Mutex* m);
static inline void condvarInit(CondVar* c)
{
*c = 0;
}
/**
* @brief Waits on a condition variable with a timeout.
* @param[in] c Condition variable object.
* @param[in] m Mutex object to use inside the condition variable.
* @param[in] timeout Timeout in nanoseconds.
* @return Result code (0xEA01 on timeout).
* @remark On function return, the underlying mutex is acquired.
*/
Result condvarWaitTimeout(CondVar* c, u64 timeout);
Result condvarWaitTimeout(CondVar* c, Mutex* m, u64 timeout);
/**
* @brief Waits on a condition variable.
* @param[in] c Condition variable object.
* @param[in] m Mutex object to use inside the condition variable.
* @return Result code.
* @remark On function return, the underlying mutex is acquired.
*/
static inline Result condvarWait(CondVar* c)
static inline Result condvarWait(CondVar* c, Mutex* m)
{
return condvarWaitTimeout(c, -1ull);
return condvarWaitTimeout(c, m, UINT64_MAX);
}
/**
@ -46,7 +49,11 @@ static inline Result condvarWait(CondVar* c)
* @param[in] num Maximum number of threads to wake up (or -1 to wake them all up).
* @return Result code.
*/
Result condvarWake(CondVar* c, int num);
static inline Result condvarWake(CondVar* c, int num)
{
svcSignalProcessWideKey(c, num);
return 0;
}
/**
* @brief Wakes up a single thread waiting on a condition variable.

View File

@ -1,17 +1,24 @@
/**
* @file detect.h
* @brief Kernel version detection
* @brief Kernel capability detection
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../result.h"
#include "svc.h"
/// Returns true if the kernel version is equal to or above 2.0.0.
bool kernelAbove200(void);
/// Returns true if the kernel version is equal to or above 3.0.0.
bool kernelAbove300(void);
/// Returns true if the kernel version is equal to or above 4.0.0.
bool kernelAbove400(void);
/// Returns true if the process has a debugger attached.
bool detectDebugger(void);
NX_INLINE bool detectDebugger(void) {
u64 tmp = 0;
Result rc = svcGetInfo(&tmp, InfoType_DebuggerAttached, INVALID_HANDLE, 0);
return R_SUCCEEDED(rc) && tmp != 0;
}
/// Returns true if the underlying kernel is Mesosphère.
NX_INLINE bool detectMesosphere(void) {
u64 dummy = 0;
Result rc = svcGetInfo(&dummy, 65000, INVALID_HANDLE, 0); // InfoType_MesosphereMeta
return R_SUCCEEDED(rc);
}

View File

@ -0,0 +1,84 @@
/**
* @file event.h
* @brief Kernel-mode event synchronization primitive.
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../result.h"
#include "wait.h"
/// Kernel-mode event structure.
typedef struct {
Handle revent; ///< Read-only event handle
Handle wevent; ///< Write-only event handle
bool autoclear; ///< Autoclear flag
} Event;
/// Creates a \ref Waiter for a kernel-mode event.
static inline Waiter waiterForEvent(Event* t)
{
Waiter wait_obj;
wait_obj.type = t->autoclear ? WaiterType_HandleWithClear : WaiterType_Handle;
wait_obj.handle = t->revent;
return wait_obj;
}
/**
* @brief Creates a kernel-mode event.
* @param[out] t Pointer to \ref Event structure.
* @param[in] autoclear Autoclear flag.
* @return Result code.
* @warning This is a privileged operation; in normal circumstances applications shouldn't use this function.
*/
Result eventCreate(Event* t, bool autoclear);
/**
* @brief Loads a kernel-mode event obtained from IPC.
* @param[out] t Pointer to \ref Event structure.
* @param[in] handle Read-only event handle.
* @param[in] autoclear Autoclear flag.
*/
void eventLoadRemote(Event* t, Handle handle, bool autoclear);
/**
* @brief Closes a kernel-mode event.
* @param[in] t Pointer to \ref Event structure.
*/
void eventClose(Event* t);
/**
* @brief Returns whether an \ref Event is initialized.
* @param[in] t Pointer to \ref Event structure.
* @return Initialization status.
*/
static inline bool eventActive(Event* t)
{
return t->revent != INVALID_HANDLE;
}
/**
* @brief Waits on a kernel-mode event.
* @param[in] t Pointer to \ref Event structure.
* @param[in] timeout Timeout in nanoseconds (pass UINT64_MAX to wait indefinitely).
* @return Result code.
*/
Result eventWait(Event* t, u64 timeout);
/**
* @brief Signals a kernel-mode event.
* @param[in] t Pointer to \ref Event structure.
* @return Result code.
* @note This function only works for events initialized with \ref eventCreate, it doesn't work with events initialized with \ref eventLoadRemote.
* @warning This is a privileged operation; in normal circumstances applications shouldn't use this function.
*/
Result eventFire(Event* t);
/**
* @brief Clears a kernel-mode event.
* @param[in] t Pointer to \ref Event structure.
* @return Result code.
* @note This function shouldn't be used on autoclear events.
*/
Result eventClear(Event* t);

View File

@ -6,11 +6,12 @@
*/
#pragma once
#include "../types.h"
#include "virtmem.h"
/// JIT implementation type.
typedef enum {
JitType_CodeMemory, ///< JIT supported using svcSetProcessMemoryPermission
JitType_JitMemory, ///< JIT supported using 4.0.0+ JIT syscalls.
JitType_SetProcessMemoryPermission, ///< JIT supported using svcSetProcessMemoryPermission
JitType_CodeMemory, ///< JIT supported using [4.0.0+] CodeMemory syscalls
} JitType;
/// JIT buffer object.
@ -20,7 +21,11 @@ typedef struct {
void* src_addr;
void* rx_addr;
void* rw_addr;
Handle handle;
bool is_executable;
union {
Handle handle;
VirtmemReservation* rv;
};
} Jit;
/**
@ -57,11 +62,15 @@ Result jitClose(Jit* j);
* @param j JIT buffer.
* @return Pointer to alias of the JIT buffer that can be written to.
*/
void* jitGetRwAddr(Jit* j);
NX_CONSTEXPR void* jitGetRwAddr(Jit* j) {
return j->rw_addr;
}
/**
* @brief Gets the address of the executable memory alias of a JIT buffer.
* @param j JIT buffer.
* @return Pointer to alias of the JIT buffer that can be executed.
*/
void* jitGetRxAddr(Jit* j);
NX_CONSTEXPR void* jitGetRxAddr(Jit* j) {
return j->rx_addr;
}

View File

@ -0,0 +1,54 @@
/**
* @file levent.h
* @brief Light event synchronization primitive [4.0.0+]
* @author fincs
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../result.h"
#include "svc.h"
/// User-mode light event structure.
typedef struct LEvent {
u32 counter;
bool autoclear;
} LEvent;
/**
* @brief Initializes a user-mode light event.
* @param[out] le Pointer to \ref LEvent structure.
* @param[in] signaled Whether the event starts off in signaled state.
* @param[in] autoclear Autoclear flag.
*/
NX_CONSTEXPR void leventInit(LEvent* le, bool signaled, bool autoclear) {
le->counter = signaled ? 2 : 0;
le->autoclear = autoclear;
}
/**
* @brief Waits on a user-mode light event.
* @param[in] le Pointer to \ref LEvent structure.
* @param[in] timeout_ns Timeout in nanoseconds (pass UINT64_MAX to wait indefinitely).
* @return true if wait succeeded, false if wait timed out.
*/
bool leventWait(LEvent* le, u64 timeout_ns);
/**
* @brief Polls a user-mode light event.
* @param[in] le Pointer to \ref LEvent structure.
* @return true if event is signaled, false otherwise.
*/
bool leventTryWait(LEvent* le);
/**
* @brief Signals a user-mode light event.
* @param[in] le Pointer to \ref LEvent structure.
*/
void leventSignal(LEvent* le);
/**
* @brief Clears a user-mode light event.
* @param[in] le Pointer to \ref LEvent structure.
*/
void leventClear(LEvent* le);

View File

@ -6,7 +6,7 @@
*/
#pragma once
#include <sys/lock.h>
#include "../types.h" // not needed in this file, still including it
#include "../types.h"
/// Mutex datatype, defined in newlib.
typedef _LOCK_T Mutex;
@ -20,7 +20,7 @@ typedef _LOCK_RECURSIVE_T RMutex;
*/
static inline void mutexInit(Mutex* m)
{
*m = 0;
*m = INVALID_HANDLE;
}
/**
@ -29,12 +29,26 @@ static inline void mutexInit(Mutex* m)
*/
void mutexLock(Mutex* m);
/**
* @brief Attempts to lock a mutex without waiting.
* @param m Mutex object.
* @return 1 if the mutex has been acquired successfully, and 0 on contention.
*/
bool mutexTryLock(Mutex* m);
/**
* @brief Unlocks a mutex.
* @param m Mutex object.
*/
void mutexUnlock(Mutex* m);
/**
* @brief Gets whether the current thread owns the mutex.
* @param m Mutex object.
* @return 1 if the mutex is locked by the current thread, and 0 otherwise.
*/
bool mutexIsLockedByCurrentThread(const Mutex* m);
/**
* @brief Initializes a recursive mutex.
* @param m Recursive mutex object.
@ -53,6 +67,13 @@ static inline void rmutexInit(RMutex* m)
*/
void rmutexLock(RMutex* m);
/**
* @brief Attempts to lock a recursive mutex without waiting.
* @param m Recursive mutex object.
* @return 1 if the mutex has been acquired successfully, and 0 on contention.
*/
bool rmutexTryLock(RMutex* m);
/**
* @brief Unlocks a recursive mutex.
* @param m Recursive mutex object.

View File

@ -1,25 +1,44 @@
/**
* @file rwlock.h
* @brief Read/write lock synchronization primitive.
* @author plutoo
* @author plutoo, SciresM
* @copyright libnx Authors
*/
#pragma once
#include "../kernel/mutex.h"
#include "../kernel/condvar.h"
/// Read/write lock structure.
typedef struct {
RMutex r;
RMutex g;
u64 b;
Mutex mutex;
CondVar condvar_reader_wait;
CondVar condvar_writer_wait;
u32 read_lock_count;
u32 read_waiter_count;
u32 write_lock_count;
u32 write_waiter_count;
u32 write_owner_tag;
} RwLock;
/**
* @brief Initializes the read/write lock.
* @param r Read/write lock object.
*/
void rwlockInit(RwLock* r);
/**
* @brief Locks the read/write lock for reading.
* @param r Read/write lock object.
*/
void rwlockReadLock(RwLock* r);
/**
* @brief Attempts to lock the read/write lock for reading without waiting.
* @param r Read/write lock object.
* @return 1 if the mutex has been acquired successfully, and 0 on contention.
*/
bool rwlockTryReadLock(RwLock* r);
/**
* @brief Unlocks the read/write lock for reading.
* @param r Read/write lock object.
@ -32,8 +51,30 @@ void rwlockReadUnlock(RwLock* r);
*/
void rwlockWriteLock(RwLock* r);
/**
* @brief Attempts to lock the read/write lock for writing without waiting.
* @param r Read/write lock object.
* @return 1 if the mutex has been acquired successfully, and 0 on contention.
*/
bool rwlockTryWriteLock(RwLock* r);
/**
* @brief Unlocks the read/write lock for writing.
* @param r Read/write lock object.
*/
void rwlockWriteUnlock(RwLock* r);
/**
* @brief Checks if the write lock is held by the current thread.
* @param r Read/write lock object.
* @return 1 if the current hold holds the write lock, and 0 if it does not.
*/
bool rwlockIsWriteLockHeldByCurrentThread(RwLock* r);
/**
* @brief Checks if the read/write lock is owned by the current thread.
* @param r Read/write lock object.
* @return 1 if the current hold holds the write lock or if it holds read locks acquired
* while it held the write lock, and 0 if it does not.
*/
bool rwlockIsOwnedByCurrentThread(RwLock* r);

View File

@ -0,0 +1,44 @@
/**
* @file semaphore.h
* @brief Thread synchronization based on Mutex.
* @author SciresM & Kevoot
* @copyright libnx Authors
*/
#pragma once
#include "mutex.h"
#include "condvar.h"
/// Semaphore structure.
typedef struct Semaphore
{
CondVar condvar; ///< Condition variable object.
Mutex mutex; ///< Mutex object.
u64 count; ///< Internal counter.
} Semaphore;
/**
* @brief Initializes a semaphore and its internal counter.
* @param s Semaphore object.
* @param initial_count initial value for internal counter (typically the # of free resources).
*/
void semaphoreInit(Semaphore *s, u64 initial_count);
/**
* @brief Increments the Semaphore to allow other threads to continue.
* @param s Semaphore object.
*/
void semaphoreSignal(Semaphore *s);
/**
* @brief Decrements Semaphore and waits if 0.
* @param s Semaphore object.
*/
void semaphoreWait(Semaphore *s);
/**
* @brief Attempts to get lock without waiting.
* @param s Semaphore object.
* @return true if no wait and successful lock, false otherwise.
*/
bool semaphoreTryWait(Semaphore *s);

File diff suppressed because it is too large Load Diff

View File

@ -6,28 +6,41 @@
*/
#pragma once
#include "../types.h"
#include "../arm/thread_context.h"
#include "wait.h"
/// Thread information structure.
typedef struct {
Handle handle; ///< Thread handle.
void* stack_mem; ///< Pointer to stack memory.
void* stack_mirror; ///< Pointer to stack memory mirror.
size_t stack_sz; ///< Stack size.
typedef struct Thread {
Handle handle; ///< Thread handle.
bool owns_stack_mem; ///< Whether the stack memory is automatically allocated.
void* stack_mem; ///< Pointer to stack memory.
void* stack_mirror; ///< Pointer to stack memory mirror.
size_t stack_sz; ///< Stack size.
void** tls_array;
struct Thread* next;
struct Thread** prev_next;
} Thread;
/// Creates a \ref Waiter for a \ref Thread.
static inline Waiter waiterForThread(Thread* t)
{
return waiterForHandle(t->handle);
}
/**
* @brief Creates a thread.
* @param t Thread information structure which will be filled in.
* @param entry Entrypoint of the thread.
* @param arg Argument to pass to the entrypoint.
* @param stack_sz Stack size (rounded up to page alignment).
* @param prio Thread priority (0x00~0x3F); 0x2C is the usual priority of the main thread.
* @param stack_mem Memory to use as backing for stack/tls/reent. Must be page-aligned. NULL argument means to allocate new memory.
* @param stack_sz If stack_mem is NULL, size to use for stack. If stack_mem is non-NULL, size to use for stack + reent + tls (must be page-aligned).
* @param prio Thread priority (0x00~0x3F); 0x2C is the usual priority of the main thread, 0x3B is a special priority on cores 0..2 that enables preemptive multithreading (0x3F on core 3).
* @param cpuid ID of the core on which to create the thread (0~3); or -2 to use the default core for the current process.
* @return Result code.
*/
Result threadCreate(
Thread* t, ThreadFunc entry, void* arg, size_t stack_sz, int prio,
int cpuid);
Thread* t, ThreadFunc entry, void* arg, void *stack_mem, size_t stack_sz,
int prio, int cpuid);
/**
* @brief Starts the execution of a thread.
@ -36,6 +49,11 @@ Result threadCreate(
*/
Result threadStart(Thread* t);
/**
* @brief Exits the current thread immediately.
*/
void NX_NORETURN threadExit(void);
/**
* @brief Waits for a thread to finish executing.
* @param t Thread information structure.
@ -54,7 +72,6 @@ Result threadClose(Thread* t);
* @brief Pauses the execution of a thread.
* @param t Thread information structure.
* @return Result code.
* @warning This is a privileged operation; in normal circumstances applications cannot use this function.
*/
Result threadPause(Thread* t);
@ -62,6 +79,53 @@ Result threadPause(Thread* t);
* @brief Resumes the execution of a thread, after having been paused.
* @param t Thread information structure.
* @return Result code.
* @warning This is a privileged operation; in normal circumstances applications cannot use this function.
*/
Result threadResume(Thread* t);
/**
* @brief Dumps the registers of a thread paused by @ref threadPause (register groups: all).
* @param[out] ctx Output thread context (register dump).
* @param t Thread information structure.
* @return Result code.
* @warning Official kernel will not dump x0..x18 if the thread is currently executing a system call, and prior to 6.0.0 doesn't dump TPIDR_EL0.
*/
Result threadDumpContext(ThreadContext* ctx, Thread* t);
/**
* @brief Gets a pointer to the current thread structure.
* @return Thread information structure.
*/
Thread *threadGetSelf(void);
/**
* @brief Gets the raw handle to the current thread.
* @return The current thread's handle.
*/
Handle threadGetCurHandle(void);
/**
* @brief Allocates a TLS slot.
* @param destructor Function to run automatically when a thread exits.
* @return TLS slot ID on success, or a negative value on failure.
*/
s32 threadTlsAlloc(void (* destructor)(void*));
/**
* @brief Retrieves the value stored in a TLS slot.
* @param slot_id TLS slot ID.
* @return Value.
*/
void* threadTlsGet(s32 slot_id);
/**
* @brief Stores the specified value into a TLS slot.
* @param slot_id TLS slot ID.
* @param value Value.
*/
void threadTlsSet(s32 slot_id, void* value);
/**
* @brief Frees a TLS slot.
* @param slot_id TLS slot ID.
*/
void threadTlsFree(s32 slot_id);

View File

@ -7,6 +7,7 @@
*/
#pragma once
#include "../types.h"
#include "../kernel/svc.h"
/// Transfer memory information structure.
typedef struct {
@ -26,6 +27,16 @@ typedef struct {
*/
Result tmemCreate(TransferMemory* t, size_t size, Permission perm);
/**
* @brief Creates a transfer memory object from existing memory.
* @param t Transfer memory information structure that will be filled in.
* @param buf Pointer to a page-aligned buffer.
* @param size Size of the transfer memory object to create.
* @param perm Permissions with which to protect the transfer memory in the local process.
* @return Result code.
*/
Result tmemCreateFromMemory(TransferMemory* t, void* buf, size_t size, Permission perm);
/**
* @brief Loads a transfer memory object coming from a remote process.
* @param t Transfer memory information structure which will be filled in.
@ -61,6 +72,21 @@ static inline void* tmemGetAddr(TransferMemory* t){
return t->map_addr;
}
/**
* @brief Closes handle of a transfer memory object.
* @param t Transfer memory information structure.
* @return Result code.
*/
Result tmemCloseHandle(TransferMemory* t);
/**
* @brief Waits until source backing memory permissions match perm.
* @param t Transfer memory information structure.
* @param perm Permissions which the source backing memory is expected to have before return.
* @return Result code.
*/
Result tmemWaitForPermission(TransferMemory* t, Permission perm);
/**
* @brief Frees up resources used by a transfer memory object, unmapping and closing handles, etc.
* @param t Transfer memory information structure.

View File

@ -0,0 +1,47 @@
/**
* @file uevent.h
* @brief User-mode event synchronization primitive.
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "wait.h"
typedef struct UEvent UEvent;
/// User-mode event object.
struct UEvent {
Waitable waitable;
bool signal;
bool auto_clear;
};
/// Creates a waiter for a user-mode event.
static inline Waiter waiterForUEvent(UEvent* e)
{
Waiter wait_obj;
wait_obj.type = WaiterType_Waitable;
wait_obj.waitable = &e->waitable;
return wait_obj;
}
/**
* @brief Creates a user-mode event.
* @param[out] e UEvent object.
* @param[in] auto_clear Whether to automatically clear the event.
* @note It is safe to wait on this event with several threads simultaneously.
* @note If more than one thread is listening on it, at least one thread will get the signal. No other guarantees.
*/
void ueventCreate(UEvent* e, bool auto_clear);
/**
* @brief Clears the event signal.
* @param[in] e UEvent object.
*/
void ueventClear(UEvent* e);
/**
* @brief Signals the event.
* @param[in] e UEvent object.
*/
void ueventSignal(UEvent* e);

View File

@ -0,0 +1,58 @@
/**
* @file utimer.h
* @brief User-mode timer synchronization primitive.
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "wait.h"
typedef struct UTimer UTimer;
/// Valid types for a user-mode timer.
typedef enum {
TimerType_OneShot, ///< Timers of this kind fire once and then stop automatically.
TimerType_Repeating, ///< Timers of this kind fire periodically.
} TimerType;
/// User-mode timer object.
struct UTimer {
Waitable waitable;
TimerType type : 8;
bool started : 1;
u64 next_tick;
u64 interval;
};
/// Creates a waiter for a user-mode timer.
static inline Waiter waiterForUTimer(UTimer* t)
{
Waiter wait_obj;
wait_obj.type = WaiterType_Waitable;
wait_obj.waitable = &t->waitable;
return wait_obj;
}
/**
* @brief Creates a user-mode timer.
* @param[out] t UTimer object.
* @param[in] interval Interval (in nanoseconds).
* @param[in] type Type of timer to create (see \ref TimerType).
* @note The timer is stopped when it is created. Use \ref utimerStart to start it.
* @note It is safe to wait on this timer with several threads simultaneously.
* @note If more than one thread is listening on it, at least one thread will get the signal. No other guarantees.
* @note For a repeating timer: If the timer triggers twice before you wait on it, you will only get one signal.
*/
void utimerCreate(UTimer* t, u64 interval, TimerType type);
/**
* @brief Starts the timer.
* @param[in] t UTimer object.
*/
void utimerStart(UTimer* t);
/**
* @brief Stops the timer.
* @param[in] t UTimer object.
*/
void utimerStop(UTimer* t);

View File

@ -7,30 +7,55 @@
#pragma once
#include "../types.h"
/// Address space reservation type (see \ref virtmemAddReservation)
typedef struct VirtmemReservation VirtmemReservation;
/// Locks the virtual memory manager mutex.
void virtmemLock(void);
/// Unlocks the virtual memory manager mutex.
void virtmemUnlock(void);
/**
* @brief Reserves a slice of general purpose address space.
* @param size The size of the slice of address space that will be reserved (rounded up to page alignment).
* @brief Finds a random slice of free general purpose address space.
* @param size Desired size of the slice (rounded up to page alignment).
* @param guard_size Desired size of the unmapped guard areas surrounding the slice (rounded up to page alignment).
* @return Pointer to the slice of address space, or NULL on failure.
* @note The virtual memory manager mutex must be held during the find-and-map process (see \ref virtmemLock and \ref virtmemUnlock).
*/
void* virtmemReserve(size_t size);
void* virtmemFindAslr(size_t size, size_t guard_size);
/**
* @brief Relinquishes a slice of address space reserved with virtmemReserve (currently no-op).
* @param addr Pointer to the slice.
* @param size Size of the slice.
*/
void virtmemFree(void* addr, size_t size);
/**
* @brief Reserves a slice of address space inside the alias memory mapping region(s) (for use with svcMapMemory).
* @param size The size of the slice of address space that will be reserved (rounded up to page alignment).
* @brief Finds a random slice of free stack address space.
* @param size Desired size of the slice (rounded up to page alignment).
* @param guard_size Desired size of the unmapped guard areas surrounding the slice (rounded up to page alignment).
* @return Pointer to the slice of address space, or NULL on failure.
* @note The virtual memory manager mutex must be held during the find-and-map process (see \ref virtmemLock and \ref virtmemUnlock).
*/
void* virtmemReserveMap(size_t size);
void* virtmemFindStack(size_t size, size_t guard_size);
/**
* @brief Relinquishes a slice of address space reserved with virtmemReserveMap (currently no-op).
* @param addr Pointer to the slice.
* @param size Size of the slice.
* @brief Finds a random slice of free code memory address space.
* @param size Desired size of the slice (rounded up to page alignment).
* @param guard_size Desired size of the unmapped guard areas surrounding the slice (rounded up to page alignment).
* @return Pointer to the slice of address space, or NULL on failure.
* @note The virtual memory manager mutex must be held during the find-and-map process (see \ref virtmemLock and \ref virtmemUnlock).
*/
void virtmemFreeMap(void* addr, size_t size);
void* virtmemFindCodeMemory(size_t size, size_t guard_size);
/**
* @brief Reserves a range of memory address space.
* @param mem Pointer to the address space slice.
* @param size Size of the slice.
* @return Pointer to a reservation object, or NULL on failure.
* @remark This function is intended to be used in lieu of a memory map operation when the memory won't be mapped straight away.
* @note The virtual memory manager mutex must be held during the find-and-reserve process (see \ref virtmemLock and \ref virtmemUnlock).
*/
VirtmemReservation* virtmemAddReservation(void* mem, size_t size);
/**
* @brief Releases a memory address space reservation.
* @param rv Reservation to release.
* @note The virtual memory manager mutex must be held before calling this function (see \ref virtmemLock and \ref virtmemUnlock).
*/
void virtmemRemoveReservation(VirtmemReservation* rv);

View File

@ -0,0 +1,118 @@
/**
* @file wait.h
* @brief User mode synchronization primitive waiting operations.
* @author plutoo
* @copyright libnx Authors
*/
#pragma once
#include "mutex.h"
// Implementation details.
typedef struct Waitable Waitable;
typedef struct WaitableMethods WaitableMethods;
typedef struct WaitableNode WaitableNode;
struct WaitableNode {
WaitableNode* prev;
WaitableNode* next;
};
struct Waitable {
const WaitableMethods* vt;
WaitableNode list;
Mutex mutex;
};
typedef enum {
WaiterType_Handle,
WaiterType_HandleWithClear,
WaiterType_Waitable,
} WaiterType;
// User-facing API starts here.
/// Waiter structure, representing any generic waitable synchronization object; both kernel-mode and user-mode.
typedef struct {
WaiterType type;
union {
Handle handle;
Waitable* waitable;
};
} Waiter;
/// Creates a \ref Waiter for a kernel-mode \ref Handle.
static inline Waiter waiterForHandle(Handle h)
{
Waiter wait_obj;
wait_obj.type = WaiterType_Handle;
wait_obj.handle = h;
return wait_obj;
}
/**
* @brief Waits for an arbitrary number of generic waitable synchronization objects, optionally with a timeout.
* @param[out] idx_out Variable that will received the index of the signalled object.
* @param[in] objects Array containing \ref Waiter structures.
* @param[in] num_objects Number of objects in the array.
* @param[in] timeout Timeout (in nanoseconds).
* @return Result code.
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
*/
Result waitObjects(s32* idx_out, const Waiter* objects, s32 num_objects, u64 timeout);
/**
* @brief Waits for an arbitrary number of kernel synchronization objects, optionally with a timeout. This function replaces \ref svcWaitSynchronization.
* @param[out] idx_out Variable that will received the index of the signalled object.
* @param[in] handles Array containing handles.
* @param[in] num_handles Number of handles in the array.
* @param[in] timeout Timeout (in nanoseconds).
* @return Result code.
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
*/
Result waitHandles(s32* idx_out, const Handle* handles, s32 num_handles, u64 timeout);
/**
* @brief Helper macro for \ref waitObjects that accepts \ref Waiter structures as variadic arguments instead of as an array.
* @param[out] idx_out The index of the signalled waiter.
* @param[in] timeout Timeout (in nanoseconds).
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
*/
#define waitMulti(idx_out, timeout, ...) ({ \
Waiter __objects[] = { __VA_ARGS__ }; \
waitObjects((idx_out), __objects, sizeof(__objects) / sizeof(Waiter), (timeout)); \
})
/**
* @brief Helper macro for \ref waitHandles that accepts handles as variadic arguments instead of as an array.
* @param[out] idx_out The index of the signalled handle.
* @param[in] timeout Timeout (in nanoseconds).
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
*/
#define waitMultiHandle(idx_out, timeout, ...) ({ \
Handle __handles[] = { __VA_ARGS__ }; \
waitHandles((idx_out), __handles, sizeof(__handles) / sizeof(Handle), (timeout)); \
})
/**
* @brief Waits on a single generic waitable synchronization object, optionally with a timeout.
* @param[in] w \ref Waiter structure.
* @param[in] timeout Timeout (in nanoseconds).
*/
static inline Result waitSingle(Waiter w, u64 timeout)
{
s32 idx;
return waitObjects(&idx, &w, 1, timeout);
}
/**
* @brief Waits for a single kernel synchronization object, optionally with a timeout.
* @param[in] h \ref Handle of the object.
* @param[in] timeout Timeout (in nanoseconds).
*/
static inline Result waitSingleHandle(Handle h, u64 timeout)
{
s32 idx;
return waitHandles(&idx, &h, 1, timeout);
}

94
nx/include/switch/nacp.h Normal file
View File

@ -0,0 +1,94 @@
/**
* @file nacp.h
* @brief Control.nacp structure / related code for nacp.
* @copyright libnx Authors
*/
#pragma once
/// Language entry. These strings are UTF-8.
typedef struct {
char name[0x200];
char author[0x100];
} NacpLanguageEntry;
/// ApplicationNeighborDetectionGroupConfiguration
typedef struct {
u64 group_id; ///< GroupId
u8 key[0x10];
} NacpApplicationNeighborDetectionGroupConfiguration;
/// NeighborDetectionClientConfiguration
typedef struct {
NacpApplicationNeighborDetectionGroupConfiguration send_group_configuration; ///< SendGroupConfiguration
NacpApplicationNeighborDetectionGroupConfiguration receivable_group_configurations[0x10]; ///< ReceivableGroupConfigurations
} NacpNeighborDetectionClientConfiguration;
/// ApplicationJitConfiguration
typedef struct {
u64 flags; ///< Flags
u64 memory_size; ///< MemorySize
} NacpApplicationJitConfiguration;
/// ns ApplicationControlProperty
typedef struct {
NacpLanguageEntry lang[16]; ///< \ref NacpLanguageEntry
u8 isbn[0x25]; ///< Isbn
u8 startup_user_account; ///< StartupUserAccount
u8 user_account_switch_lock; ///< UserAccountSwitchLock
u8 add_on_content_registration_type; ///< AddOnContentRegistrationType
u32 attribute_flag; ///< AttributeFlag
u32 supported_language_flag; ///< SupportedLanguageFlag
u32 parental_control_flag; ///< ParentalControlFlag
u8 screenshot; ///< Screenshot
u8 video_capture; ///< VideoCapture
u8 data_loss_confirmation; ///< DataLossConfirmation
u8 play_log_policy; ///< PlayLogPolicy
u64 presence_group_id; ///< PresenceGroupId
s8 rating_age[0x20]; ///< RatingAge
char display_version[0x10]; ///< DisplayVersion
u64 add_on_content_base_id; ///< AddOnContentBaseId
u64 save_data_owner_id; ///< SaveDataOwnerId
u64 user_account_save_data_size; ///< UserAccountSaveDataSize
u64 user_account_save_data_journal_size; ///< UserAccountSaveDataJournalSize
u64 device_save_data_size; ///< DeviceSaveDataSize
u64 device_save_data_journal_size; ///< DeviceSaveDataJournalSize
u64 bcat_delivery_cache_storage_size; ///< BcatDeliveryCacheStorageSize
u64 application_error_code_category; ///< ApplicationErrorCodeCategory
u64 local_communication_id[0x8]; ///< LocalCommunicationId
u8 logo_type; ///< LogoType
u8 logo_handling; ///< LogoHandling
u8 runtime_add_on_content_install; ///< RuntimeAddOnContentInstall
u8 runtime_parameter_delivery; ///< RuntimeParameterDelivery
u8 reserved_x30f4[0x2]; ///< Reserved
u8 crash_report; ///< CrashReport
u8 hdcp; ///< Hdcp
u64 pseudo_device_id_seed; ///< SeedForPseudoDeviceId
char bcat_passphrase[0x41]; ///< BcatPassphrase
u8 startup_user_account_option; ///< StartupUserAccountOption
u8 reserved_for_user_account_save_data_operation[0x6]; ///< ReservedForUserAccountSaveDataOperation
u64 user_account_save_data_size_max; ///< UserAccountSaveDataSizeMax
u64 user_account_save_data_journal_size_max; ///< UserAccountSaveDataJournalSizeMax
u64 device_save_data_size_max; ///< DeviceSaveDataSizeMax
u64 device_save_data_journal_size_max; ///< DeviceSaveDataJournalSizeMax
u64 temporary_storage_size; ///< TemporaryStorageSize
u64 cache_storage_size; ///< CacheStorageSize
u64 cache_storage_journal_size; ///< CacheStorageJournalSize
u64 cache_storage_data_and_journal_size_max; ///< CacheStorageDataAndJournalSizeMax
u16 cache_storage_index_max; ///< CacheStorageIndexMax
u8 reserved_x318a[0x6]; ///< Reserved
u64 play_log_queryable_application_id[0x10]; ///< PlayLogQueryableApplicationId
u8 play_log_query_capability; ///< PlayLogQueryCapability
u8 repair_flag; ///< RepairFlag
u8 program_index; ///< ProgramIndex
u8 required_network_service_license_on_launch; ///< RequiredNetworkServiceLicenseOnLaunchFlag
u32 reserved_x3214; ///< Reserved
NacpNeighborDetectionClientConfiguration neighbor_detection_client_configuration; ///< NeighborDetectionClientConfiguration
NacpApplicationJitConfiguration jit_configuration; ///< JitConfiguration
u8 reserved_x33c0[0xc40]; ///< Reserved
} NacpStruct;
/// Get the NacpLanguageEntry from the input nacp corresponding to the current system language (this may fallback to other languages when needed). Output langentry is NULL if none found / content of entry is empty.
/// If you're using ns you may want to use \ref nsGetApplicationDesiredLanguage instead.
Result nacpGetLanguageEntry(NacpStruct* nacp, NacpLanguageEntry** langentry);

54
nx/include/switch/nro.h Normal file
View File

@ -0,0 +1,54 @@
/**
* @file nro.h
* @brief NRO headers.
* @copyright libnx Authors
*/
#pragma once
#define NROHEADER_MAGIC 0x304f524e
#define NROASSETHEADER_MAGIC 0x54455341
#define NROASSETHEADER_VERSION 0
/// Entry for each segment in the codebin.
typedef struct {
u32 file_off;
u32 size;
} NroSegment;
/// Offset 0x0 in the NRO.
typedef struct {
u32 unused;
u32 mod_offset;
u8 padding[8];
} NroStart;
/// This follows NroStart, the actual nro-header.
typedef struct {
u32 magic;
u32 unk1;
u32 size;
u32 unk2;
NroSegment segments[3];
u32 bss_size;
u32 unk3;
u8 build_id[0x20];
u8 padding[0x20];
} NroHeader;
/// Custom asset section.
typedef struct {
u64 offset;
u64 size;
} NroAssetSection;
/// Custom asset header.
typedef struct {
u32 magic;
u32 version;
NroAssetSection icon;
NroAssetSection nacp;
NroAssetSection romfs;
} NroAssetHeader;

View File

@ -0,0 +1,21 @@
#pragma once
#include "types.h"
#include "ioctl.h"
typedef struct NvAddressSpace {
u32 fd;
u32 page_size;
bool has_init;
} NvAddressSpace;
Result nvAddressSpaceCreate(NvAddressSpace* a, u32 page_size);
void nvAddressSpaceClose(NvAddressSpace* a);
Result nvAddressSpaceAlloc(NvAddressSpace* a, bool sparse, u64 size, iova_t* iova_out);
Result nvAddressSpaceAllocFixed(NvAddressSpace* a, bool sparse, u64 size, iova_t iova);
Result nvAddressSpaceFree(NvAddressSpace* a, iova_t iova, u64 size);
Result nvAddressSpaceMap(NvAddressSpace* a, u32 nvmap_handle, bool is_gpu_cacheable, NvKind kind, iova_t* iova_out);
Result nvAddressSpaceMapFixed(NvAddressSpace* a, u32 nvmap_handle, bool is_gpu_cacheable, NvKind kind, iova_t iova);
Result nvAddressSpaceModify(NvAddressSpace* a, iova_t iova, u64 offset, u64 size, NvKind kind);
Result nvAddressSpaceUnmap(NvAddressSpace* a, iova_t iova);

View File

@ -0,0 +1,14 @@
#pragma once
#include "types.h"
#include "ioctl.h"
typedef struct NvChannel {
u32 fd;
bool has_init;
} NvChannel;
Result nvChannelCreate(NvChannel* c, const char* dev);
void nvChannelClose(NvChannel* c);
Result nvChannelSetPriority(NvChannel* c, NvChannelPriority prio);
Result nvChannelSetTimeout(NvChannel* c, u32 timeout);

View File

@ -0,0 +1,22 @@
#pragma once
#include "ioctl.h"
typedef nvioctl_fence NvFence;
typedef struct {
u32 num_fences;
NvFence fences[4];
} NvMultiFence;
Result nvFenceInit(void);
void nvFenceExit(void);
u32 nvFenceGetFd(void);
Result nvFenceWait(NvFence* f, s32 timeout_us);
static inline void nvMultiFenceCreate(NvMultiFence* mf, const NvFence* fence) {
mf->num_fences = 1;
mf->fences[0] = *fence;
}
Result nvMultiFenceWait(NvMultiFence* mf, s32 timeout_us);

View File

@ -0,0 +1,16 @@
#pragma once
#include "types.h"
#include "ioctl.h"
Result nvGpuInit(void);
void nvGpuExit(void);
const nvioctl_gpu_characteristics* nvGpuGetCharacteristics(void);
u32 nvGpuGetZcullCtxSize(void);
const nvioctl_zcull_info* nvGpuGetZcullInfo(void);
const u32* nvGpuGetTpcMasks(u32 *num_masks_out);
Result nvGpuZbcGetActiveSlotMask(u32 *out_slot, u32 *out_mask);
Result nvGpuZbcAddColor(const u32 color_l2[4], const u32 color_ds[4], u32 format);
Result nvGpuZbcAddDepth(float depth);
Result nvGpuGetTimestamp(u64 *ts);

View File

@ -0,0 +1,44 @@
#pragma once
#include "../kernel/event.h"
#include "channel.h"
#include "fence.h"
#define GPFIFO_QUEUE_SIZE 0x800
#define GPFIFO_ENTRY_NOT_MAIN BIT(9)
#define GPFIFO_ENTRY_NO_PREFETCH BIT(31)
typedef struct NvGpuChannel
{
NvChannel base;
Event error_event;
u64 object_id;
NvFence fence;
u32 fence_incr;
nvioctl_gpfifo_entry entries[GPFIFO_QUEUE_SIZE];
u32 num_entries;
} NvGpuChannel;
Result nvGpuChannelCreate(NvGpuChannel* c, struct NvAddressSpace* as, NvChannelPriority prio);
void nvGpuChannelClose(NvGpuChannel* c);
Result nvGpuChannelZcullBind(NvGpuChannel* c, iova_t iova);
Result nvGpuChannelAppendEntry(NvGpuChannel* c, iova_t start, size_t num_cmds, u32 flags, u32 flush_threshold);
Result nvGpuChannelKickoff(NvGpuChannel* c);
Result nvGpuChannelGetErrorNotification(NvGpuChannel* c, NvNotification* notif);
Result nvGpuChannelGetErrorInfo(NvGpuChannel* c, NvError* error);
static inline u32 nvGpuChannelGetSyncpointId(NvGpuChannel* c)
{
return c->fence.id;
}
static inline void nvGpuChannelGetFence(NvGpuChannel* c, NvFence* fence_out)
{
fence_out->id = c->fence.id;
fence_out->value = c->fence.value + c->fence_incr;
}
static inline void nvGpuChannelIncrFence(NvGpuChannel* c)
{
++c->fence_incr;
}

View File

@ -0,0 +1,39 @@
#pragma once
#include "../display/types.h"
#include "types.h"
typedef struct {
u32 width;
u32 height;
NvColorFormat color_format;
NvLayout layout;
u32 pitch;
u32 unused; // usually this field contains the nvmap handle, but it's completely unused/overwritten during marshalling
u32 offset;
NvKind kind;
u32 block_height_log2;
NvDisplayScanFormat scan;
u32 second_field_offset;
u64 flags;
u64 size;
u32 unk[6]; // compression related
} NvSurface;
typedef struct {
NativeHandle header;
s32 unk0; // -1
s32 nvmap_id; // nvmap object id
u32 unk2; // 0
u32 magic; // 0xDAFFCAFF
u32 pid; // 42
u32 type; // ?
u32 usage; // GRALLOC_USAGE_* bitmask
u32 format; // PIXEL_FORMAT_*
u32 ext_format; // copy of the above (in most cases)
u32 stride; // in pixels!
u32 total_size; // in bytes
u32 num_planes; // usually 1
u32 unk12; // 0
NvSurface planes[3];
u64 unused; // official sw writes a pointer to bookkeeping data here, but it's otherwise completely unused/overwritten during marshalling
} NvGraphicBuffer;

View File

@ -0,0 +1,298 @@
#pragma once
#include "types.h"
// The below defines are based on Linux kernel ioctl.h.
#define _NV_IOC_NRBITS 8
#define _NV_IOC_TYPEBITS 8
#define _NV_IOC_SIZEBITS 14
#define _NV_IOC_DIRBITS 2
#define _NV_IOC_NRMASK ((1 << _NV_IOC_NRBITS)-1)
#define _NV_IOC_TYPEMASK ((1 << _NV_IOC_TYPEBITS)-1)
#define _NV_IOC_SIZEMASK ((1 << _NV_IOC_SIZEBITS)-1)
#define _NV_IOC_DIRMASK ((1 << _NV_IOC_DIRBITS)-1)
#define _NV_IOC_NRSHIFT 0
#define _NV_IOC_TYPESHIFT (_NV_IOC_NRSHIFT+_NV_IOC_NRBITS)
#define _NV_IOC_SIZESHIFT (_NV_IOC_TYPESHIFT+_NV_IOC_TYPEBITS)
#define _NV_IOC_DIRSHIFT (_NV_IOC_SIZESHIFT+_NV_IOC_SIZEBITS)
// Direction bits.
#define _NV_IOC_NONE 0U
#define _NV_IOC_WRITE 1U
#define _NV_IOC_READ 2U
#define _NV_IOC(dir,type,nr,size) \
(((dir) << _NV_IOC_DIRSHIFT) | \
((type) << _NV_IOC_TYPESHIFT) | \
((nr) << _NV_IOC_NRSHIFT) | \
((size) << _NV_IOC_SIZESHIFT))
/* used to create numbers */
#define _NV_IO(type,nr) _NV_IOC(_NV_IOC_NONE,(type),(nr),0)
#define _NV_IOR(type,nr,size) _NV_IOC(_NV_IOC_READ,(type),(nr),sizeof(size))
#define _NV_IOW(type,nr,size) _NV_IOC(_NV_IOC_WRITE,(type),(nr),sizeof(size))
#define _NV_IOWR(type,nr,size) _NV_IOC(_NV_IOC_READ|_NV_IOC_WRITE,(type),(nr),sizeof(size))
/* used to decode ioctl numbers.. */
#define _NV_IOC_DIR(nr) (((nr) >> _NV_IOC_DIRSHIFT) & _NV_IOC_DIRMASK)
#define _NV_IOC_TYPE(nr) (((nr) >> _NV_IOC_TYPESHIFT) & _NV_IOC_TYPEMASK)
#define _NV_IOC_NR(nr) (((nr) >> _NV_IOC_NRSHIFT) & _NV_IOC_NRMASK)
#define _NV_IOC_SIZE(nr) (((nr) >> _NV_IOC_SIZESHIFT) & _NV_IOC_SIZEMASK)
#define __nv_in
#define __nv_out
#define __nv_inout
typedef struct {
u32 width_align_pixels; // 0x20 (32)
u32 height_align_pixels; // 0x20 (32)
u32 pixel_squares_by_aliquots; // 0x400 (1024)
u32 aliquot_total; // 0x800 (2048)
u32 region_byte_multiplier; // 0x20 (32)
u32 region_header_size; // 0x20 (32)
u32 subregion_header_size; // 0xC0 (192)
u32 subregion_width_align_pixels; // 0x20 (32)
u32 subregion_height_align_pixels; // 0x40 (64)
u32 subregion_count; // 0x10 (16)
} nvioctl_zcull_info;
typedef struct {
u32 color_ds[4];
u32 color_l2[4];
u32 depth;
u32 ref_cnt;
u32 format;
u32 type;
u32 size;
} nvioctl_zbc_entry;
typedef struct {
u32 arch; // 0x120 (NVGPU_GPU_ARCH_GM200)
u32 impl; // 0xB (NVGPU_GPU_IMPL_GM20B)
u32 rev; // 0xA1 (Revision A1)
u32 num_gpc; // 0x1
u64 L2_cache_size; // 0x40000
u64 on_board_video_memory_size; // 0x0 (not used)
u32 num_tpc_per_gpc; // 0x2
u32 bus_type; // 0x20 (NVGPU_GPU_BUS_TYPE_AXI)
u32 big_page_size; // 0x20000
u32 compression_page_size; // 0x20000
u32 pde_coverage_bit_count; // 0x1B
u32 available_big_page_sizes; // 0x30000
u32 gpc_mask; // 0x1
u32 sm_arch_sm_version; // 0x503 (Maxwell Generation 5.0.3?)
u32 sm_arch_spa_version; // 0x503 (Maxwell Generation 5.0.3?)
u32 sm_arch_warp_count; // 0x80
u32 gpu_va_bit_count; // 0x28
u32 reserved; // NULL
u64 flags; // 0x55
u32 twod_class; // 0x902D (FERMI_TWOD_A)
u32 threed_class; // 0xB197 (MAXWELL_B)
u32 compute_class; // 0xB1C0 (MAXWELL_COMPUTE_B)
u32 gpfifo_class; // 0xB06F (MAXWELL_CHANNEL_GPFIFO_A)
u32 inline_to_memory_class; // 0xA140 (KEPLER_INLINE_TO_MEMORY_B)
u32 dma_copy_class; // 0xB0B5 (MAXWELL_DMA_COPY_A)
u32 max_fbps_count; // 0x1
u32 fbp_en_mask; // 0x0 (disabled)
u32 max_ltc_per_fbp; // 0x2
u32 max_lts_per_ltc; // 0x1
u32 max_tex_per_tpc; // 0x0 (not supported)
u32 max_gpc_count; // 0x1
u32 rop_l2_en_mask_0; // 0x21D70 (fuse_status_opt_rop_l2_fbp_r)
u32 rop_l2_en_mask_1; // 0x0
u64 chipname; // 0x6230326D67 ("gm20b")
u64 gr_compbit_store_base_hw; // 0x0 (not supported)
} nvioctl_gpu_characteristics;
typedef struct {
u64 offset;
u32 page_size;
u32 pad;
u64 pages;
} nvioctl_va_region;
typedef struct {
u32 slot; // always 0x07 (?)
u32 mask;
} nvioctl_zbc_slot_mask;
typedef struct {
u64 timestamp;
u64 reserved;
} nvioctl_gpu_time;
typedef struct {
u32 id;
u32 value;
} nvioctl_fence;
typedef struct {
union {
u64 desc;
u32 desc32[2];
};
} nvioctl_gpfifo_entry;
typedef struct {
u32 mem;
u32 offset;
u32 words;
} nvioctl_cmdbuf;
typedef struct {
u32 cmdbuf_mem;
u32 cmdbuf_offset;
u32 target;
u32 target_offset;
} nvioctl_reloc;
typedef struct {
u32 shift;
} nvioctl_reloc_shift;
typedef struct {
u32 syncpt_id;
u32 syncpt_incrs;
u32 waitbase_id; // Always -1
u32 next; //< Next valid incr index, or -1
u32 prev; //< Previous valid incr index, or -1
} nvioctl_syncpt_incr;
typedef struct {
u32 handle;
u32 iova;
} nvioctl_command_buffer_map;
typedef struct {
u32 rate;
u32 moduleid;
} nvioctl_clk_rate;
#define NVGPU_ZBC_TYPE_INVALID 0
#define NVGPU_ZBC_TYPE_COLOR 1
#define NVGPU_ZBC_TYPE_DEPTH 2
// Used with nvioctlNvmap_Param().
typedef enum nvioctl_map_param {
NvMapParam_Size = 1,
NvMapParam_Alignment = 2,
NvMapParam_Base = 3,
NvMapParam_Heap = 4,
NvMapParam_Kind = 5
} NvMapParam;
// Used with nvioctlChannel_AllocObjCtx().
typedef enum nvioctl_channel_obj_classnum {
NvClassNumber_2D = 0x902D,
NvClassNumber_3D = 0xB197,
NvClassNumber_Compute = 0xB1C0,
NvClassNumber_Kepler = 0xA140,
NvClassNumber_DMA = 0xB0B5,
NvClassNumber_ChannelGpfifo = 0xB06F
} NvClassNumber;
// Used with nvioctlChannel_SetPriority().
typedef enum nvioctl_channel_priority {
NvChannelPriority_Low = 50,
NvChannelPriority_Medium = 100,
NvChannelPriority_High = 150
} NvChannelPriority;
// Used with nvioctlChannel_ZCullBind().
typedef enum {
NvZcullConfig_Global = 0,
NvZcullConfig_NoCtxSwitch = 1,
NvZcullConfig_SeparateBuffer = 2,
NvZcullConfig_PartOfRegularBuffer = 3
} NvZcullConfig;
// Used with nvioctlNvhostAsGpu_AllocSpace().
typedef enum {
NvAllocSpaceFlags_FixedOffset = 1,
NvAllocSpaceFlags_Sparse = 2,
} NvAllocSpaceFlags;
// Used with nvioctlNvhostAsGpu_MapBufferEx().
typedef enum {
NvMapBufferFlags_FixedOffset = 1,
NvMapBufferFlags_IsCacheable = 4,
NvMapBufferFlags_Modify = 0x100,
} NvMapBufferFlags;
typedef enum {
NvNotificationType_FifoErrorIdleTimeout=8,
NvNotificationType_GrErrorSwNotify=13,
NvNotificationType_GrSemaphoreTimeout=24,
NvNotificationType_GrIllegalNotify=25,
NvNotificationType_FifoErrorMmuErrFlt=31,
NvNotificationType_PbdmaError=32,
NvNotificationType_ResetChannelVerifError=43,
NvNotificationType_PbdmaPushbufferCrcMismatch=80
} NvNotificationType;
typedef struct {
u64 timestamp;
u32 info32; // see NvNotificationType
u16 info16;
u16 status; // always -1
} NvNotification;
typedef struct {
u32 type;
u32 info[31];
} NvError;
Result nvioctlNvhostCtrl_SyncptRead(u32 fd, u32 id, u32* out);
Result nvioctlNvhostCtrl_SyncptIncr(u32 fd, u32 id);
Result nvioctlNvhostCtrl_SyncptWait(u32 fd, u32 id, u32 threshold, u32 timeout);
Result nvioctlNvhostCtrl_EventSignal(u32 fd, u32 event_id);
Result nvioctlNvhostCtrl_EventWait(u32 fd, u32 syncpt_id, u32 threshold, s32 timeout, u32 event_id, u32 *out);
Result nvioctlNvhostCtrl_EventWaitAsync(u32 fd, u32 syncpt_id, u32 threshold, s32 timeout, u32 event_id);
Result nvioctlNvhostCtrl_EventRegister(u32 fd, u32 event_id);
Result nvioctlNvhostCtrl_EventUnregister(u32 fd, u32 event_id);
Result nvioctlNvhostCtrlGpu_ZCullGetCtxSize(u32 fd, u32 *out);
Result nvioctlNvhostCtrlGpu_ZCullGetInfo(u32 fd, nvioctl_zcull_info *out);
Result nvioctlNvhostCtrlGpu_ZbcSetTable(u32 fd, const u32 color_ds[4], const u32 color_l2[4], u32 depth, u32 format, u32 type);
Result nvioctlNvhostCtrlGpu_ZbcQueryTable(u32 fd, u32 index, nvioctl_zbc_entry *out);
Result nvioctlNvhostCtrlGpu_GetCharacteristics(u32 fd, nvioctl_gpu_characteristics *out);
Result nvioctlNvhostCtrlGpu_GetTpcMasks(u32 fd, void *buffer, size_t size);
Result nvioctlNvhostCtrlGpu_ZbcGetActiveSlotMask(u32 fd, nvioctl_zbc_slot_mask *out);
Result nvioctlNvhostCtrlGpu_GetGpuTime(u32 fd, nvioctl_gpu_time *out);
Result nvioctlNvhostAsGpu_BindChannel(u32 fd, u32 channel_fd);
Result nvioctlNvhostAsGpu_AllocSpace(u32 fd, u32 pages, u32 page_size, u32 flags, u64 align_or_offset, u64 *offset);
Result nvioctlNvhostAsGpu_FreeSpace(u32 fd, u64 offset, u32 pages, u32 page_size);
Result nvioctlNvhostAsGpu_MapBufferEx(u32 fd, u32 flags, u32 kind, u32 nvmap_handle, u32 page_size, u64 buffer_offset, u64 mapping_size, u64 input_offset, u64 *offset);
Result nvioctlNvhostAsGpu_UnmapBuffer(u32 fd, u64 offset);
Result nvioctlNvhostAsGpu_GetVARegions(u32 fd, nvioctl_va_region regions[2]);
Result nvioctlNvhostAsGpu_InitializeEx(u32 fd, u32 flags, u32 big_page_size);
Result nvioctlNvmap_Create(u32 fd, u32 size, u32 *nvmap_handle);
Result nvioctlNvmap_FromId(u32 fd, u32 id, u32 *nvmap_handle);
Result nvioctlNvmap_Alloc(u32 fd, u32 nvmap_handle, u32 heapmask, u32 flags, u32 align, u8 kind, void* addr);
Result nvioctlNvmap_Free(u32 fd, u32 nvmap_handle);
Result nvioctlNvmap_Param(u32 fd, u32 nvmap_handle, NvMapParam param, u32 *result);
Result nvioctlNvmap_GetId(u32 fd, u32 nvmap_handle, u32 *id);
Result nvioctlChannel_SetNvmapFd(u32 fd, u32 nvmap_fd);
Result nvioctlChannel_SubmitGpfifo(u32 fd, nvioctl_gpfifo_entry *entries, u32 num_entries, u32 flags, nvioctl_fence *fence_inout);
Result nvioctlChannel_KickoffPb(u32 fd, nvioctl_gpfifo_entry *entries, u32 num_entries, u32 flags, nvioctl_fence *fence_inout);
Result nvioctlChannel_AllocObjCtx(u32 fd, u32 class_num, u32 flags, u64* id_out);
Result nvioctlChannel_ZCullBind(u32 fd, u64 gpu_va, u32 mode);
Result nvioctlChannel_SetErrorNotifier(u32 fd, u32 enable);
Result nvioctlChannel_GetErrorInfo(u32 fd, NvError* out);
Result nvioctlChannel_GetErrorNotification(u32 fd, NvNotification* out);
Result nvioctlChannel_SetPriority(u32 fd, u32 priority);
Result nvioctlChannel_SetTimeout(u32 fd, u32 timeout);
Result nvioctlChannel_AllocGpfifoEx2(u32 fd, u32 num_entries, u32 flags, u32 unk0, u32 unk1, u32 unk2, u32 unk3, nvioctl_fence *fence_out);
Result nvioctlChannel_SetUserData(u32 fd, void* addr);
Result nvioctlChannel_Submit(u32 fd, const nvioctl_cmdbuf *cmdbufs, u32 num_cmdbufs, const nvioctl_reloc *relocs, const nvioctl_reloc_shift *reloc_shifts, u32 num_relocs,
const nvioctl_syncpt_incr *syncpt_incrs, u32 num_syncpt_incrs, nvioctl_fence *fences, u32 num_fences);
Result nvioctlChannel_GetSyncpt(u32 fd, u32 module_id, u32 *syncpt);
Result nvioctlChannel_GetModuleClockRate(u32 fd, u32 module_id, u32 *freq);
Result nvioctlChannel_SetModuleClockRate(u32 fd, u32 module_id, u32 freq);
Result nvioctlChannel_MapCommandBuffer(u32 fd, nvioctl_command_buffer_map *maps, u32 num_maps, bool compressed);
Result nvioctlChannel_UnmapCommandBuffer(u32 fd, const nvioctl_command_buffer_map *maps, u32 num_maps, bool compressed);
Result nvioctlChannel_SetSubmitTimeout(u32 fd, u32 timeout);

View File

@ -0,0 +1,50 @@
#pragma once
#include "types.h"
typedef struct NvMap {
u32 handle;
u32 id;
u32 size;
void* cpu_addr;
NvKind kind;
bool has_init;
bool is_cpu_cacheable;
} NvMap;
Result nvMapInit(void);
u32 nvMapGetFd(void);
void nvMapExit(void);
Result nvMapCreate(NvMap* m, void* cpu_addr, u32 size, u32 align, NvKind kind, bool is_cpu_cacheable);
Result nvMapLoadRemote(NvMap* m, u32 id);
void nvMapClose(NvMap* m);
static inline u32 nvMapGetHandle(NvMap* m)
{
return m->handle;
}
static inline u32 nvMapGetId(NvMap* m)
{
return m->id;
}
static inline u32 nvMapGetSize(NvMap* m)
{
return m->size;
}
static inline void* nvMapGetCpuAddr(NvMap* m)
{
return m->cpu_addr;
}
static inline bool nvMapIsRemote(NvMap* m)
{
return !m->cpu_addr;
}
static inline NvKind nvMapGetKind(NvMap* m)
{
return m->kind;
}

View File

@ -0,0 +1,484 @@
#pragma once
#include "../types.h"
typedef u64 iova_t;
typedef enum {
NvLayout_Pitch = 1,
NvLayout_Tiled = 2,
NvLayout_BlockLinear = 3,
} NvLayout;
typedef enum {
NvDisplayScanFormat_Progressive = 0,
NvDisplayScanFormat_Interlaced = 1,
} NvDisplayScanFormat;
typedef enum {
NvKind_Pitch = 0x0,
NvKind_Z16 = 0x1,
NvKind_Z16_2C = 0x2,
NvKind_Z16_MS2_2C = 0x3,
NvKind_Z16_MS4_2C = 0x4,
NvKind_Z16_MS8_2C = 0x5,
NvKind_Z16_MS16_2C = 0x6,
NvKind_Z16_2Z = 0x7,
NvKind_Z16_MS2_2Z = 0x8,
NvKind_Z16_MS4_2Z = 0x9,
NvKind_Z16_MS8_2Z = 0xa,
NvKind_Z16_MS16_2Z = 0xb,
NvKind_Z16_4CZ = 0xc,
NvKind_Z16_MS2_4CZ = 0xd,
NvKind_Z16_MS4_4CZ = 0xe,
NvKind_Z16_MS8_4CZ = 0xf,
NvKind_Z16_MS16_4CZ = 0x10,
NvKind_S8Z24 = 0x11,
NvKind_S8Z24_1Z = 0x12,
NvKind_S8Z24_MS2_1Z = 0x13,
NvKind_S8Z24_MS4_1Z = 0x14,
NvKind_S8Z24_MS8_1Z = 0x15,
NvKind_S8Z24_MS16_1Z = 0x16,
NvKind_S8Z24_2CZ = 0x17,
NvKind_S8Z24_MS2_2CZ = 0x18,
NvKind_S8Z24_MS4_2CZ = 0x19,
NvKind_S8Z24_MS8_2CZ = 0x1a,
NvKind_S8Z24_MS16_2CZ = 0x1b,
NvKind_S8Z24_2CS = 0x1C,
NvKind_S8Z24_MS2_2CS = 0x1d,
NvKind_S8Z24_MS4_2CS = 0x1e,
NvKind_S8Z24_MS8_2CS = 0x1f,
NvKind_S8Z24_MS16_2CS = 0x20,
NvKind_S8Z24_4CSZV = 0x21,
NvKind_S8Z24_MS2_4CSZV = 0x22,
NvKind_S8Z24_MS4_4CSZV = 0x23,
NvKind_S8Z24_MS8_4CSZV = 0x24,
NvKind_S8Z24_MS16_4CSZV = 0x25,
NvKind_V8Z24_MS4_VC12 = 0x26,
NvKind_V8Z24_MS4_VC4 = 0x27,
NvKind_V8Z24_MS8_VC8 = 0x28,
NvKind_V8Z24_MS8_VC24 = 0x29,
NvKind_S8 = 0x2a,
NvKind_S8_2S = 0x2b,
NvKind_V8Z24_MS4_VC12_1ZV = 0x2e,
NvKind_V8Z24_MS4_VC4_1ZV = 0x2f,
NvKind_V8Z24_MS8_VC8_1ZV = 0x30,
NvKind_V8Z24_MS8_VC24_1ZV = 0x31,
NvKind_V8Z24_MS4_VC12_2CS = 0x32,
NvKind_V8Z24_MS4_VC4_2CS = 0x33,
NvKind_V8Z24_MS8_VC8_2CS = 0x34,
NvKind_V8Z24_MS8_VC24_2CS = 0x35,
NvKind_V8Z24_MS4_VC12_2CZV = 0x3a,
NvKind_V8Z24_MS4_VC4_2CZV = 0x3b,
NvKind_V8Z24_MS8_VC8_2CZV = 0x3c,
NvKind_V8Z24_MS8_VC24_2CZV = 0x3d,
NvKind_V8Z24_MS4_VC12_2ZV = 0x3e,
NvKind_V8Z24_MS4_VC4_2ZV = 0x3f,
NvKind_V8Z24_MS8_VC8_2ZV = 0x40,
NvKind_V8Z24_MS8_VC24_2ZV = 0x41,
NvKind_V8Z24_MS4_VC12_4CSZV = 0x42,
NvKind_V8Z24_MS4_VC4_4CSZV = 0x43,
NvKind_V8Z24_MS8_VC8_4CSZV = 0x44,
NvKind_V8Z24_MS8_VC24_4CSZV = 0x45,
NvKind_Z24S8 = 0x46,
NvKind_Z24S8_1Z = 0x47,
NvKind_Z24S8_MS2_1Z = 0x48,
NvKind_Z24S8_MS4_1Z = 0x49,
NvKind_Z24S8_MS8_1Z = 0x4a,
NvKind_Z24S8_MS16_1Z = 0x4b,
NvKind_Z24S8_2CS = 0x4c,
NvKind_Z24S8_MS2_2CS = 0x4d,
NvKind_Z24S8_MS4_2CS = 0x4e,
NvKind_Z24S8_MS8_2CS = 0x4f,
NvKind_Z24S8_MS16_2CS = 0x50,
NvKind_Z24S8_2CZ = 0x51,
NvKind_Z24S8_MS2_2CZ = 0x52,
NvKind_Z24S8_MS4_2CZ = 0x53,
NvKind_Z24S8_MS8_2CZ = 0x54,
NvKind_Z24S8_MS16_2CZ = 0x55,
NvKind_Z24S8_4CSZV = 0x56,
NvKind_Z24S8_MS2_4CSZV = 0x57,
NvKind_Z24S8_MS4_4CSZV = 0x58,
NvKind_Z24S8_MS8_4CSZV = 0x59,
NvKind_Z24S8_MS16_4CSZV = 0x5a,
NvKind_Z24V8_MS4_VC12 = 0x5b,
NvKind_Z24V8_MS4_VC4 = 0x5C,
NvKind_Z24V8_MS8_VC8 = 0x5d,
NvKind_Z24V8_MS8_VC24 = 0x5e,
NvKind_Z24V8_MS4_VC12_1ZV = 0x63,
NvKind_Z24V8_MS4_VC4_1ZV = 0x64,
NvKind_Z24V8_MS8_VC8_1ZV = 0x65,
NvKind_Z24V8_MS8_VC24_1ZV = 0x66,
NvKind_Z24V8_MS4_VC12_2CS = 0x67,
NvKind_Z24V8_MS4_VC4_2CS = 0x68,
NvKind_Z24V8_MS8_VC8_2CS = 0x69,
NvKind_Z24V8_MS8_VC24_2CS = 0x6a,
NvKind_Z24V8_MS4_VC12_2CZV = 0x6f,
NvKind_Z24V8_MS4_VC4_2CZV = 0x70,
NvKind_Z24V8_MS8_VC8_2CZV = 0x71,
NvKind_Z24V8_MS8_VC24_2CZV = 0x72,
NvKind_Z24V8_MS4_VC12_2ZV = 0x73,
NvKind_Z24V8_MS4_VC4_2ZV = 0x74,
NvKind_Z24V8_MS8_VC8_2ZV = 0x75,
NvKind_Z24V8_MS8_VC24_2ZV = 0x76,
NvKind_Z24V8_MS4_VC12_4CSZV = 0x77,
NvKind_Z24V8_MS4_VC4_4CSZV = 0x78,
NvKind_Z24V8_MS8_VC8_4CSZV = 0x79,
NvKind_Z24V8_MS8_VC24_4CSZV = 0x7a,
NvKind_ZF32 = 0x7b,
NvKind_ZF32_1Z = 0x7C,
NvKind_ZF32_MS2_1Z = 0x7d,
NvKind_ZF32_MS4_1Z = 0x7e,
NvKind_ZF32_MS8_1Z = 0x7f,
NvKind_ZF32_MS16_1Z = 0x80,
NvKind_ZF32_2CS = 0x81,
NvKind_ZF32_MS2_2CS = 0x82,
NvKind_ZF32_MS4_2CS = 0x83,
NvKind_ZF32_MS8_2CS = 0x84,
NvKind_ZF32_MS16_2CS = 0x85,
NvKind_ZF32_2CZ = 0x86,
NvKind_ZF32_MS2_2CZ = 0x87,
NvKind_ZF32_MS4_2CZ = 0x88,
NvKind_ZF32_MS8_2CZ = 0x89,
NvKind_ZF32_MS16_2CZ = 0x8a,
NvKind_X8Z24_X16V8S8_MS4_VC12 = 0x8b,
NvKind_X8Z24_X16V8S8_MS4_VC4 = 0x8c,
NvKind_X8Z24_X16V8S8_MS8_VC8 = 0x8d,
NvKind_X8Z24_X16V8S8_MS8_VC24 = 0x8e,
NvKind_X8Z24_X16V8S8_MS4_VC12_1CS = 0x8f,
NvKind_X8Z24_X16V8S8_MS4_VC4_1CS = 0x90,
NvKind_X8Z24_X16V8S8_MS8_VC8_1CS = 0x91,
NvKind_X8Z24_X16V8S8_MS8_VC24_1CS = 0x92,
NvKind_X8Z24_X16V8S8_MS4_VC12_1ZV = 0x97,
NvKind_X8Z24_X16V8S8_MS4_VC4_1ZV = 0x98,
NvKind_X8Z24_X16V8S8_MS8_VC8_1ZV = 0x99,
NvKind_X8Z24_X16V8S8_MS8_VC24_1ZV = 0x9a,
NvKind_X8Z24_X16V8S8_MS4_VC12_1CZV = 0x9b,
NvKind_X8Z24_X16V8S8_MS4_VC4_1CZV = 0x9c,
NvKind_X8Z24_X16V8S8_MS8_VC8_1CZV = 0x9d,
NvKind_X8Z24_X16V8S8_MS8_VC24_1CZV = 0x9e,
NvKind_X8Z24_X16V8S8_MS4_VC12_2CS = 0x9f,
NvKind_X8Z24_X16V8S8_MS4_VC4_2CS = 0xa0,
NvKind_X8Z24_X16V8S8_MS8_VC8_2CS = 0xa1,
NvKind_X8Z24_X16V8S8_MS8_VC24_2CS = 0xa2,
NvKind_X8Z24_X16V8S8_MS4_VC12_2CSZV = 0xa3,
NvKind_X8Z24_X16V8S8_MS4_VC4_2CSZV = 0xa4,
NvKind_X8Z24_X16V8S8_MS8_VC8_2CSZV = 0xa5,
NvKind_X8Z24_X16V8S8_MS8_VC24_2CSZV = 0xa6,
NvKind_ZF32_X16V8S8_MS4_VC12 = 0xa7,
NvKind_ZF32_X16V8S8_MS4_VC4 = 0xa8,
NvKind_ZF32_X16V8S8_MS8_VC8 = 0xa9,
NvKind_ZF32_X16V8S8_MS8_VC24 = 0xaa,
NvKind_ZF32_X16V8S8_MS4_VC12_1CS = 0xab,
NvKind_ZF32_X16V8S8_MS4_VC4_1CS = 0xac,
NvKind_ZF32_X16V8S8_MS8_VC8_1CS = 0xad,
NvKind_ZF32_X16V8S8_MS8_VC24_1CS = 0xae,
NvKind_ZF32_X16V8S8_MS4_VC12_1ZV = 0xb3,
NvKind_ZF32_X16V8S8_MS4_VC4_1ZV = 0xb4,
NvKind_ZF32_X16V8S8_MS8_VC8_1ZV = 0xb5,
NvKind_ZF32_X16V8S8_MS8_VC24_1ZV = 0xb6,
NvKind_ZF32_X16V8S8_MS4_VC12_1CZV = 0xb7,
NvKind_ZF32_X16V8S8_MS4_VC4_1CZV = 0xb8,
NvKind_ZF32_X16V8S8_MS8_VC8_1CZV = 0xb9,
NvKind_ZF32_X16V8S8_MS8_VC24_1CZV = 0xba,
NvKind_ZF32_X16V8S8_MS4_VC12_2CS = 0xbb,
NvKind_ZF32_X16V8S8_MS4_VC4_2CS = 0xbc,
NvKind_ZF32_X16V8S8_MS8_VC8_2CS = 0xbd,
NvKind_ZF32_X16V8S8_MS8_VC24_2CS = 0xbe,
NvKind_ZF32_X16V8S8_MS4_VC12_2CSZV = 0xbf,
NvKind_ZF32_X16V8S8_MS4_VC4_2CSZV = 0xc0,
NvKind_ZF32_X16V8S8_MS8_VC8_2CSZV = 0xc1,
NvKind_ZF32_X16V8S8_MS8_VC24_2CSZV = 0xc2,
NvKind_ZF32_X24S8 = 0xc3,
NvKind_ZF32_X24S8_1CS = 0xc4,
NvKind_ZF32_X24S8_MS2_1CS = 0xc5,
NvKind_ZF32_X24S8_MS4_1CS = 0xc6,
NvKind_ZF32_X24S8_MS8_1CS = 0xc7,
NvKind_ZF32_X24S8_MS16_1CS = 0xc8,
NvKind_SmskedMessage = 0xca,
NvKind_SmhostMessage = 0xcb,
NvKind_C64_MS2_2CRA = 0xcd,
NvKind_ZF32_X24S8_2CSZV = 0xce,
NvKind_ZF32_X24S8_MS2_2CSZV = 0xcf,
NvKind_ZF32_X24S8_MS4_2CSZV = 0xd0,
NvKind_ZF32_X24S8_MS8_2CSZV = 0xd1,
NvKind_ZF32_X24S8_MS16_2CSZV = 0xd2,
NvKind_ZF32_X24S8_2CS = 0xd3,
NvKind_ZF32_X24S8_MS2_2CS = 0xd4,
NvKind_ZF32_X24S8_MS4_2CS = 0xd5,
NvKind_ZF32_X24S8_MS8_2CS = 0xd6,
NvKind_ZF32_X24S8_MS16_2CS = 0xd7,
NvKind_C32_2C = 0xd8,
NvKind_C32_2CBR = 0xd9,
NvKind_C32_2CBA = 0xda,
NvKind_C32_2CRA = 0xdb,
NvKind_C32_2BRA = 0xdc,
NvKind_C32_MS2_2C = 0xdd,
NvKind_C32_MS2_2CBR = 0xde,
NvKind_C32_MS2_2CRA = 0xcc,
NvKind_C32_MS4_2C = 0xdf,
NvKind_C32_MS4_2CBR = 0xe0,
NvKind_C32_MS4_2CBA = 0xe1,
NvKind_C32_MS4_2CRA = 0xe2,
NvKind_C32_MS4_2BRA = 0xe3,
NvKind_C32_MS8_MS16_2C = 0xe4,
NvKind_C32_MS8_MS16_2CRA = 0xe5,
NvKind_C64_2C = 0xe6,
NvKind_C64_2CBR = 0xe7,
NvKind_C64_2CBA = 0xe8,
NvKind_C64_2CRA = 0xe9,
NvKind_C64_2BRA = 0xea,
NvKind_C64_MS2_2C = 0xeb,
NvKind_C64_MS2_2CBR = 0xec,
NvKind_C64_MS4_2C = 0xed,
NvKind_C64_MS4_2CBR = 0xee,
NvKind_C64_MS4_2CBA = 0xef,
NvKind_C64_MS4_2CRA = 0xf0,
NvKind_C64_MS4_2BRA = 0xf1,
NvKind_C64_MS8_MS16_2C = 0xf2,
NvKind_C64_MS8_MS16_2CRA = 0xf3,
NvKind_C128_2C = 0xf4,
NvKind_C128_2CR = 0xf5,
NvKind_C128_MS2_2C = 0xf6,
NvKind_C128_MS2_2CR = 0xf7,
NvKind_C128_MS4_2C = 0xf8,
NvKind_C128_MS4_2CR = 0xf9,
NvKind_C128_MS8_MS16_2C = 0xfa,
NvKind_C128_MS8_MS16_2CR = 0xfb,
NvKind_X8C24 = 0xfc,
NvKind_PitchNoSwizzle = 0xfd,
NvKind_Generic_16BX2 = 0xfe,
NvKind_Invalid = 0xff,
} NvKind;
typedef enum {
NvColorFormat_Unspecified = 0x0000000000UL,
NvColorFormat_NonColor8 = 0x0009200408UL,
NvColorFormat_NonColor16 = 0x0009200A10UL,
NvColorFormat_NonColor24 = 0x0009201A18UL,
NvColorFormat_NonColor32 = 0x0009201C20UL,
NvColorFormat_X4C4 = 0x0009210508UL,
NvColorFormat_A4L4 = 0x0100490508UL,
NvColorFormat_A8L8 = 0x0100490E10UL,
NvColorFormat_Float_A16L16 = 0x0100495D20UL,
NvColorFormat_A1B5G5R5 = 0x0100531410UL,
NvColorFormat_A4B4G4R4 = 0x0100531510UL,
NvColorFormat_A5B5G5R1 = 0x0100531810UL,
NvColorFormat_A2B10G10R10 = 0x0100532020UL,
NvColorFormat_A8B8G8R8 = 0x0100532120UL,
NvColorFormat_A16B16G16R16 = 0x0100532740UL,
NvColorFormat_Float_A16B16G16R16 = 0x0100536740UL,
NvColorFormat_A1R5G5B5 = 0x0100D11410UL,
NvColorFormat_A4R4G4B4 = 0x0100D11510UL,
NvColorFormat_A5R1G5B5 = 0x0100D11610UL,
NvColorFormat_A2R10G10B10 = 0x0100D12020UL,
NvColorFormat_A8R8G8B8 = 0x0100D12120UL,
NvColorFormat_A1 = 0x0101240101UL,
NvColorFormat_A2 = 0x0101240202UL,
NvColorFormat_A4 = 0x0101240304UL,
NvColorFormat_A8 = 0x0101240408UL,
NvColorFormat_A16 = 0x0101240A10UL,
NvColorFormat_A32 = 0x0101241C20UL,
NvColorFormat_Float_A16 = 0x0101244A10UL,
NvColorFormat_L4A4 = 0x0102000508UL,
NvColorFormat_L8A8 = 0x0102000E10UL,
NvColorFormat_B4G4R4A4 = 0x01060A1510UL,
NvColorFormat_B5G5R1A5 = 0x01060A1710UL,
NvColorFormat_B5G5R5A1 = 0x01060A1810UL,
NvColorFormat_B8G8R8A8 = 0x01060A2120UL,
NvColorFormat_B10G10R10A2 = 0x01060A2320UL,
NvColorFormat_R1G5B5A5 = 0x0106881410UL,
NvColorFormat_R4G4B4A4 = 0x0106881510UL,
NvColorFormat_R5G5B5A1 = 0x0106881810UL,
NvColorFormat_R8G8B8A8 = 0x0106882120UL,
NvColorFormat_R10G10B10A2 = 0x0106882320UL,
NvColorFormat_L1 = 0x010A000101UL,
NvColorFormat_L2 = 0x010A000202UL,
NvColorFormat_L4 = 0x010A000304UL,
NvColorFormat_L8 = 0x010A000408UL,
NvColorFormat_L16 = 0x010A000A10UL,
NvColorFormat_L32 = 0x010A001C20UL,
NvColorFormat_Float_L16 = 0x010A004A10UL,
NvColorFormat_B5G6R5 = 0x010A0A1210UL,
NvColorFormat_B6G5R5 = 0x010A0A1310UL,
NvColorFormat_B5G5R5X1 = 0x010A0A1810UL,
NvColorFormat_B8_G8_R8 = 0x010A0A1918UL,
NvColorFormat_B8G8R8X8 = 0x010A0A2120UL,
NvColorFormat_Float_B10G11R11 = 0x010A0A5E20UL,
NvColorFormat_X1B5G5R5 = 0x010A531410UL,
NvColorFormat_X8B8G8R8 = 0x010A532120UL,
NvColorFormat_X16B16G16R16 = 0x010A532740UL,
NvColorFormat_Float_X16B16G16R16 = 0x010A536740UL,
NvColorFormat_R3G3B2 = 0x010A880608UL,
NvColorFormat_R5G5B6 = 0x010A881110UL,
NvColorFormat_R5G6B5 = 0x010A881210UL,
NvColorFormat_R5G5B5X1 = 0x010A881810UL,
NvColorFormat_R8_G8_B8 = 0x010A881918UL,
NvColorFormat_R8G8B8X8 = 0x010A882120UL,
NvColorFormat_X1R5G5B5 = 0x010AD11410UL,
NvColorFormat_X8R8G8B8 = 0x010AD12120UL,
NvColorFormat_RG8 = 0x010B080E10UL,
NvColorFormat_R16G16 = 0x010B081D20UL,
NvColorFormat_Float_R16G16 = 0x010B085D20UL,
NvColorFormat_R8 = 0x010B200408UL,
NvColorFormat_R16 = 0x010B200A10UL,
NvColorFormat_Float_R16 = 0x010B204A10UL,
NvColorFormat_A2B10G10R10_sRGB = 0x0200532020UL,
NvColorFormat_A8B8G8R8_sRGB = 0x0200532120UL,
NvColorFormat_A16B16G16R16_sRGB = 0x0200532740UL,
NvColorFormat_A2R10G10B10_sRGB = 0x0200D12020UL,
NvColorFormat_B10G10R10A2_sRGB = 0x02060A2320UL,
NvColorFormat_R10G10B10A2_sRGB = 0x0206882320UL,
NvColorFormat_X8B8G8R8_sRGB = 0x020A532120UL,
NvColorFormat_X16B16G16R16_sRGB = 0x020A532740UL,
NvColorFormat_A2B10G10R10_709 = 0x0300532020UL,
NvColorFormat_A8B8G8R8_709 = 0x0300532120UL,
NvColorFormat_A16B16G16R16_709 = 0x0300532740UL,
NvColorFormat_A2R10G10B10_709 = 0x0300D12020UL,
NvColorFormat_B10G10R10A2_709 = 0x03060A2320UL,
NvColorFormat_R10G10B10A2_709 = 0x0306882320UL,
NvColorFormat_X8B8G8R8_709 = 0x030A532120UL,
NvColorFormat_X16B16G16R16_709 = 0x030A532740UL,
NvColorFormat_A2B10G10R10_709_Linear = 0x0400532020UL,
NvColorFormat_A8B8G8R8_709_Linear = 0x0400532120UL,
NvColorFormat_A16B16G16R16_709_Linear = 0x0400532740UL,
NvColorFormat_A2R10G10B10_709_Linear = 0x0400D12020UL,
NvColorFormat_B10G10R10A2_709_Linear = 0x04060A2320UL,
NvColorFormat_R10G10B10A2_709_Linear = 0x0406882320UL,
NvColorFormat_X8B8G8R8_709_Linear = 0x040A532120UL,
NvColorFormat_X16B16G16R16_709_Linear = 0x040A532740UL,
NvColorFormat_Float_A16B16G16R16_scRGB_Linear = 0x0500536740UL,
NvColorFormat_A2B10G10R10_2020 = 0x0600532020UL,
NvColorFormat_A8B8G8R8_2020 = 0x0600532120UL,
NvColorFormat_A16B16G16R16_2020 = 0x0600532740UL,
NvColorFormat_A2R10G10B10_2020 = 0x0600D12020UL,
NvColorFormat_B10G10R10A2_2020 = 0x06060A2320UL,
NvColorFormat_R10G10B10A2_2020 = 0x0606882320UL,
NvColorFormat_X8B8G8R8_2020 = 0x060A532120UL,
NvColorFormat_X16B16G16R16_2020 = 0x060A532740UL,
NvColorFormat_A2B10G10R10_2020_Linear = 0x0700532020UL,
NvColorFormat_A8B8G8R8_2020_Linear = 0x0700532120UL,
NvColorFormat_A16B16G16R16_2020_Linear = 0x0700532740UL,
NvColorFormat_Float_A16B16G16R16_2020_Linear = 0x0700536740UL,
NvColorFormat_A2R10G10B10_2020_Linear = 0x0700D12020UL,
NvColorFormat_B10G10R10A2_2020_Linear = 0x07060A2320UL,
NvColorFormat_R10G10B10A2_2020_Linear = 0x0706882320UL,
NvColorFormat_X8B8G8R8_2020_Linear = 0x070A532120UL,
NvColorFormat_X16B16G16R16_2020_Linear = 0x070A532740UL,
NvColorFormat_Float_A16B16G16R16_2020_PQ = 0x0800536740UL,
NvColorFormat_A4I4 = 0x0901210508UL,
NvColorFormat_A8I8 = 0x0901210E10UL,
NvColorFormat_I4A4 = 0x0903200508UL,
NvColorFormat_I8A8 = 0x0903200E10UL,
NvColorFormat_I1 = 0x0909200101UL,
NvColorFormat_I2 = 0x0909200202UL,
NvColorFormat_I4 = 0x0909200304UL,
NvColorFormat_I8 = 0x0909200408UL,
NvColorFormat_A8Y8U8V8 = 0x0A00D12120UL,
NvColorFormat_A16Y16U16V16 = 0x0A00D12740UL,
NvColorFormat_Y8U8V8A8 = 0x0A06882120UL,
NvColorFormat_V8_U8 = 0x0A080C0710UL,
NvColorFormat_V8U8 = 0x0A080C0E10UL,
NvColorFormat_V10U10 = 0x0A08142220UL,
NvColorFormat_V12U12 = 0x0A08142420UL,
NvColorFormat_V8 = 0x0A08240408UL,
NvColorFormat_V10 = 0x0A08240F10UL,
NvColorFormat_V12 = 0x0A08241010UL,
NvColorFormat_U8_V8 = 0x0A08440710UL,
NvColorFormat_U8V8 = 0x0A08440E10UL,
NvColorFormat_U10V10 = 0x0A08842220UL,
NvColorFormat_U12V12 = 0x0A08842420UL,
NvColorFormat_U8 = 0x0A09040408UL,
NvColorFormat_U10 = 0x0A09040F10UL,
NvColorFormat_U12 = 0x0A09041010UL,
NvColorFormat_Y8 = 0x0A09200408UL,
NvColorFormat_Y10 = 0x0A09200F10UL,
NvColorFormat_Y12 = 0x0A09201010UL,
NvColorFormat_YVYU = 0x0A0A500810UL,
NvColorFormat_VYUY = 0x0A0A500910UL,
NvColorFormat_YUYV = 0x0A0A880810UL,
NvColorFormat_UYVY = 0x0A0A880910UL,
NvColorFormat_Y8_U8_V8 = 0x0A0A881918UL,
NvColorFormat_V8_U8_RR = 0x0B080C0710UL,
NvColorFormat_V8U8_RR = 0x0B080C0E10UL,
NvColorFormat_V8_RR = 0x0B08240408UL,
NvColorFormat_U8_V8_RR = 0x0B08440710UL,
NvColorFormat_U8V8_RR = 0x0B08440E10UL,
NvColorFormat_U8_RR = 0x0B09040408UL,
NvColorFormat_Y8_RR = 0x0B09200408UL,
NvColorFormat_V8_U8_ER = 0x0C080C0710UL,
NvColorFormat_V8U8_ER = 0x0C080C0E10UL,
NvColorFormat_V8_ER = 0x0C08240408UL,
NvColorFormat_U8_V8_ER = 0x0C08440710UL,
NvColorFormat_U8V8_ER = 0x0C08440E10UL,
NvColorFormat_U8_ER = 0x0C09040408UL,
NvColorFormat_Y8_ER = 0x0C09200408UL,
NvColorFormat_V8_U8_709 = 0x0D080C0710UL,
NvColorFormat_V8U8_709 = 0x0D080C0E10UL,
NvColorFormat_V10U10_709 = 0x0D08142220UL,
NvColorFormat_V12U12_709 = 0x0D08142420UL,
NvColorFormat_V8_709 = 0x0D08240408UL,
NvColorFormat_V10_709 = 0x0D08240F10UL,
NvColorFormat_V12_709 = 0x0D08241010UL,
NvColorFormat_U8_V8_709 = 0x0D08440710UL,
NvColorFormat_U8V8_709 = 0x0D08440E10UL,
NvColorFormat_U10V10_709 = 0x0D08842220UL,
NvColorFormat_U12V12_709 = 0x0D08842420UL,
NvColorFormat_U8_709 = 0x0D09040408UL,
NvColorFormat_U10_709 = 0x0D09040F10UL,
NvColorFormat_U12_709 = 0x0D09041010UL,
NvColorFormat_Y8_709 = 0x0D09200408UL,
NvColorFormat_Y10_709 = 0x0D09200F10UL,
NvColorFormat_Y12_709 = 0x0D09201010UL,
NvColorFormat_V8_U8_709_ER = 0x0E080C0710UL,
NvColorFormat_V8U8_709_ER = 0x0E080C0E10UL,
NvColorFormat_V10U10_709_ER = 0x0E08142220UL,
NvColorFormat_V12U12_709_ER = 0x0E08142420UL,
NvColorFormat_V8_709_ER = 0x0E08240408UL,
NvColorFormat_V10_709_ER = 0x0E08240F10UL,
NvColorFormat_V12_709_ER = 0x0E08241010UL,
NvColorFormat_U8_V8_709_ER = 0x0E08440710UL,
NvColorFormat_U8V8_709_ER = 0x0E08440E10UL,
NvColorFormat_U10V10_709_ER = 0x0E08842220UL,
NvColorFormat_U12V12_709_ER = 0x0E08842420UL,
NvColorFormat_U8_709_ER = 0x0E09040408UL,
NvColorFormat_U10_709_ER = 0x0E09040F10UL,
NvColorFormat_U12_709_ER = 0x0E09041010UL,
NvColorFormat_Y8_709_ER = 0x0E09200408UL,
NvColorFormat_Y10_709_ER = 0x0E09200F10UL,
NvColorFormat_Y12_709_ER = 0x0E09201010UL,
NvColorFormat_V10U10_2020 = 0x0F08142220UL,
NvColorFormat_V12U12_2020 = 0x0F08142420UL,
NvColorFormat_V10_2020 = 0x0F08240F10UL,
NvColorFormat_V12_2020 = 0x0F08241010UL,
NvColorFormat_U10V10_2020 = 0x0F08842220UL,
NvColorFormat_U12V12_2020 = 0x0F08842420UL,
NvColorFormat_U10_2020 = 0x0F09040F10UL,
NvColorFormat_U12_2020 = 0x0F09041010UL,
NvColorFormat_Y10_2020 = 0x0F09200F10UL,
NvColorFormat_Y12_2020 = 0x0F09201010UL,
NvColorFormat_Bayer8RGGB = 0x1009200408UL,
NvColorFormat_Bayer16RGGB = 0x1009200A10UL,
NvColorFormat_BayerS16RGGB = 0x1009208A10UL,
NvColorFormat_X2Bayer14RGGB = 0x1009210B10UL,
NvColorFormat_X4Bayer12RGGB = 0x1009210C10UL,
NvColorFormat_X6Bayer10RGGB = 0x1009210D10UL,
NvColorFormat_Bayer8BGGR = 0x1109200408UL,
NvColorFormat_Bayer16BGGR = 0x1109200A10UL,
NvColorFormat_BayerS16BGGR = 0x1109208A10UL,
NvColorFormat_X2Bayer14BGGR = 0x1109210B10UL,
NvColorFormat_X4Bayer12BGGR = 0x1109210C10UL,
NvColorFormat_X6Bayer10BGGR = 0x1109210D10UL,
NvColorFormat_Bayer8GRBG = 0x1209200408UL,
NvColorFormat_Bayer16GRBG = 0x1209200A10UL,
NvColorFormat_BayerS16GRBG = 0x1209208A10UL,
NvColorFormat_X2Bayer14GRBG = 0x1209210B10UL,
NvColorFormat_X4Bayer12GRBG = 0x1209210C10UL,
NvColorFormat_X6Bayer10GRBG = 0x1209210D10UL,
NvColorFormat_Bayer8GBRG = 0x1309200408UL,
NvColorFormat_Bayer16GBRG = 0x1309200A10UL,
NvColorFormat_BayerS16GBRG = 0x1309208A10UL,
NvColorFormat_X2Bayer14GBRG = 0x1309210B10UL,
NvColorFormat_X4Bayer12GBRG = 0x1309210C10UL,
NvColorFormat_X6Bayer10GBRG = 0x1309210D10UL,
NvColorFormat_XYZ = 0x140A886640UL,
} NvColorFormat;

View File

@ -14,15 +14,65 @@
#define R_MODULE(res) ((res)&0x1FF)
/// Returns the description of a result code.
#define R_DESCRIPTION(res) (((res)>>9)&0x1FFF)
/// Masks out unused bits in a result code, retrieving the actual value for use in comparisons.
#define R_VALUE(res) ((res)&0x3FFFFF)
/// Builds a result code from its constituent components.
#define MAKERESULT(module,description) \
((((module)&0x1FF)) | ((description)&0x1FFF)<<9)
/// Builds a kernel error result code.
#define KERNELRESULT(description) \
MAKERESULT(Module_Kernel, KernelError_##description)
/// Module values
enum {
Module_Kernel=1,
Module_Libnx=345,
Module_HomebrewAbi=346,
Module_HomebrewLoader=347,
Module_LibnxNvidia=348,
Module_LibnxBinder=349,
};
/// Kernel error codes
enum {
KernelError_OutOfSessions=7,
KernelError_InvalidCapabilityDescriptor=14,
KernelError_NotImplemented=33,
KernelError_ThreadTerminating=59,
KernelError_OutOfDebugEvents=70,
KernelError_InvalidSize=101,
KernelError_InvalidAddress=102,
KernelError_ResourceExhausted=103,
KernelError_OutOfMemory=104,
KernelError_OutOfHandles=105,
KernelError_InvalidMemoryState=106,
KernelError_InvalidMemoryPermissions=108,
KernelError_InvalidMemoryRange=110,
KernelError_InvalidPriority=112,
KernelError_InvalidCoreId=113,
KernelError_InvalidHandle=114,
KernelError_InvalidUserBuffer=115,
KernelError_InvalidCombination=116,
KernelError_TimedOut=117,
KernelError_Cancelled=118,
KernelError_OutOfRange=119,
KernelError_InvalidEnumValue=120,
KernelError_NotFound=121,
KernelError_AlreadyExists=122,
KernelError_ConnectionClosed=123,
KernelError_UnhandledUserInterrupt=124,
KernelError_InvalidState=125,
KernelError_ReservedValue=126,
KernelError_InvalidHwBreakpoint=127,
KernelError_FatalUserException=128,
KernelError_OwnedByAnotherProcess=129,
KernelError_ConnectionRefused=131,
KernelError_OutOfResource=132,
KernelError_IpcMapFailed=259,
KernelError_IpcCmdbufTooSmall=260,
KernelError_NotDebugged=520,
};
/// libnx error codes
@ -64,6 +114,39 @@ enum {
LibnxError_JitUnavailable,
LibnxError_WeirdKernel,
LibnxError_IncompatSysVer,
LibnxError_InitFail_Time,
LibnxError_TooManyDevOpTabs,
LibnxError_DomainMessageUnknownType,
LibnxError_DomainMessageTooManyObjectIds,
LibnxError_AppletFailedToInitialize,
LibnxError_ApmFailedToInitialize,
LibnxError_NvinfoFailedToInitialize,
LibnxError_NvbufFailedToInitialize,
LibnxError_LibAppletBadExit,
LibnxError_InvalidCmifOutHeader,
LibnxError_ShouldNotHappen,
LibnxError_Timeout,
};
/// libnx binder error codes
enum {
LibnxBinderError_Unknown=1,
LibnxBinderError_NoMemory,
LibnxBinderError_InvalidOperation,
LibnxBinderError_BadValue,
LibnxBinderError_BadType,
LibnxBinderError_NameNotFound,
LibnxBinderError_PermissionDenied,
LibnxBinderError_NoInit,
LibnxBinderError_AlreadyExists,
LibnxBinderError_DeadObject,
LibnxBinderError_FailedTransaction,
LibnxBinderError_BadIndex,
LibnxBinderError_NotEnoughData,
LibnxBinderError_WouldBlock,
LibnxBinderError_TimedOut,
LibnxBinderError_UnknownTransaction,
LibnxBinderError_FdsNotAllowed,
};
/// libnx nvidia error codes

Some files were not shown because too many files have changed in this diff Show More