Compare commits

...

89 Commits

Author SHA1 Message Date
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
99 changed files with 4709 additions and 974 deletions

View File

@ -14,9 +14,9 @@ jobs:
image: 'devkitpro/devkita64'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: build
run: make -C nx -j2
run: make -C nx -j$(nproc)

View File

@ -1,5 +1,56 @@
# Changelog
## Version 4.7.0
#### system
* Basic support for 18.0.0
#### services
* fs: add GetFileSystemAttribute cmd
* fs: Implement "ChallengeCardExistence" and "GetGameCardDeviceCertificate"
#### graphics
* nvchannel: Fix SET_CLK_RATE, implement GET_CLK_RATE and SET_SUBMIT_TIMEOUT
#### miscellaneous
* Update SetSysProductModel_Aula comment
## Version 4.6.0
#### system
* svc: fix query/insecure names
#### miscellaneous
* add fsDeviceOperatorGetGameCardUpdatePartitionInfo
* Add NX_ prefix to PACKED, NORETURN, IGNORE_ARG and DEPRECATED macros
* Fix: avoid segfault at static destructors
## Version 4.5.0
#### services
* btdrv: Missing definitions for ble were added
* capsdc: Updated for [17.0.0+]
* hidsys: Support was added for many commands
* fs:
* Updated for [17.0.0+]
* Support was added for many fsDeviceOperator commands
* ncm: Updated for [17.0.0+]
* nfc: Support was added for all remaining commands
* ns: Added nsEstimateSizeToMove
* pctl: Support was added for many commands
* ssl: Updated sslConnectionSetPrivateOption for [17.0.0+]
* ts: Updated for [17.0.0+]
#### devices
* socket: Updated wrapper to automatically select latest available bsd service version (fixes multicast support)
#### miscellaneous
* The linker script/crt0 were updated to support relro
* A bug was fixed in aes-cbc block decryption
* A number of problems were corrected involving incorrect ipc serialization with pointer arguments
**Several issues were fixed, and usability and stability were improved.**
## Version 4.4.2
#### system

View File

@ -8,13 +8,6 @@ endif
include $(DEVKITPRO)/devkitA64/base_rules
export LIBNX_MAJOR := 4
export LIBNX_MINOR := 4
export LIBNX_PATCH := 2
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
@ -95,17 +88,14 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
#---------------------------------------------------------------------------------
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 -C external/bsd include
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 external Makefile default_icon.jpg switch_rules switch.ld switch.specs
dist: dist-src dist-bin
install: dist-bin
mkdir -p $(DESTDIR)$(DEVKITPRO)/libnx
bzip2 -cd libnx-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(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

View File

@ -111,7 +111,7 @@ typedef struct {
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").
} PACKED ErrorApplicationArg;
} NX_PACKED ErrorApplicationArg;
/// Error application config.
typedef struct {

View File

@ -116,7 +116,7 @@ typedef struct {
u32 buffer_size; ///< 0x1000-byte aligned buffer size.
u64 entries[0x18];
u16 total_entries;
} PACKED SwkbdCustomizedDictionarySet;
} NX_PACKED SwkbdCustomizedDictionarySet;
/// Base swkbd arg struct.
typedef struct {

View File

@ -95,21 +95,21 @@ typedef struct {
u32 pad; ///< Padding
char lastUrl[0x1000]; ///< LastUrl string
u64 lastUrlSize; ///< Size of LastUrl, including NUL-terminator.
} PACKED WebCommonReturnValue;
} 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
} PACKED WebArgHeader;
} 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
} PACKED WebArgTLV;
} NX_PACKED WebArgTLV;
/// Config struct for web applets, non-WebWifi.
typedef struct {
@ -133,7 +133,7 @@ typedef struct {
u8 visible;
u16 unk_x5;
u8 unk_x7;
} PACKED WebBootFooterButtonEntry;
} NX_PACKED WebBootFooterButtonEntry;
/// StorageHandleQueue
typedef struct {

View File

@ -11,7 +11,7 @@ typedef struct {
} BqRect;
typedef struct {
struct { s64 timestamp; } PACKED;
struct { s64 timestamp; } NX_PACKED;
s32 isAutoTimestamp;
BqRect crop;
s32 scalingMode;

View File

@ -41,7 +41,7 @@ typedef enum {
MemType_CodeReadOnly=0x14, ///< Mapped in kernel during \ref svcControlCodeMemory.
MemType_CodeWritable=0x15, ///< Mapped in kernel during \ref svcControlCodeMemory.
MemType_Coverage=0x16, ///< Not available.
MemType_Insecure=0x17, ///< Mapped in kernel during \ref svcMapInsecureMemory.
MemType_Insecure=0x17, ///< Mapped in kernel during \ref svcMapInsecurePhysicalMemory.
} MemoryType;
/// Memory state bitmasks.
@ -69,10 +69,11 @@ typedef enum {
/// Memory attribute bitmasks.
typedef enum {
MemAttr_IsBorrowed=BIT(0), ///< Is borrowed memory.
MemAttr_IsIpcMapped=BIT(1), ///< Is IPC mapped (when IpcRefCount > 0).
MemAttr_IsDeviceMapped=BIT(2), ///< Is device mapped (when DeviceRefCount > 0).
MemAttr_IsUncached=BIT(3), ///< Is uncached.
MemAttr_IsBorrowed=BIT(0), ///< Is borrowed memory.
MemAttr_IsIpcMapped=BIT(1), ///< Is IPC mapped (when IpcRefCount > 0).
MemAttr_IsDeviceMapped=BIT(2), ///< Is device mapped (when DeviceRefCount > 0).
MemAttr_IsUncached=BIT(3), ///< Is uncached.
MemAttr_IsPermissionLocked=BIT(4), ///< Is permission locked.
} MemoryAttribute;
/// Memory permission bitmasks.
@ -108,7 +109,7 @@ typedef struct {
/// Secure monitor arguments.
typedef struct {
u64 X[8]; ///< Values of X0 through X7.
} PACKED SecmonArgs;
} NX_PACKED SecmonArgs;
/// Break reasons
typedef enum {
@ -208,6 +209,10 @@ typedef enum {
InfoType_FreeThreadCount = 24, ///< [11.0.0+] The number of free threads available to the process's resource limit.
InfoType_ThreadTickCount = 25, ///< [13.0.0+] Number of ticks spent on thread.
InfoType_IsSvcPermitted = 26, ///< [14.0.0+] Does process have access to SVC (only usable with \ref svcSynchronizePreemptionState at present).
InfoType_IoRegionHint = 27, ///< [16.0.0+] Low bits of the physical address for a KIoRegion.
InfoType_AliasRegionExtraSize = 28, ///< [18.0.0+] Extra size added to the reserved region.
InfoType_TransferMemoryHint = 34, ///< [19.0.0+] Low bits of the process address for a KTransferMemory.
InfoType_ThreadTickCountDeprecated = 0xF0000002, ///< [1.0.0-12.1.0] Number of ticks spent on thread.
} InfoType;
@ -259,9 +264,10 @@ typedef enum {
/// WaitForAddress behaviors.
typedef enum {
ArbitrationType_WaitIfLessThan = 0, ///< Wait if the value is less than argument.
ArbitrationType_DecrementAndWaitIfLessThan = 1, ///< Decrement the value and wait if it is less than argument.
ArbitrationType_WaitIfEqual = 2, ///< Wait if the value is equal to argument.
ArbitrationType_WaitIfLessThan = 0, ///< Wait if the 32-bit value is less than argument.
ArbitrationType_DecrementAndWaitIfLessThan = 1, ///< Decrement the 32-bit value and wait if it is less than argument.
ArbitrationType_WaitIfEqual = 2, ///< Wait if the 32-bit value is equal to argument.
ArbitrationType_WaitIfEqual64 = 3, ///< [19.0.0+] Wait if the 64-bit value is equal to argument.
} ArbitrationType;
/// Context of a scheduled thread.
@ -361,7 +367,7 @@ Result svcQueryMemory(MemoryInfo* meminfo_ptr, u32 *pageinfo, u64 addr);
* @note Syscall number 0x07.
*/
void NORETURN svcExitProcess(void);
void NX_NORETURN svcExitProcess(void);
/**
* @brief Creates a thread.
@ -381,7 +387,7 @@ Result svcStartThread(Handle handle);
* @brief Exits the current thread.
* @note Syscall number 0x0A.
*/
void NORETURN svcExitThread(void);
void NX_NORETURN svcExitThread(void);
/**
* @brief Sleeps the current thread for the specified amount of time.
@ -667,7 +673,7 @@ Result svcOutputDebugString(const char *str, u64 size);
* @param[in] res Result code.
* @note Syscall number 0x28.
*/
void NORETURN svcReturnFromException(Result res);
void NX_NORETURN svcReturnFromException(Result res);
/**
* @brief Retrieves information about the system, or a certain kernel object.
@ -806,7 +812,7 @@ Result svcGetThreadContext3(ThreadContext* ctx, Handle thread);
* @return Result code.
* @note Syscall number 0x34.
*/
Result svcWaitForAddress(void *address, u32 arb_type, s32 value, s64 timeout);
Result svcWaitForAddress(void *address, u32 arb_type, s64 value, s64 timeout);
/**
* @brief Signals (and updates) an address depending on type and value. [4.0.0+]
@ -1117,14 +1123,14 @@ Result svcQueryPhysicalAddress(PhysicalMemoryInfo *out, u64 virtaddr);
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
* @warning Only exists on [10.0.0+]. For older versions use \ref svcLegacyQueryIoMapping.
*/
Result svcQueryIoMapping(u64* virtaddr, u64* out_size, u64 physaddr, u64 size);
Result svcQueryMemoryMapping(u64* virtaddr, u64* out_size, u64 physaddr, u64 size);
/**
* @brief Returns a virtual address mapped to a given IO range.
* @return Result code.
* @note Syscall number 0x55.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
* @warning Only exists on [1.0.0-9.2.0]. For newer versions use \ref svcQueryIoMapping.
* @warning Only exists on [1.0.0-9.2.0]. For newer versions use \ref svcQueryMemoryMapping.
*/
Result svcLegacyQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size);
@ -1579,13 +1585,13 @@ void svcCallSecureMonitor(SecmonArgs* regs);
* @return Result code.
* @note Syscall number 0x90.
*/
Result svcMapInsecureMemory(void *address, u64 size);
Result svcMapInsecurePhysicalMemory(void *address, u64 size);
/**
* @brief Undoes the effects of \ref svcMapInsecureMemory. [15.0.0+]
* @return Result code.
* @note Syscall number 0x91.
*/
Result svcUnmapInsecureMemory(void *address, u64 size);
Result svcUnmapInsecurePhysicalMemory(void *address, u64 size);
///@}

View File

@ -52,7 +52,7 @@ Result threadStart(Thread* t);
/**
* @brief Exits the current thread immediately.
*/
void NORETURN threadExit(void);
void NX_NORETURN threadExit(void);
/**
* @brief Waits for a thread to finish executing.

View File

@ -10,6 +10,7 @@ typedef struct {
Result nvFenceInit(void);
void nvFenceExit(void);
u32 nvFenceGetFd(void);
Result nvFenceWait(NvFence* f, s32 timeout_us);

View File

@ -154,6 +154,9 @@ typedef struct {
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 {
@ -161,6 +164,11 @@ typedef struct {
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
@ -284,5 +292,7 @@ Result nvioctlChannel_Submit(u32 fd, const nvioctl_cmdbuf *cmdbufs, u32 num_cmdb
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

@ -10,8 +10,6 @@ typedef enum {
/// Configuration structure for socketInitalize
typedef struct {
u32 bsdsockets_version; ///< Observed 1 on 2.0 LibAppletWeb, 2 on 3.0.
u32 tcp_tx_buf_size; ///< Size of the TCP transfer (send) buffer (initial or fixed).
u32 tcp_rx_buf_size; ///< Size of the TCP receive buffer (initial or fixed).
u32 tcp_tx_buf_max_size; ///< Maximum size of the TCP transfer (send) buffer. If it is 0, the size of the buffer is fixed to its initial value.

View File

@ -12,4 +12,4 @@
* @brief Aborts program execution with a result code.
* @param[in] res Result code.
*/
void NORETURN diagAbortWithResult(Result res);
void NX_NORETURN diagAbortWithResult(Result res);

View File

@ -45,7 +45,7 @@ enum {
};
/// Loader return function.
typedef void NORETURN (*LoaderReturnFn)(int result_code);
typedef void NX_NORETURN (*LoaderReturnFn)(int result_code);
/**
* @brief Parses the homebrew loader environment block (internally called).

View File

@ -48,21 +48,21 @@ Result audctlGetTargetVolumeMin(s32* volume_out);
Result audctlGetTargetVolumeMax(s32* volume_out);
Result audctlIsTargetMute(bool* mute_out, AudioTarget target);
Result audctlSetTargetMute(AudioTarget target, bool mute);
Result audctlIsTargetConnected(bool* connected_out, AudioTarget target);
Result audctlIsTargetConnected(bool* connected_out, AudioTarget target); ///< [1.0.0-17.0.1]
Result audctlSetDefaultTarget(AudioTarget target, u64 fade_in_ns, u64 fade_out_ns);
Result audctlGetDefaultTarget(AudioTarget* target_out);
Result audctlGetAudioOutputMode(AudioOutputMode* mode_out, AudioTarget target);
Result audctlSetAudioOutputMode(AudioTarget target, AudioOutputMode mode);
Result audctlSetForceMutePolicy(AudioForceMutePolicy policy);
Result audctlGetForceMutePolicy(AudioForceMutePolicy* policy_out);
Result audctlSetForceMutePolicy(AudioForceMutePolicy policy); ///< [1.0.0-13.2.1]
Result audctlGetForceMutePolicy(AudioForceMutePolicy* policy_out); ///< [1.0.0-13.2.1]
Result audctlGetOutputModeSetting(AudioOutputMode* mode_out, AudioTarget target);
Result audctlSetOutputModeSetting(AudioTarget target, AudioOutputMode mode);
Result audctlSetOutputTarget(AudioTarget target);
Result audctlSetInputTargetForceEnabled(bool enable);
Result audctlSetHeadphoneOutputLevelMode(AudioHeadphoneOutputLevelMode mode); ///< [3.0.0+]
Result audctlGetHeadphoneOutputLevelMode(AudioHeadphoneOutputLevelMode* mode_out); ///< [3.0.0+]
Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out); ///< [3.0.0+]
Result audctlAcquireAudioOutputDeviceUpdateEventForPlayReport(Event* event_out); ///< [3.0.0+]
Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out); ///< [3.0.0-13.2.1]
Result audctlAcquireAudioOutputDeviceUpdateEventForPlayReport(Event* event_out); ///< [3.0.0-13.2.1]
Result audctlGetAudioOutputTargetForPlayReport(AudioTarget* target_out); ///< [3.0.0+]
Result audctlNotifyHeadphoneVolumeWarningDisplayedEvent(void); ///< [3.0.0+]
Result audctlSetSystemOutputMasterVolume(float volume); ///< [4.0.0+]

View File

@ -2,7 +2,7 @@
* @file bt.h
* @brief Bluetooth user (bt) service IPC wrapper.
* @note See also btdev.
* @author yellows8
* @author yellows8, ndeadly
* @copyright libnx Authors
*/
#pragma once
@ -24,93 +24,93 @@ Service* btGetServiceSession(void);
* @brief LeClientReadCharacteristic
* @note This is essentially the same as \ref btdrvReadGattCharacteristic.
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] unk Unknown
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] auth_req \ref BtdrvGattAuthReqType
*/
Result btLeClientReadCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk);
Result btLeClientReadCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u8 auth_req);
/**
* @brief LeClientReadDescriptor
* @note This is essentially the same as \ref btdrvReadGattDescriptor.
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] id2 \ref BtdrvGattId
* @param[in] unk Unknown
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] desc_id Descriptor GATT ID \ref BtdrvGattId
* @param[in] auth_req \ref BtdrvGattAuthReqType
*/
Result btLeClientReadDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk);
Result btLeClientReadDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, u8 auth_req);
/**
* @brief LeClientWriteCharacteristic
* @note This is essentially the same as \ref btdrvWriteGattCharacteristic.
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size, must be <=0x258.
* @param[in] unk Unknown
* @param[in] flag Flag
* @param[in] auth_req \ref BtdrvGattAuthReqType
* @param[in] with_response Whether to use Write-With-Response write type or not
*/
Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag);
Result btLeClientWriteCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const void* buffer, size_t size, u8 auth_req, bool with_response);
/**
* @brief LeClientWriteDescriptor
* @note This is essentially the same as \ref btdrvWriteGattDescriptor.
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] id2 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] desc_id Descriptor GATT ID \ref BtdrvGattId
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size, must be <=0x258.
* @param[in] unk Unknown
* @param[in] auth_req \ref BtdrvGattAuthReqType
*/
Result btLeClientWriteDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk);
Result btLeClientWriteDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const void* buffer, size_t size, u8 auth_req);
/**
* @brief LeClientRegisterNotification
* @note This is essentially the same as \ref btdrvRegisterGattNotification.
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
*/
Result btLeClientRegisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
Result btLeClientRegisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id);
/**
* @brief LeClientDeregisterNotification
* @note This is essentially the same as \ref btdrvUnregisterGattNotification.
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
*/
Result btLeClientDeregisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
Result btLeClientDeregisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id);
/**
* @brief SetLeResponse
* @param[in] unk Unknown
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
* @param[in] server_if Server interface ID
* @param[in] serv_uuid Service UUID \ref BtdrvGattAttributeUuid
* @param[in] char_uuid Characteristic UUID \ref BtdrvGattAttributeUuid
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size, must be <=0x258.
*/
Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size);
Result btSetLeResponse(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size);
/**
* @brief LeSendIndication
* @param[in] unk Unknown
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
* @param[in] server_if Server interface ID
* @param[in] serv_uuid Service UUID \ref BtdrvGattAttributeUuid
* @param[in] char_uuid Characteristic UUID \ref BtdrvGattAttributeUuid
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size, clamped to max size 0x258.
* @param[in] flag Flag
* @param[in] noconfirm Whether no confirmation is required (notification) or not (indication)
*/
Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size, bool flag);
Result btLeSendIndication(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size, bool noconfirm);
/**
* @brief GetLeEventInfo
@ -118,9 +118,9 @@ Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const Btd
* @note The state used by this is reset after writing the data to output.
* @param[in] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvLeEventInfo.
* @param[in] size Output buffer size.
* @param[out] type Output BleEventType.
* @param[out] type Output BtdrvBleEventType.
*/
Result btGetLeEventInfo(void* buffer, size_t size, u32 *type);
Result btGetLeEventInfo(void* buffer, size_t size, BtdrvBleEventType *type);
/**
* @brief RegisterBleEvent

View File

@ -242,7 +242,7 @@ typedef struct {
struct {
u32 res; ///< Always 0.
u8 unk_x4; ///< Always 0.
u8 proto_mode; ///< Protocol mode. Always 0 (report mode).
BtdrvAddress addr; ///< \ref BtdrvAddress
u8 pad; ///< Padding
BtdrvHidReport report;
@ -323,96 +323,137 @@ typedef struct {
u8 initialized;
} BtdrvCircularBuffer;
/// Data for \ref btdrvGetBleManagedEventInfo. The data stored here depends on the \ref BtdrvBleEventType.
/// Data for \ref btdrvGetBleManagedEventInfo and \ref btdrvGetLeHidEventInfo. The data stored here depends on the \ref BtdrvBleEventType.
typedef struct {
union {
u8 data[0x400];
struct {
u32 status;
u8 handle;
u8 registered;
} type0;
u32 result; ///< 0 for success, non-zero for error.
u8 client_if; ///< Client interface handle
u8 status; ///< Registration status. 0 = Unregistered, 1 = Registered
u8 pad[2]; ///< Padding
} client_registration; ///< ::BtdrvBleEventType_ClientRegistration
struct {
u32 status;
u32 conn_id;
u32 unk_x8;
u32 unk_xC;
} type2;
u32 result; ///< 0 for success, non-zero for error.
u8 server_if; ///< Server interface handle. Unused
u8 status; ///< Registration status. 0 = Unregistered, 1 = Registered
u8 pad[2]; ///< Padding
} server_registration; ///< ::BtdrvBleEventType_ServerRegistration
struct {
u32 conn_id;
u16 min_interval;
u16 max_interval;
u16 slave_latency;
u16 timeout_multiplier;
} type3; ///< Connection params?
u32 result; ///< 0 for success, non-zero for error.
u32 conn_id; ///< Connection ID
u16 conn_interval; ///< Connection interval
u16 conn_latency; ///< Connection latency
u16 supervision_tout; ///< Connection supervision timeout multiplier
u8 pad[2]; ///< Padding
} connection_update; ///< ::BtdrvBleEventType_ConnectionUpdate
struct {
u32 status;
u8 unk_x4;
u8 unk_x5;
u8 unk_x6;
u8 unk_x7;
u32 conn_id;
BtdrvAddress address;
u16 unk_x12;
} type4; ///< Connection status?
u32 conn_id; ///< Connection ID
u16 min_conn_interval; ///< Minimum connection interval
u16 max_conn_interval; ///< Maximum connection interval
u16 slave_latency; ///< Slave latency
u16 supervision_tout; ///< Connection supervision timeout multiplier
} preferred_connection_parameters; ///< ::BtdrvBleEventType_PreferredConnectionParameters
struct {
u32 status;
u8 unk_x4;
u8 unk_x5;
u8 unk_x6;
BtdrvAddress address;
BtdrvBleAdvertisementData adv[10];
u8 count;
u32 unk_x144;
} type6; ///< Scan result?
u32 result; ///< 0 for success, non-zero for error.
u8 status; ///< Connection status. 0 = Connected, 2 = Disconnected
u8 client_if; ///< Client interface handle
u8 pad[2]; ///< Padding
u32 conn_id; ///< Connection ID
BtdrvAddress address; ///< Device address
u16 reason; ///< Disconnection reason
} client_connection; ///< ::BtdrvBleEventType_ClientConnection
struct {
u32 status;
u32 conn_id;
} type7;
u32 result; ///< 0 for success, non-zero for error.
u8 status; ///< Connection status. 0 = Connected, 2 = Disconnected
u8 server_if; ///< Server interface handle
u8 pad[2]; ///< Padding
u32 conn_id; ///< Connection ID
BtdrvAddress address; ///< Device address
u16 reason; ///< Disconnection reason
} server_connection; ///< ::BtdrvBleEventType_ServerConnection
struct {
u32 status;
u8 interface;
u8 unk_x5;
u16 unk_x6;
u32 unk_x8;
BtdrvGattAttributeUuid svc_uuid;
BtdrvGattAttributeUuid char_uuid;
BtdrvGattAttributeUuid descr_uuid;
u16 size;
u8 data[0x202];
} type8; ///< Notification?
u32 result; ///< 0 for success, non-zero for error.
u8 status; ///< BLE scan status. 1 = Scan complete, 2 = New device found, 0xFF = Scan started
u8 device_type; ///< Device type. 0 = BD/EDR, 1 = BLE, 2 = Dual Mode
u8 ble_addr_type; ///< BLE address type. 0 = Public, 1 = Random, 2 = Public ID, 3 = Random ID
BtdrvAddress address; ///< Device address
BtdrvBleAdvertisement ad_list[10]; ///< BLE Advertisement list \ref BtdrvBleAdvertisement
u8 count; ///< Number of entries above
s32 rssi; ///< RSSI value
} scan_result; ///< ::BtdrvBleEventType_ScanResult
struct {
u32 status;
u32 conn_id;
u32 unk_x8;
u8 unk_xC[0x140];
} type9;
u32 result; ///< 0 for success, non-zero for error.
u32 action; ///< Scan filter action. 0 = Add, 1 = Delete, 2 = Clear, 3 = Enable, 4 = Disable
} scan_filter; ///< ::BtdrvBleEventType_ScanFilter
struct {
u32 status;
u32 conn_id;
u8 unk_x8[0x24];
u32 unk_x2C;
u8 unk_x30[0x11c];
} type10;
u32 result; ///< 0 for success, non-zero for error.
u32 conn_id; ///< Connection ID
u8 type; ///< Notification type. 4 = Notification, 5 = Indication.
u8 pad[3]; ///< Padding
BtdrvGattAttributeUuid serv_uuid; ///< GATT Service UUID \ref BtdrvGattAttributeUuid
BtdrvGattAttributeUuid char_uuid; ///< GATT Characteristic UUID \ref BtdrvGattAttributeUuid
BtdrvGattAttributeUuid desc_uuid; ///< GATT Descriptor UUID \ref BtdrvGattAttributeUuid
u16 size; ///< Size of the below data
u8 data[0x200]; ///< Notification data.
u8 pad2[2]; ///< Padding
} client_notify; ///< ::BtdrvBleEventType_ClientNotify
struct {
u32 status;
u32 conn_id;
u16 unk_x8;
} type11;
u32 result; ///< 0 for success, non-zero for error.
u32 conn_id; ///< Connection ID
u32 count; ///< Number of attributes below.
BtdrvGattAttribute attr_list[10]; ///< List of Gatt attributes \ref BtdrvGattAttribute
} client_cache_save; ///< ::BtdrvBleEventType_ClientCacheSave
struct {
u8 unk_x0[0x218];
} type13;
u32 result; ///< 0 for success, non-zero for error.
u32 conn_id; ///< Connection ID
u16 unk_x8; ///< Unknown. Always 0
u8 unused[0x142]; ///< Unused
} client_cache_load; ///< ::BtdrvBleEventType_ClientCacheLoad
struct {
u32 result; ///< 0 for success, non-zero for error.
u32 conn_id; ///< Connection ID
u16 mtu; ///< MTU value
u8 pad[2]; ///< Padding
} client_configure_mtu; ///< ::BtdrvBleEventType_ClientConfigureMtu
struct {
u32 result; ///< 0 for success, non-zero for error.
u32 server_if; ///< Server interface handle
BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
u16 service_id; ///< Service ID
u16 attr_id; ///< Attribute ID
u8 attr_type; ///< Attribute type \ref BtdrvGattAttributeType
u8 property; ///< Characteristic properties. Only set if attr_type is 1 \ref BtdrvGattCharacteristicProperty
u8 is_primary; ///< Is a primary service or not
u8 pad; ///< Padding
} server_add_attribute; ///< ::BtdrvBleEventType_ServerAddAttribute
struct {
u32 result; ///< 0 for success, non-zero for error.
u16 conn_id; ///< Connection ID
u8 operation; ///< Operation. 0 = Read, 1 = Write
u8 pad; ///< Padding
u16 service_id; ///< Service ID
u16 attr_id; ///< Attribute ID
u8 attr_type; ///< Attribute type \ref BtdrvGattAttributeType
u8 data[0x200]; ///< Data written during write operation
u16 size; ///< Size of the above data
u16 offset; ///< Offset
u8 pad2[2]; ///< Padding
} server_attribute_operation; ///< ::BtdrvBleEventType_ServerAttributeOperation
};
} BtdrvBleEventInfo;
@ -629,9 +670,9 @@ Result btdrvGetHidReport(BtdrvAddress addr, u8 report_id, BtdrvBluetoothHhReport
* @brief TriggerConnection
* @note This is used by btm-sysmodule.
* @param[in] addr \ref BtdrvAddress
* @param[in] unk [9.0.0+] Unknown
* @param[in] timeout [9.0.0+] Host trigger timeout
*/
Result btdrvTriggerConnection(BtdrvAddress addr, u16 unk);
Result btdrvTriggerConnection(BtdrvAddress addr, u16 timeout);
/**
* @brief AddPairedDeviceInfo
@ -748,7 +789,7 @@ Result btdrvRegisterHidReportEvent(Event* out_event);
* @note [7.0.0+] When data isn't available, the type is set to ::BtdrvHidEventType_Data, with the buffer cleared to all-zero.
* @param[out] buffer Output buffer, see \ref BtdrvHidReportEventInfo.
* @param[in] size Output buffer size.
* @oaram[out] type \ref BtdrvHidEventType
* @param[out] type \ref BtdrvHidEventType
*/
Result btdrvGetHidReportEventInfo(void* buffer, size_t size, BtdrvHidEventType *type);
@ -853,9 +894,9 @@ Result btdrvSetLeConnectionParameter(const BtdrvLeConnectionParams *param);
* @note Only available on [9.0.0+]. This is the newer version of \ref btdrvSetLeConnectionParameter.
* @param[in] addr \ref BtdrvAddress
* @param[in] param \ref BtdrvBleConnectionParameter
* @param[in] flag Flag
* @param[in] preference Unused
*/
Result btdrvSetBleConnectionParameter(BtdrvAddress addr, const BtdrvBleConnectionParameter *param, bool flag);
Result btdrvSetBleConnectionParameter(BtdrvAddress addr, const BtdrvBleConnectionParameter *param, bool preference);
/**
* @brief SetLeDefaultConnectionParameter
@ -882,10 +923,10 @@ Result btdrvSetBleAdvertiseData(const BtdrvBleAdvertisePacketData *data);
* @brief SetBleAdvertiseParameter
* @note Only available on [5.0.0+].
* @param[in] addr \ref BtdrvAddress
* @param[in] unk0 Unknown
* @param[in] unk1 Unknown
* @param[in] min_interval Minimum advertisement interval
* @param[in] max_interval Maximum advertisement interval
*/
Result btdrvSetBleAdvertiseParameter(BtdrvAddress addr, u16 unk0, u16 unk1);
Result btdrvSetBleAdvertiseParameter(BtdrvAddress addr, u16 min_interval, u16 max_interval);
/**
* @brief StartBleScan
@ -920,9 +961,9 @@ Result btdrvDeleteBleScanFilterCondition(const BtdrvBleAdvertiseFilter *filter);
/**
* @brief DeleteBleScanFilter
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] index Filter index
*/
Result btdrvDeleteBleScanFilter(u8 unk);
Result btdrvDeleteBleScanFilter(u8 index);
/**
* @brief ClearBleScanFilters
@ -950,9 +991,9 @@ Result btdrvRegisterGattClient(const BtdrvGattAttributeUuid *uuid);
/**
* @brief UnregisterGattClient
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] client_if Client interface ID
*/
Result btdrvUnregisterGattClient(u8 unk);
Result btdrvUnregisterGattClient(u8 client_if);
/**
* @brief UnregisterAllGattClients
@ -964,59 +1005,60 @@ Result btdrvUnregisterAllGattClients(void);
* @brief ConnectGattServer
* @note Only available on [5.0.0+].
* @note This is used by btm-sysmodule.
* @param[in] unk Unknown
* @param[in] client_if Client interface ID
* @param[in] addr \ref BtdrvAddress
* @param[in] flag Flag
* @param[in] is_direct Whether a direct connection or a background auto connection
* @param[in] AppletResourceUserId AppletResourceUserId
*/
Result btdrvConnectGattServer(u8 unk, BtdrvAddress addr, bool flag, u64 AppletResourceUserId);
Result btdrvConnectGattServer(u8 client_if, BtdrvAddress addr, bool is_direct, u64 AppletResourceUserId);
/**
* @brief CancelConnectGattServer
* @note Only available on [5.1.0+].
* @note This is used by btm-sysmodule.
* @param[in] unk Unknown
* @param[in] client_if Client interface ID
* @param[in] addr \ref BtdrvAddress
* @param[in] flag Flag
* @param[in] is_direct Whether a direct connection or a background auto connection
*/
Result btdrvCancelConnectGattServer(u8 unk, BtdrvAddress addr, bool flag);
Result btdrvCancelConnectGattServer(u8 client_if, BtdrvAddress addr, bool is_direct);
/**
* @brief DisconnectGattServer
* @note Only available on [5.0.0+].
* @note This is used by btm-sysmodule.
* @param[in] unk Unknown
* @param[in] conn_id Connection ID
*/
Result btdrvDisconnectGattServer(u32 unk);
Result btdrvDisconnectGattServer(u32 conn_id);
/**
* @brief GetGattAttribute
* @note Only available on [5.0.0+].
* @param[in] addr \ref BtdrvAddress, only used on pre-9.0.0.
* @param[in] unk Unknown
* @param[in] conn_id Connection ID
*/
Result btdrvGetGattAttribute(BtdrvAddress addr, u32 unk);
Result btdrvGetGattAttribute(BtdrvAddress addr, u32 conn_id);
/**
* @brief GetGattService
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] conn_id Connection ID
* @param[in] uuid \ref BtdrvGattAttributeUuid
*/
Result btdrvGetGattService(u32 unk, const BtdrvGattAttributeUuid *uuid);
Result btdrvGetGattService(u32 conn_id, const BtdrvGattAttributeUuid *uuid);
/**
* @brief ConfigureAttMtu
* @note Only available on [5.0.0+].
* @note This is used by btm-sysmodule.
* @param[in] unk Unknown
* @param[in] conn_id Connection ID
* @param[in] mtu MTU
*/
Result btdrvConfigureAttMtu(u32 unk, u16 mtu);
Result btdrvConfigureAttMtu(u32 conn_id, u16 mtu);
/**
* @brief RegisterGattServer
* @note Only available on [5.0.0+].
* @note Event data generated by this call contains uninitialized junk instead of the server_if value received internally.
* @param[in] uuid \ref BtdrvGattAttributeUuid
*/
Result btdrvRegisterGattServer(const BtdrvGattAttributeUuid *uuid);
@ -1024,125 +1066,129 @@ Result btdrvRegisterGattServer(const BtdrvGattAttributeUuid *uuid);
/**
* @brief UnregisterGattServer
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] server_if Server interface ID
*/
Result btdrvUnregisterGattServer(u8 unk);
Result btdrvUnregisterGattServer(u8 server_if);
/**
* @brief ConnectGattClient
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] server_if Server interface ID
* @param[in] addr \ref BtdrvAddress
* @param[in] flag Flag
* @param[in] is_direct Whether a direct connection or a background auto connection
*/
Result btdrvConnectGattClient(u8 unk, BtdrvAddress addr, bool flag);
Result btdrvConnectGattClient(u8 server_if, BtdrvAddress addr, bool is_direct);
/**
* @brief DisconnectGattClient
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] conn_id Connection ID
* @param[in] addr \ref BtdrvAddress, only used on pre-9.0.0.
*/
Result btdrvDisconnectGattClient(u8 unk, BtdrvAddress addr);
Result btdrvDisconnectGattClient(u8 conn_id, BtdrvAddress addr);
/**
* @brief AddGattService
* @note Only available on [5.0.0+].
* @param[in] unk0 Unknown
* @note Broken behaviour due to internal bugs.
* @param[in] server_if Server interface ID
* @param[in] uuid \ref BtdrvGattAttributeUuid
* @param[in] unk1 Unknown
* @param[in] flag Flag
* @param[in] num_handle Number of handles
* @param[in] is_primary Is a primary service or not
*/
Result btdrvAddGattService(u8 unk0, const BtdrvGattAttributeUuid *uuid, u8 unk1, bool flag);
Result btdrvAddGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid, u8 num_handle, bool is_primary);
/**
* @brief EnableGattService
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @note Broken behaviour due to internal bugs.
* @param[in] server_if Server interface ID
* @param[in] uuid \ref BtdrvGattAttributeUuid
*/
Result btdrvEnableGattService(u8 unk, const BtdrvGattAttributeUuid *uuid);
Result btdrvEnableGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid);
/**
* @brief AddGattCharacteristic
* @note Only available on [5.0.0+].
* @param[in] unk0 Unknown
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
* @param[in] unk1 Unknown
* @param[in] unk2 Unknown
* @note Broken behaviour due to internal bugs.
* @param[in] server_if Server interface ID
* @param[in] serv_uuid Service UUID \ref BtdrvGattAttributeUuid
* @param[in] char_uuid Characteristic UUID \ref BtdrvGattAttributeUuid
* @param[in] permissions \ref BtdrvGattAttributePermission
* @param[in] property \ref BtdrvGattCharacteristicProperty
*/
Result btdrvAddGattCharacteristic(u8 unk0, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, u8 unk1, u16 unk2);
Result btdrvAddGattCharacteristic(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, u16 permissions, u8 property);
/**
* @brief AddGattDescriptor
* @note Only available on [5.0.0+].
* @param[in] unk0 Unknown
* @param[in] uuid0 \ref BtdrvGattAttributeUuid
* @param[in] uuid1 \ref BtdrvGattAttributeUuid
* @param[in] unk1 Unknown
* @note Broken behaviour due to internal bugs.
* @param[in] server_if Server interface ID
* @param[in] serv_uuid Service UUID \ref BtdrvGattAttributeUuid
* @param[in] desc_uuid Descriptor UUID \ref BtdrvGattAttributeUuid
* @param[in] permissions \ref BtdrvGattAttributePermission
*/
Result btdrvAddGattDescriptor(u8 unk0, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, u16 unk1);
Result btdrvAddGattDescriptor(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *desc_uuid, u16 permissions);
/**
* @brief GetBleManagedEventInfo
* @note Only available on [5.0.0+].
* @note This is used by btm-sysmodule.
* @param[out] buffer Output buffer. 0x400-bytes from state is written here.
* @param[out] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvBleEventInfo.
* @param[in] size Output buffer size.
* @oaram[out] type Output BtdrvBleEventType.
* @param[out] type Output BtdrvBleEventType.
*/
Result btdrvGetBleManagedEventInfo(void* buffer, size_t size, BtdrvBleEventType *type);
/**
* @brief GetGattFirstCharacteristic
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] id \ref BtdrvGattId
* @param[in] flag Flag
* @param[in] uuid \ref BtdrvGattAttributeUuid
* @param[out] out_property Output Property.
* @param[out] out_char_id Output CharacteristicId \ref BtdrvGattId
* @param[in] conn_id Connection ID
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] filter_uuid Characteristic filter UUID \ref BtdrvGattAttributeUuid
* @param[out] out_property Output property \ref BtdrvGattCharacteristicProperty
* @param[out] out_char_id Output characteristic GATT ID \ref BtdrvGattId
*/
Result btdrvGetGattFirstCharacteristic(u32 unk, const BtdrvGattId *id, bool flag, const BtdrvGattAttributeUuid *uuid, u8 *out_property, BtdrvGattId *out_char_id);
Result btdrvGetGattFirstCharacteristic(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattAttributeUuid *filter_uuid, u8 *out_property, BtdrvGattId *out_char_id);
/**
* @brief GetGattNextCharacteristic
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] id0 \ref BtdrvGattId
* @param[in] flag Flag
* @param[in] id1 \ref BtdrvGattId
* @param[in] uuid \ref BtdrvGattAttributeUuid
* @param[out] out_property Output Property.
* @param[out] out_char_id Output CharacteristicId \ref BtdrvGattId
* @param[in] conn_id Connection ID
* @param[in] serv_id Service ID \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] char_id Previous characteristic GATT ID \ref BtdrvGattId
* @param[in] filter_uuid Characteristic filter UUID \ref BtdrvGattAttributeUuid
* @param[out] out_property Output property \ref BtdrvGattCharacteristicProperty
* @param[out] out_char_id Output characteristic GATT ID \ref BtdrvGattId
*/
Result btdrvGetGattNextCharacteristic(u32 unk, const BtdrvGattId *id0, bool flag, const BtdrvGattId *id1, const BtdrvGattAttributeUuid *uuid, u8 *out_property, BtdrvGattId *out_char_id);
Result btdrvGetGattNextCharacteristic(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattId *char_id, const BtdrvGattAttributeUuid *filter_uuid, u8 *out_property, BtdrvGattId *out_char_id);
/**
* @brief GetGattFirstDescriptor
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] id0 \ref BtdrvGattId
* @param[in] flag Flag
* @param[in] id1 \ref BtdrvGattId
* @param[in] uuid \ref BtdrvGattAttributeUuid
* @param[out] out_desc_id Output DescriptorId \ref BtdrvGattId
* @param[in] conn_id Connection ID
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] filter_uuid Descriptor filter UUID \ref BtdrvGattAttributeUuid
* @param[out] out_desc_id Output descriptor GATT ID \ref BtdrvGattId
*/
Result btdrvGetGattFirstDescriptor(u32 unk, const BtdrvGattId *id0, bool flag, const BtdrvGattId *id1, const BtdrvGattAttributeUuid *uuid, BtdrvGattId *out_desc_id);
Result btdrvGetGattFirstDescriptor(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattId *char_id, const BtdrvGattAttributeUuid *filter_uuid, BtdrvGattId *out_desc_id);
/**
* @brief GetGattNextDescriptor
* @note Only available on [5.0.0+].
* @param[in] unk Unknown
* @param[in] id0 \ref BtdrvGattId
* @param[in] flag Flag
* @param[in] id1 \ref BtdrvGattId
* @param[in] id2 \ref BtdrvGattId
* @param[in] uuid \ref BtdrvGattAttributeUuid
* @param[out] out_desc_id Output DescriptorId \ref BtdrvGattId
* @param[in] conn_id Connection ID
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] desc_id Previous descriptor GATT ID \ref BtdrvGattId
* @param[in] filter_uuid Descriptor filter UUID \ref BtdrvGattAttributeUuid
* @param[out] out_desc_id Output descriptor GATT ID \ref BtdrvGattId
*/
Result btdrvGetGattNextDescriptor(u32 unk, const BtdrvGattId *id0, bool flag, const BtdrvGattId *id1, const BtdrvGattId *id2, const BtdrvGattAttributeUuid *uuid, BtdrvGattId *out_desc_id);
Result btdrvGetGattNextDescriptor(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const BtdrvGattAttributeUuid *filter_uuid, BtdrvGattId *out_desc_id);
/**
* @brief RegisterGattManagedDataPath
@ -1195,80 +1241,80 @@ Result btdrvUnregisterGattDataPath(const BtdrvGattAttributeUuid *uuid);
* @brief ReadGattCharacteristic
* @note Only available on [5.0.0+].
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] unk Unknown
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] auth_req \ref BtdrvGattAuthReqType
*/
Result btdrvReadGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk);
Result btdrvReadGattCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u8 auth_req);
/**
* @brief ReadGattDescriptor
* @note Only available on [5.0.0+].
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] id2 \ref BtdrvGattId
* @param[in] unk Unknown
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] desc_id Descriptor GATT ID \ref BtdrvGattId
* @param[in] auth_req \ref BtdrvGattAuthReqType
*/
Result btdrvReadGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk);
Result btdrvReadGattDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, u8 auth_req);
/**
* @brief WriteGattCharacteristic
* @note Only available on [5.0.0+].
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size, must be <=0x258.
* @param[in] unk Unknown
* @param[in] flag Flag
* @param[in] auth_req \ref BtdrvGattAuthReqType
* @param[in] with_response Whether to use Write-With-Response write type or not
*/
Result btdrvWriteGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag);
Result btdrvWriteGattCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const void* buffer, size_t size, u8 auth_req, bool with_response);
/**
* @brief WriteGattDescriptor
* @note Only available on [5.0.0+].
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] id2 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
* @param[in] desc_id Descriptor GATT ID \ref BtdrvGattId
* @param[in] buffer Input buffer.
* @param[in] size Input buffer size, must be <=0x258.
* @param[in] unk Unknown
* @param[in] auth_req \ref BtdrvGattAuthReqType
*/
Result btdrvWriteGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk);
Result btdrvWriteGattDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const void* buffer, size_t size, u8 auth_req);
/**
* @brief RegisterGattNotification
* @note Only available on [5.0.0+].
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
*/
Result btdrvRegisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
Result btdrvRegisterGattNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id);
/**
* @brief UnregisterGattNotification
* @note Only available on [5.0.0+].
* @param[in] connection_handle ConnectionHandle
* @param[in] primary_service PrimaryService
* @param[in] id0 \ref BtdrvGattId
* @param[in] id1 \ref BtdrvGattId
* @param[in] is_primary Is a primary service or not
* @param[in] serv_id Service GATT ID \ref BtdrvGattId
* @param[in] char_id Characteristic GATT ID \ref BtdrvGattId
*/
Result btdrvUnregisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1);
Result btdrvUnregisterGattNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id);
/**
* @brief GetLeHidEventInfo
* @note Only available on [5.0.0+].
* @note The state used by this is reset after writing the data to output.
* @param[out] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvLeEventInfo.
* @param[out] buffer Output buffer. 0x400-bytes from state is written here. See \ref BtdrvBleEventInfo.
* @param[in] size Output buffer size.
* @oaram[out] type Output BleEventType.
* @param[out] type \ref BtdrvBleEventType.
*/
Result btdrvGetLeHidEventInfo(void* buffer, size_t size, BtdrvBleEventType *type);
@ -1284,10 +1330,10 @@ Result btdrvRegisterBleHidEvent(Event* out_event);
* @brief SetBleScanParameter
* @note Only available on [5.1.0+].
* @note This is used by btm-sysmodule.
* @param[in] unk0 Unknown
* @param[in] unk1 Unknown
* @param[in] scan_interval Scan interval
* @param[in] scan_window Scan window
*/
Result btdrvSetBleScanParameter(u16 unk0, u16 unk1);
Result btdrvSetBleScanParameter(u16 scan_interval, u16 scan_window);
/**
* @brief MoveToSecondaryPiconet

View File

@ -0,0 +1,917 @@
/**
* @file btdrv_ids.h
* @brief Bluetooth SIG assigned number definitions (see https://www.bluetooth.com/specifications/assigned-numbers/).
* @author ndeadly
* @copyright libnx Authors
*/
#pragma once
/// Extract \ref BtdrvAppearanceCategoryType from \ref BtdrvAppearanceType.
#define APPEARANCE_CATEGORY(x) ((x & 0xFFC0) >> 6)
/// AdType
typedef enum {
BtdrvAdType_Flags = 0x01, ///< Flags
BtdrvAdType_ServiceClassUuid16ListIncomplete = 0x02, ///< Incomplete List of 16-bit Service Class UUIDs
BtdrvAdType_ServiceClassUuid16ListComplete = 0x03, ///< Complete List of 16-bit Service Class UUIDs
BtdrvAdType_ServiceClassUuid32ListIncomplete = 0x04, ///< Incomplete List of 32-bit Service Class UUIDs
BtdrvAdType_ServiceClassUuid32ListComplete = 0x05, ///< Complete List of 32-bit Service Class UUIDs
BtdrvAdType_ServiceClassUuid128ListIncomplete = 0x06, ///< Incomplete List of 128-bit Service Class UUIDs
BtdrvAdType_ServiceClassUuid128ListComplete = 0x07, ///< Complete List of 128-bit Service Class UUIDs
BtdrvAdType_ShortenedLocalName = 0x08, ///< Shortened Local Name
BtdrvAdType_CompleteLocalName = 0x09, ///< Complete Local Name
BtdrvAdType_TxPowerLevel = 0x0A, ///< Tx Power Level
BtdrvAdType_ClassOfDevice = 0x0D, ///< Class of Device
BtdrvAdType_SimplePairingHashC192 = 0x0E, ///< Simple Pairing Hash C-192
BtdrvAdType_SimplePairingRandomizerR192 = 0x0F, ///< Simple Pairing Randomizer R-192
BtdrvAdType_DeviceId = 0x10, ///< Device ID
BtdrvAdType_SecurityManagerTkValue = 0x10, ///< Security Manager TK Value
BtdrvAdType_SecurityManagerOutOfBandFlags = 0x11, ///< Security Manager Out of Band Flags
BtdrvAdType_PeripheralConnectionIntervalRange = 0x12, ///< Peripheral Connection Interval Range
BtdrvAdType_ServiceSolicitationUuid16List = 0x14, ///< List of 16-bit Service Solicitation UUIDs
BtdrvAdType_ServiceSolicitationUuid128List = 0x15, ///< List of 128-bit Service Solicitation UUIDs
BtdrvAdType_ServiceDataUuid16 = 0x16, ///< Service Data - 16-bit UUID
BtdrvAdType_PublicTargetAddress = 0x17, ///< Public Target Address
BtdrvAdType_RandomTargetAddress = 0x18, ///< Random Target Address
BtdrvAdType_Appearance = 0x19, ///< Appearance
BtdrvAdType_AdvertisingInterval = 0x1A, ///< Advertising Interval
BtdrvAdType_LeBluetoothDeviceAddress = 0x1B, ///< LE Bluetooth Device Address
BtdrvAdType_LeRole = 0x1C, ///< LE Role
BtdrvAdType_SimplePairingHashC256 = 0x1D, ///< Simple Pairing Hash C-256
BtdrvAdType_SimplePairingRandomizerR256 = 0x1E, ///< Simple Pairing Randomizer R-256
BtdrvAdType_ServiceSolicitationUuid32List = 0x1F, ///< List of 32-bit Service Solicitation UUIDs
BtdrvAdType_ServiceDataUuid32 = 0x20, ///< Service Data - 32-bit UUID
BtdrvAdType_ServiceDataUuid128 = 0x21, ///< Service Data - 128-bit UUID
BtdrvAdType_LeSecureConnectionsConfirmationValue = 0x22, ///< LE Secure Connections Confirmation Value
BtdrvAdType_LeSecureConnectionsRandomValue = 0x23, ///< LE Secure Connections Random Value
BtdrvAdType_Uri = 0x24, ///< URI
BtdrvAdType_IndoorPositioning = 0x25, ///< Indoor Positioning
BtdrvAdType_TransportDiscoveryData = 0x26, ///< Transport Discovery Data
BtdrvAdType_LeSupportedFeatures = 0x27, ///< LE Supported Features
BtdrvAdType_ChannelMapUpdateIndication = 0x28, ///< Channel Map Update Indication
BtdrvAdType_PbAdv = 0x29, ///< PB-ADV
BtdrvAdType_MeshMessage = 0x2A, ///< Mesh Message
BtdrvAdType_MeshBeacon = 0x2B, ///< Mesh Beacon
BtdrvAdType_Biginfo = 0x2C, ///< BIGInfo
BtdrvAdType_BroadcastCode = 0x2D, ///< Broadcast_Code
BtdrvAdType_ResolvableSetIdentifier = 0x2E, ///< Resolvable Set Identifier
BtdrvAdType_AdvertisingIntervalLong = 0x2F, ///< Advertising Interval - long
BtdrvAdType_BroadcastName = 0x30, ///< Broadcast_Name
BtdrvAdType_EncryptedAdvertisingData = 0x31, ///< Encrypted Advertising Data
BtdrvAdType_PeriodicAdvertisingResponseTimingInformation = 0x32, ///< Periodic Advertising Response Timing Information
BtdrvAdType_ElectronicShelfLabel = 0x34, ///< Electronic Shelf Label
BtdrvAdType_3DInformationData = 0x3D, ///< 3D Information Data
BtdrvAdType_ManufacturerSpecificData = 0xFF, ///< Manufacturer Specific Data
} BtdrvAdType;
/// AppearanceCategoryType
typedef enum {
BtdrvAppearanceCategoryType_Unknown = 0x000, ///< Unknown
BtdrvAppearanceCategoryType_Phone = 0x001, ///< Phone
BtdrvAppearanceCategoryType_Computer = 0x002, ///< Computer
BtdrvAppearanceCategoryType_Watch = 0x003, ///< Watch
BtdrvAppearanceCategoryType_Clock = 0x004, ///< Clock
BtdrvAppearanceCategoryType_Display = 0x005, ///< Display
BtdrvAppearanceCategoryType_RemoteControl = 0x006, ///< Remote Control
BtdrvAppearanceCategoryType_EyeGlasses = 0x007, ///< Eye-glasses
BtdrvAppearanceCategoryType_Tag = 0x008, ///< Tag
BtdrvAppearanceCategoryType_Keyring = 0x009, ///< Keyring
BtdrvAppearanceCategoryType_MediaPlayer = 0x00A, ///< Media Player
BtdrvAppearanceCategoryType_BarcodeScanner = 0x00B, ///< Barcode Scanner
BtdrvAppearanceCategoryType_Thermometer = 0x00C, ///< Thermometer
BtdrvAppearanceCategoryType_HeartRateSensor = 0x00D, ///< Heart Rate Sensor
BtdrvAppearanceCategoryType_BloodPressure = 0x00E, ///< Blood Pressure
BtdrvAppearanceCategoryType_HumanInterfaceDevice = 0x00F, ///< Human Interface Device
BtdrvAppearanceCategoryType_GlucoseMeter = 0x010, ///< Glucose Meter
BtdrvAppearanceCategoryType_RunningWalkingSensor = 0x011, ///< Running Walking Sensor
BtdrvAppearanceCategoryType_Cycling = 0x012, ///< Cycling
BtdrvAppearanceCategoryType_ControlDevice = 0x013, ///< Control Device
BtdrvAppearanceCategoryType_NetworkDevice = 0x014, ///< Network Device
BtdrvAppearanceCategoryType_Sensor = 0x015, ///< Sensor
BtdrvAppearanceCategoryType_LightFixtures = 0x016, ///< Light Fixtures
BtdrvAppearanceCategoryType_Fan = 0x017, ///< Fan
BtdrvAppearanceCategoryType_Hvac = 0x018, ///< HVAC
BtdrvAppearanceCategoryType_AirConditioning = 0x019, ///< Air Conditioning
BtdrvAppearanceCategoryType_Humidifier = 0x01A, ///< Humidifier
BtdrvAppearanceCategoryType_Heating = 0x01B, ///< Heating
BtdrvAppearanceCategoryType_AccessControl = 0x01C, ///< Access Control
BtdrvAppearanceCategoryType_MotorizedDevice = 0x01D, ///< Motorized Device
BtdrvAppearanceCategoryType_PowerDevice = 0x01E, ///< Power Device
BtdrvAppearanceCategoryType_LightSource = 0x01F, ///< Light Source
BtdrvAppearanceCategoryType_WindowCovering = 0x020, ///< Window Covering
BtdrvAppearanceCategoryType_AudioSink = 0x021, ///< Audio Sink
BtdrvAppearanceCategoryType_AudioSource = 0x022, ///< Audio Source
BtdrvAppearanceCategoryType_MotorizedVehicle = 0x023, ///< Motorized Vehicle
BtdrvAppearanceCategoryType_DomesticAppliance = 0x024, ///< Domestic Appliance
BtdrvAppearanceCategoryType_WearableAudioDevice = 0x025, ///< Wearable Audio Device
BtdrvAppearanceCategoryType_Aircraft = 0x026, ///< Aircraft
BtdrvAppearanceCategoryType_AvEquipment = 0x027, ///< AV Equipment
BtdrvAppearanceCategoryType_DisplayEquipment = 0x028, ///< Display Equipment
BtdrvAppearanceCategoryType_HearingAid = 0x029, ///< Hearing aid
BtdrvAppearanceCategoryType_Gaming = 0x02A, ///< Gaming
BtdrvAppearanceCategoryType_PulseOximeter = 0x031, ///< Pulse Oximeter
BtdrvAppearanceCategoryType_WeightScale = 0x032, ///< Weight Scale
BtdrvAppearanceCategoryType_PersonalMobilityDevice = 0x033, ///< Personal Mobility Device
BtdrvAppearanceCategoryType_ContinuousGlucoseMonitor = 0x034, ///< Continuous Glucose Monitor
BtdrvAppearanceCategoryType_InsulinPump = 0x035, ///< Insulin Pump
BtdrvAppearanceCategoryType_MedicationDelivery = 0x036, ///< Medication Delivery
BtdrvAppearanceCategoryType_Spirometer = 0x037, ///< Spirometer
BtdrvAppearanceCategoryType_OutdoorSportsActivity = 0x051, ///< Outdoor Sports Activity
} BtdrvAppearanceCategoryType;
/// AppearanceType
typedef enum {
BtdrvAppearanceType_DesktopWorkstation = 0x0081, ///< Desktop Workstation
BtdrvAppearanceType_ServerClassComputer = 0x0082, ///< Server-class Computer
BtdrvAppearanceType_Laptop = 0x0083, ///< Laptop
BtdrvAppearanceType_HandheldPcPdaClamshell = 0x0084, ///< Handheld PC/PDA (clamshell)
BtdrvAppearanceType_PalmSizePcPda = 0x0085, ///< Palm-size PC/PDA
BtdrvAppearanceType_WearableComputerWatchSize = 0x0086, ///< Wearable computer (watch size)
BtdrvAppearanceType_Tablet = 0x0087, ///< Tablet
BtdrvAppearanceType_DockingStation = 0x0088, ///< Docking Station
BtdrvAppearanceType_AllInOne = 0x0089, ///< All in One
BtdrvAppearanceType_BladeServer = 0x008A, ///< Blade Server
BtdrvAppearanceType_Convertible = 0x008B, ///< Convertible
BtdrvAppearanceType_Detachable = 0x008C, ///< Detachable
BtdrvAppearanceType_IotGateway = 0x008D, ///< IoT Gateway
BtdrvAppearanceType_MiniPc = 0x008E, ///< Mini PC
BtdrvAppearanceType_StickPc = 0x008F, ///< Stick PC
BtdrvAppearanceType_SportsWatch = 0x00C1, ///< Sports Watch
BtdrvAppearanceType_Smartwatch = 0x00C2, ///< Smartwatch
BtdrvAppearanceType_EarThermometer = 0x0301, ///< Ear Thermometer
BtdrvAppearanceType_HeartRateBelt = 0x0341, ///< Heart Rate Belt
BtdrvAppearanceType_ArmBloodPressure = 0x0381, ///< Arm Blood Pressure
BtdrvAppearanceType_WristBloodPressure = 0x0382, ///< Wrist Blood Pressure
BtdrvAppearanceType_Keyboard = 0x03C1, ///< Keyboard
BtdrvAppearanceType_Mouse = 0x03C2, ///< Mouse
BtdrvAppearanceType_Joystick = 0x03C3, ///< Joystick
BtdrvAppearanceType_Gamepad = 0x03C4, ///< Gamepad
BtdrvAppearanceType_DigitizerTablet = 0x03C5, ///< Digitizer Tablet
BtdrvAppearanceType_CardReader = 0x03C6, ///< Card Reader
BtdrvAppearanceType_DigitalPen = 0x03C7, ///< Digital Pen
BtdrvAppearanceType_BarcodeScanner = 0x03C8, ///< Barcode Scanner
BtdrvAppearanceType_Touchpad = 0x03C9, ///< Touchpad
BtdrvAppearanceType_PresentationRemote = 0x03CA, ///< Presentation Remote
BtdrvAppearanceType_InShoeRunningWalkingSensor = 0x0441, ///< In-Shoe Running Walking Sensor
BtdrvAppearanceType_OnShoeRunningWalkingSensor = 0x0442, ///< On-Shoe Running Walking Sensor
BtdrvAppearanceType_OnHipRunningWalkingSensor = 0x0443, ///< On-Hip Running Walking Sensor
BtdrvAppearanceType_CyclingComputer = 0x0481, ///< Cycling Computer
BtdrvAppearanceType_SpeedSensor = 0x0482, ///< Speed Sensor
BtdrvAppearanceType_CadenceSensor = 0x0483, ///< Cadence Sensor
BtdrvAppearanceType_PowerSensor = 0x0484, ///< Power Sensor
BtdrvAppearanceType_SpeedAndCadenceSensor = 0x0485, ///< Speed and Cadence Sensor
BtdrvAppearanceType_Switch = 0x04C1, ///< Switch
BtdrvAppearanceType_MultiSwitch = 0x04C2, ///< Multi-switch
BtdrvAppearanceType_Button = 0x04C3, ///< Button
BtdrvAppearanceType_Slider = 0x04C4, ///< Slider
BtdrvAppearanceType_RotarySwitch = 0x04C5, ///< Rotary Switch
BtdrvAppearanceType_TouchPanel = 0x04C6, ///< Touch Panel
BtdrvAppearanceType_SingleSwitch = 0x04C7, ///< Single Switch
BtdrvAppearanceType_DoubleSwitch = 0x04C8, ///< Double Switch
BtdrvAppearanceType_TripleSwitch = 0x04C9, ///< Triple Switch
BtdrvAppearanceType_BatterySwitch = 0x04CA, ///< Battery Switch
BtdrvAppearanceType_EnergyHarvestingSwitch = 0x04CB, ///< Energy Harvesting Switch
BtdrvAppearanceType_PushButton = 0x04CC, ///< Push Button
BtdrvAppearanceType_AccessPoint = 0x0501, ///< Access Point
BtdrvAppearanceType_MeshDevice = 0x0502, ///< Mesh Device
BtdrvAppearanceType_MeshNetworkProxy = 0x0503, ///< Mesh Network Proxy
BtdrvAppearanceType_MotionSensor = 0x0541, ///< Motion Sensor
BtdrvAppearanceType_AirQualitySensor = 0x0542, ///< Air quality Sensor
BtdrvAppearanceType_TemperatureSensor = 0x0543, ///< Temperature Sensor
BtdrvAppearanceType_HumiditySensor = 0x0544, ///< Humidity Sensor
BtdrvAppearanceType_LeakSensor = 0x0545, ///< Leak Sensor
BtdrvAppearanceType_SmokeSensor = 0x0546, ///< Smoke Sensor
BtdrvAppearanceType_OccupancySensor = 0x0547, ///< Occupancy Sensor
BtdrvAppearanceType_ContactSensor = 0x0548, ///< Contact Sensor
BtdrvAppearanceType_CarbonMonoxideSensor = 0x0549, ///< Carbon Monoxide Sensor
BtdrvAppearanceType_CarbonDioxideSensor = 0x054A, ///< Carbon Dioxide Sensor
BtdrvAppearanceType_AmbientLightSensor = 0x054B, ///< Ambient Light Sensor
BtdrvAppearanceType_EnergySensor = 0x054C, ///< Energy Sensor
BtdrvAppearanceType_ColorLightSensor = 0x054D, ///< Color Light Sensor
BtdrvAppearanceType_RainSensor = 0x054E, ///< Rain Sensor
BtdrvAppearanceType_FireSensor = 0x054F, ///< Fire Sensor
BtdrvAppearanceType_WindSensor = 0x0550, ///< Wind Sensor
BtdrvAppearanceType_ProximitySensor = 0x0551, ///< Proximity Sensor
BtdrvAppearanceType_MultiSensor = 0x0552, ///< Multi-Sensor
BtdrvAppearanceType_FlushMountedSensor = 0x0553, ///< Flush Mounted Sensor
BtdrvAppearanceType_CeilingMountedSensor = 0x0554, ///< Ceiling Mounted Sensor
BtdrvAppearanceType_WallMountedSensor = 0x0555, ///< Wall Mounted Sensor
BtdrvAppearanceType_Multisensor = 0x0556, ///< Multisensor
BtdrvAppearanceType_EnergyMeter = 0x0557, ///< Energy Meter
BtdrvAppearanceType_FlameDetector = 0x0558, ///< Flame Detector
BtdrvAppearanceType_VehicleTirePressureSensor = 0x0559, ///< Vehicle Tire Pressure Sensor
BtdrvAppearanceType_WallLight = 0x0581, ///< Wall Light
BtdrvAppearanceType_CeilingLight = 0x0582, ///< Ceiling Light
BtdrvAppearanceType_FloorLight = 0x0583, ///< Floor Light
BtdrvAppearanceType_CabinetLight = 0x0584, ///< Cabinet Light
BtdrvAppearanceType_DeskLight = 0x0585, ///< Desk Light
BtdrvAppearanceType_TrofferLight = 0x0586, ///< Troffer Light
BtdrvAppearanceType_PendantLight = 0x0587, ///< Pendant Light
BtdrvAppearanceType_InGroundLight = 0x0588, ///< In-ground Light
BtdrvAppearanceType_FloodLight = 0x0589, ///< Flood Light
BtdrvAppearanceType_UnderwaterLight = 0x058A, ///< Underwater Light
BtdrvAppearanceType_BollardWithLight = 0x058B, ///< Bollard with Light
BtdrvAppearanceType_PathwayLight = 0x058C, ///< Pathway Light
BtdrvAppearanceType_GardenLight = 0x058D, ///< Garden Light
BtdrvAppearanceType_PoleTopLight = 0x058E, ///< Pole-top Light
BtdrvAppearanceType_Spotlight = 0x058F, ///< Spotlight
BtdrvAppearanceType_LinearLight = 0x0590, ///< Linear Light
BtdrvAppearanceType_StreetLight = 0x0591, ///< Street Light
BtdrvAppearanceType_ShelvesLight = 0x0592, ///< Shelves Light
BtdrvAppearanceType_BayLight = 0x0593, ///< Bay Light
BtdrvAppearanceType_EmergencyExitLight = 0x0594, ///< Emergency Exit Light
BtdrvAppearanceType_LightController = 0x0595, ///< Light Controller
BtdrvAppearanceType_LightDriver = 0x0596, ///< Light Driver
BtdrvAppearanceType_Bulb = 0x0597, ///< Bulb
BtdrvAppearanceType_LowBayLight = 0x0598, ///< Low-bay Light
BtdrvAppearanceType_HighBayLight = 0x0599, ///< High-bay Light
BtdrvAppearanceType_CeilingFan = 0x05C1, ///< Ceiling Fan
BtdrvAppearanceType_AxialFan = 0x05C2, ///< Axial Fan
BtdrvAppearanceType_ExhaustFan = 0x05C3, ///< Exhaust Fan
BtdrvAppearanceType_PedestalFan = 0x05C4, ///< Pedestal Fan
BtdrvAppearanceType_DeskFan = 0x05C5, ///< Desk Fan
BtdrvAppearanceType_WallFan = 0x05C6, ///< Wall Fan
BtdrvAppearanceType_Thermostat = 0x0601, ///< Thermostat
BtdrvAppearanceType_Humidifier = 0x0602, ///< Humidifier
BtdrvAppearanceType_DeHumidifier = 0x0603, ///< De-humidifier
BtdrvAppearanceType_Heater = 0x0604, ///< Heater
BtdrvAppearanceType_HvacRadiator = 0x0605, ///< HVAC Radiator
BtdrvAppearanceType_HvacBoiler = 0x0606, ///< HVAC Boiler
BtdrvAppearanceType_HvacHeatPump = 0x0607, ///< HVAC Heat Pump
BtdrvAppearanceType_HvacInfraredHeater = 0x0608, ///< HVAC Infrared Heater
BtdrvAppearanceType_HvacRadiantPanelHeater = 0x0609, ///< HVAC Radiant Panel Heater
BtdrvAppearanceType_HvacFanHeater = 0x060A, ///< HVAC Fan Heater
BtdrvAppearanceType_HvacAirCurtain = 0x060B, ///< HVAC Air Curtain
BtdrvAppearanceType_HeatingRadiator = 0x06C1, ///< Heating Radiator
BtdrvAppearanceType_HeatingBoiler = 0x06C2, ///< Heating Boiler
BtdrvAppearanceType_HeatingHeatPump = 0x06C3, ///< Heating Heat Pump
BtdrvAppearanceType_HeatingInfraredHeater = 0x06C4, ///< Heating Infrared Heater
BtdrvAppearanceType_HeatingRadiantPanelHeater = 0x06C5, ///< Heating Radiant Panel Heater
BtdrvAppearanceType_HeatingFanHeater = 0x06C6, ///< Heating Fan Heater
BtdrvAppearanceType_HeatingAirCurtain = 0x06C7, ///< Heating Air Curtain
BtdrvAppearanceType_AccessDoor = 0x0701, ///< Access Door
BtdrvAppearanceType_GarageDoor = 0x0702, ///< Garage Door
BtdrvAppearanceType_EmergencyExitDoor = 0x0703, ///< Emergency Exit Door
BtdrvAppearanceType_AccessLock = 0x0704, ///< Access Lock
BtdrvAppearanceType_Elevator = 0x0705, ///< Elevator
BtdrvAppearanceType_Window = 0x0706, ///< Window
BtdrvAppearanceType_EntranceGate = 0x0707, ///< Entrance Gate
BtdrvAppearanceType_DoorLock = 0x0708, ///< Door Lock
BtdrvAppearanceType_Locker = 0x0709, ///< Locker
BtdrvAppearanceType_MotorizedGate = 0x0741, ///< Motorized Gate
BtdrvAppearanceType_Awning = 0x0742, ///< Awning
BtdrvAppearanceType_BlindsOrShades = 0x0743, ///< Blinds or Shades
BtdrvAppearanceType_Curtains = 0x0744, ///< Curtains
BtdrvAppearanceType_Screen = 0x0745, ///< Screen
BtdrvAppearanceType_PowerOutlet = 0x0781, ///< Power Outlet
BtdrvAppearanceType_PowerStrip = 0x0782, ///< Power Strip
BtdrvAppearanceType_Plug = 0x0783, ///< Plug
BtdrvAppearanceType_PowerSupply = 0x0784, ///< Power Supply
BtdrvAppearanceType_LedDriver = 0x0785, ///< LED Driver
BtdrvAppearanceType_FluorescentLampGear = 0x0786, ///< Fluorescent Lamp Gear
BtdrvAppearanceType_HidLampGear = 0x0787, ///< HID Lamp Gear
BtdrvAppearanceType_ChargeCase = 0x0788, ///< Charge Case
BtdrvAppearanceType_PowerBank = 0x0789, ///< Power Bank
BtdrvAppearanceType_IncandescentLightBulb = 0x07C1, ///< Incandescent Light Bulb
BtdrvAppearanceType_LedLamp = 0x07C2, ///< LED Lamp
BtdrvAppearanceType_HidLamp = 0x07C3, ///< HID Lamp
BtdrvAppearanceType_FluorescentLamp = 0x07C4, ///< Fluorescent Lamp
BtdrvAppearanceType_LedArray = 0x07C5, ///< LED Array
BtdrvAppearanceType_MultiColorLedArray = 0x07C6, ///< Multi-Color LED Array
BtdrvAppearanceType_LowVoltageHalogen = 0x07C7, ///< Low voltage halogen
BtdrvAppearanceType_OrganicLightEmittingDiodeOled = 0x07C8, ///< Organic light emitting diode (OLED)
BtdrvAppearanceType_WindowShades = 0x0801, ///< Window Shades
BtdrvAppearanceType_WindowBlinds = 0x0802, ///< Window Blinds
BtdrvAppearanceType_WindowAwning = 0x0803, ///< Window Awning
BtdrvAppearanceType_WindowCurtain = 0x0804, ///< Window Curtain
BtdrvAppearanceType_ExteriorShutter = 0x0805, ///< Exterior Shutter
BtdrvAppearanceType_ExteriorScreen = 0x0806, ///< Exterior Screen
BtdrvAppearanceType_StandaloneSpeaker = 0x0841, ///< Standalone Speaker
BtdrvAppearanceType_Soundbar = 0x0842, ///< Soundbar
BtdrvAppearanceType_BookshelfSpeaker = 0x0843, ///< Bookshelf Speaker
BtdrvAppearanceType_StandmountedSpeaker = 0x0844, ///< Standmounted Speaker
BtdrvAppearanceType_Speakerphone = 0x0845, ///< Speakerphone
BtdrvAppearanceType_Microphone = 0x0881, ///< Microphone
BtdrvAppearanceType_Alarm = 0x0882, ///< Alarm
BtdrvAppearanceType_Bell = 0x0883, ///< Bell
BtdrvAppearanceType_Horn = 0x0884, ///< Horn
BtdrvAppearanceType_BroadcastingDevice = 0x0885, ///< Broadcasting Device
BtdrvAppearanceType_ServiceDesk = 0x0886, ///< Service Desk
BtdrvAppearanceType_Kiosk = 0x0887, ///< Kiosk
BtdrvAppearanceType_BroadcastingRoom = 0x0888, ///< Broadcasting Room
BtdrvAppearanceType_Auditorium = 0x0889, ///< Auditorium
BtdrvAppearanceType_Car = 0x08C1, ///< Car
BtdrvAppearanceType_LargeGoodsVehicle = 0x08C2, ///< Large Goods Vehicle
BtdrvAppearanceType_2WheeledVehicle = 0x08C3, ///< 2-Wheeled Vehicle
BtdrvAppearanceType_Motorbike = 0x08C4, ///< Motorbike
BtdrvAppearanceType_Scooter = 0x08C5, ///< Scooter
BtdrvAppearanceType_Moped = 0x08C6, ///< Moped
BtdrvAppearanceType_3WheeledVehicle = 0x08C7, ///< 3-Wheeled Vehicle
BtdrvAppearanceType_LightVehicle = 0x08C8, ///< Light Vehicle
BtdrvAppearanceType_QuadBike = 0x08C9, ///< Quad Bike
BtdrvAppearanceType_Minibus = 0x08CA, ///< Minibus
BtdrvAppearanceType_Bus = 0x08CB, ///< Bus
BtdrvAppearanceType_Trolley = 0x08CC, ///< Trolley
BtdrvAppearanceType_AgriculturalVehicle = 0x08CD, ///< Agricultural Vehicle
BtdrvAppearanceType_CamperCaravan = 0x08CE, ///< Camper / Caravan
BtdrvAppearanceType_RecreationalVehicleMotorHome = 0x08CF, ///< Recreational Vehicle / Motor Home
BtdrvAppearanceType_Refrigerator = 0x0901, ///< Refrigerator
BtdrvAppearanceType_Freezer = 0x0902, ///< Freezer
BtdrvAppearanceType_Oven = 0x0903, ///< Oven
BtdrvAppearanceType_Microwave = 0x0904, ///< Microwave
BtdrvAppearanceType_Toaster = 0x0905, ///< Toaster
BtdrvAppearanceType_WashingMachine = 0x0906, ///< Washing Machine
BtdrvAppearanceType_Dryer = 0x0907, ///< Dryer
BtdrvAppearanceType_CoffeeMaker = 0x0908, ///< Coffee maker
BtdrvAppearanceType_ClothesIron = 0x0909, ///< Clothes iron
BtdrvAppearanceType_CurlingIron = 0x090A, ///< Curling iron
BtdrvAppearanceType_HairDryer = 0x090B, ///< Hair dryer
BtdrvAppearanceType_VacuumCleaner = 0x090C, ///< Vacuum cleaner
BtdrvAppearanceType_RoboticVacuumCleaner = 0x090D, ///< Robotic vacuum cleaner
BtdrvAppearanceType_RiceCooker = 0x090E, ///< Rice cooker
BtdrvAppearanceType_ClothesSteamer = 0x090F, ///< Clothes steamer
BtdrvAppearanceType_Earbud = 0x0941, ///< Earbud
BtdrvAppearanceType_Headset = 0x0942, ///< Headset
BtdrvAppearanceType_Headphones = 0x0943, ///< Headphones
BtdrvAppearanceType_NeckBand = 0x0944, ///< Neck Band
BtdrvAppearanceType_LightAircraft = 0x0981, ///< Light Aircraft
BtdrvAppearanceType_Microlight = 0x0982, ///< Microlight
BtdrvAppearanceType_Paraglider = 0x0983, ///< Paraglider
BtdrvAppearanceType_LargePassengerAircraft = 0x0984, ///< Large Passenger Aircraft
BtdrvAppearanceType_Amplifier = 0x09C1, ///< Amplifier
BtdrvAppearanceType_Receiver = 0x09C2, ///< Receiver
BtdrvAppearanceType_Radio = 0x09C3, ///< Radio
BtdrvAppearanceType_Tuner = 0x09C4, ///< Tuner
BtdrvAppearanceType_Turntable = 0x09C5, ///< Turntable
BtdrvAppearanceType_CdPlayer = 0x09C6, ///< CD Player
BtdrvAppearanceType_DvdPlayer = 0x09C7, ///< DVD Player
BtdrvAppearanceType_BlurayPlayer = 0x09C8, ///< Bluray Player
BtdrvAppearanceType_OpticalDiscPlayer = 0x09C9, ///< Optical Disc Player
BtdrvAppearanceType_SetTopBox = 0x09CA, ///< Set-Top Box
BtdrvAppearanceType_Television = 0x0A01, ///< Television
BtdrvAppearanceType_Monitor = 0x0A02, ///< Monitor
BtdrvAppearanceType_Projector = 0x0A03, ///< Projector
BtdrvAppearanceType_InEarHearingAid = 0x0A41, ///< In-ear hearing aid
BtdrvAppearanceType_BehindEarHearingAid = 0x0A42, ///< Behind-ear hearing aid
BtdrvAppearanceType_CochlearImplant = 0x0A43, ///< Cochlear Implant
BtdrvAppearanceType_HomeVideoGameConsole = 0x0A81, ///< Home Video Game Console
BtdrvAppearanceType_PortableHandheldConsole = 0x0A82, ///< Portable handheld console
BtdrvAppearanceType_FingertipPulseOximeter = 0x0C41, ///< Fingertip Pulse Oximeter
BtdrvAppearanceType_WristWornPulseOximeter = 0x0C42, ///< Wrist Worn Pulse Oximeter
BtdrvAppearanceType_PoweredWheelchair = 0x0CC1, ///< Powered Wheelchair
BtdrvAppearanceType_MobilityScooter = 0x0CC2, ///< Mobility Scooter
BtdrvAppearanceType_InsulinPumpDurablePump = 0x0D41, ///< Insulin Pump, durable pump
BtdrvAppearanceType_InsulinPumpPatchPump = 0x0D44, ///< Insulin Pump, patch pump
BtdrvAppearanceType_InsulinPen = 0x0D48, ///< Insulin Pen
BtdrvAppearanceType_HandheldSpirometer = 0x0DC1, ///< Handheld Spirometer
BtdrvAppearanceType_LocationDisplay = 0x1441, ///< Location Display
BtdrvAppearanceType_LocationAndNavigationDisplay = 0x1442, ///< Location and Navigation Display
BtdrvAppearanceType_LocationPod = 0x1443, ///< Location Pod
BtdrvAppearanceType_LocationAndNavigationPod = 0x1444, ///< Location and Navigation Pod
} BtdrvAppearanceType;
/// GattServiceUuidType
typedef enum {
BtdrvGattServiceUuidType_GenericAccess = 0x1800, ///< Generic Access
BtdrvGattServiceUuidType_GenericAttribute = 0x1801, ///< Generic Attribute
BtdrvGattServiceUuidType_ImmediateAlert = 0x1802, ///< Immediate Alert
BtdrvGattServiceUuidType_LinkLoss = 0x1803, ///< Link Loss
BtdrvGattServiceUuidType_TxPower = 0x1804, ///< Tx Power
BtdrvGattServiceUuidType_CurrentTime = 0x1805, ///< Current Time
BtdrvGattServiceUuidType_ReferenceTimeUpdate = 0x1806, ///< Reference Time Update
BtdrvGattServiceUuidType_NextDstChange = 0x1807, ///< Next DST Change
BtdrvGattServiceUuidType_Glucose = 0x1808, ///< Glucose
BtdrvGattServiceUuidType_HealthThermometer = 0x1809, ///< Health Thermometer
BtdrvGattServiceUuidType_DeviceInformation = 0x180A, ///< Device Information
BtdrvGattServiceUuidType_HeartRate = 0x180D, ///< Heart Rate
BtdrvGattServiceUuidType_PhoneAlertStatus = 0x180E, ///< Phone Alert Status
BtdrvGattServiceUuidType_Battery = 0x180F, ///< Battery
BtdrvGattServiceUuidType_BloodPressure = 0x1810, ///< Blood Pressure
BtdrvGattServiceUuidType_AlertNotification = 0x1811, ///< Alert Notification
BtdrvGattServiceUuidType_HumanInterfaceDevice = 0x1812, ///< Human Interface Device
BtdrvGattServiceUuidType_ScanParameters = 0x1813, ///< Scan Parameters
BtdrvGattServiceUuidType_RunningSpeedAndCadence = 0x1814, ///< Running Speed and Cadence
BtdrvGattServiceUuidType_AutomationIo = 0x1815, ///< Automation IO
BtdrvGattServiceUuidType_CyclingSpeedAndCadence = 0x1816, ///< Cycling Speed and Cadence
BtdrvGattServiceUuidType_CyclingPower = 0x1818, ///< Cycling Power
BtdrvGattServiceUuidType_LocationAndNavigation = 0x1819, ///< Location and Navigation
BtdrvGattServiceUuidType_EnvironmentalSensing = 0x181A, ///< Environmental Sensing
BtdrvGattServiceUuidType_BodyComposition = 0x181B, ///< Body Composition
BtdrvGattServiceUuidType_UserData = 0x181C, ///< User Data
BtdrvGattServiceUuidType_WeightScale = 0x181D, ///< Weight Scale
BtdrvGattServiceUuidType_BondManagement = 0x181E, ///< Bond Management
BtdrvGattServiceUuidType_ContinuousGlucoseMonitoring = 0x181F, ///< Continuous Glucose Monitoring
BtdrvGattServiceUuidType_InternetProtocolSupport = 0x1820, ///< Internet Protocol Support
BtdrvGattServiceUuidType_IndoorPositioning = 0x1821, ///< Indoor Positioning
BtdrvGattServiceUuidType_PulseOximeter = 0x1822, ///< Pulse Oximeter
BtdrvGattServiceUuidType_HttpProxy = 0x1823, ///< HTTP Proxy
BtdrvGattServiceUuidType_TransportDiscovery = 0x1824, ///< Transport Discovery
BtdrvGattServiceUuidType_ObjectTransfer = 0x1825, ///< Object Transfer
BtdrvGattServiceUuidType_FitnessMachine = 0x1826, ///< Fitness Machine
BtdrvGattServiceUuidType_MeshProvisioning = 0x1827, ///< Mesh Provisioning
BtdrvGattServiceUuidType_MeshProxy = 0x1828, ///< Mesh Proxy
BtdrvGattServiceUuidType_ReconnectionConfiguration = 0x1829, ///< Reconnection Configuration
BtdrvGattServiceUuidType_InsulinDelivery = 0x183A, ///< Insulin Delivery
BtdrvGattServiceUuidType_BinarySensor = 0x183B, ///< Binary Sensor
BtdrvGattServiceUuidType_EmergencyConfiguration = 0x183C, ///< Emergency Configuration
BtdrvGattServiceUuidType_AuthorizationControl = 0x183D, ///< Authorization Control
BtdrvGattServiceUuidType_PhysicalActivityMonitor = 0x183E, ///< Physical Activity Monitor
BtdrvGattServiceUuidType_ElapsedTime = 0x183F, ///< Elapsed Time
BtdrvGattServiceUuidType_GenericHealthSensor = 0x1840, ///< Generic Health Sensor
BtdrvGattServiceUuidType_AudioInputControl = 0x1843, ///< Audio Input Control
BtdrvGattServiceUuidType_VolumeControl = 0x1844, ///< Volume Control
BtdrvGattServiceUuidType_VolumeOffsetControl = 0x1845, ///< Volume Offset Control
BtdrvGattServiceUuidType_CoordinatedSetIdentification = 0x1846, ///< Coordinated Set Identification
BtdrvGattServiceUuidType_DeviceTime = 0x1847, ///< Device Time
BtdrvGattServiceUuidType_MediaControl = 0x1848, ///< Media Control
BtdrvGattServiceUuidType_GenericMediaControl = 0x1849, ///< Generic Media Control
BtdrvGattServiceUuidType_ConstantToneExtension = 0x184A, ///< Constant Tone Extension
BtdrvGattServiceUuidType_TelephoneBearer = 0x184B, ///< Telephone Bearer
BtdrvGattServiceUuidType_GenericTelephoneBearer = 0x184C, ///< Generic Telephone Bearer
BtdrvGattServiceUuidType_MicrophoneControl = 0x184D, ///< Microphone Control
BtdrvGattServiceUuidType_AudioStreamControl = 0x184E, ///< Audio Stream Control
BtdrvGattServiceUuidType_BroadcastAudioScan = 0x184F, ///< Broadcast Audio Scan
BtdrvGattServiceUuidType_PublishedAudioCapabilities = 0x1850, ///< Published Audio Capabilities
BtdrvGattServiceUuidType_BasicAudioAnnouncement = 0x1851, ///< Basic Audio Announcement
BtdrvGattServiceUuidType_BroadcastAudioAnnouncement = 0x1852, ///< Broadcast Audio Announcement
BtdrvGattServiceUuidType_CommonAudio = 0x1853, ///< Common Audio
BtdrvGattServiceUuidType_HearingAccess = 0x1854, ///< Hearing Access
BtdrvGattServiceUuidType_TelephonyAndMediaAudio = 0x1855, ///< Telephony and Media Audio
BtdrvGattServiceUuidType_PublicBroadcastAnnouncement = 0x1856, ///< Public Broadcast Announcement
BtdrvGattServiceUuidType_ElectronicShelfLabel = 0x1857, ///< Electronic Shelf Label
} BtdrvGattServiceUuidType;
/// GattCharacteristicUuidType
typedef enum {
BtdrvGattCharacteristicUuidType_DeviceName = 0x2A00, ///< Device Name
BtdrvGattCharacteristicUuidType_Appearance = 0x2A01, ///< Appearance
BtdrvGattCharacteristicUuidType_PeripheralPrivacyFlag = 0x2A02, ///< Peripheral Privacy Flag
BtdrvGattCharacteristicUuidType_ReconnectionAddress = 0x2A03, ///< Reconnection Address
BtdrvGattCharacteristicUuidType_PeripheralPreferredConnectionParameters = 0x2A04, ///< Peripheral Preferred Connection Parameters
BtdrvGattCharacteristicUuidType_ServiceChanged = 0x2A05, ///< Service Changed
BtdrvGattCharacteristicUuidType_AlertLevel = 0x2A06, ///< Alert Level
BtdrvGattCharacteristicUuidType_TxPowerLevel = 0x2A07, ///< Tx Power Level
BtdrvGattCharacteristicUuidType_DateTime = 0x2A08, ///< Date Time
BtdrvGattCharacteristicUuidType_DayOfWeek = 0x2A09, ///< Day of Week
BtdrvGattCharacteristicUuidType_DayDateTime = 0x2A0A, ///< Day Date Time
BtdrvGattCharacteristicUuidType_ExactTime256 = 0x2A0C, ///< Exact Time 256
BtdrvGattCharacteristicUuidType_DstOffset = 0x2A0D, ///< DST Offset
BtdrvGattCharacteristicUuidType_TimeZone = 0x2A0E, ///< Time Zone
BtdrvGattCharacteristicUuidType_LocalTimeInformation = 0x2A0F, ///< Local Time Information
BtdrvGattCharacteristicUuidType_TimeWithDst = 0x2A11, ///< Time with DST
BtdrvGattCharacteristicUuidType_TimeAccuracy = 0x2A12, ///< Time Accuracy
BtdrvGattCharacteristicUuidType_TimeSource = 0x2A13, ///< Time Source
BtdrvGattCharacteristicUuidType_ReferenceTimeInformation = 0x2A14, ///< Reference Time Information
BtdrvGattCharacteristicUuidType_TimeUpdateControlPoint = 0x2A16, ///< Time Update Control Point
BtdrvGattCharacteristicUuidType_TimeUpdateState = 0x2A17, ///< Time Update State
BtdrvGattCharacteristicUuidType_GlucoseMeasurement = 0x2A18, ///< Glucose Measurement
BtdrvGattCharacteristicUuidType_BatteryLevel = 0x2A19, ///< Battery Level
BtdrvGattCharacteristicUuidType_TemperatureMeasurement = 0x2A1C, ///< Temperature Measurement
BtdrvGattCharacteristicUuidType_TemperatureType = 0x2A1D, ///< Temperature Type
BtdrvGattCharacteristicUuidType_IntermediateTemperature = 0x2A1E, ///< Intermediate Temperature
BtdrvGattCharacteristicUuidType_MeasurementInterval = 0x2A21, ///< Measurement Interval
BtdrvGattCharacteristicUuidType_BootKeyboardInputReport = 0x2A22, ///< Boot Keyboard Input Report
BtdrvGattCharacteristicUuidType_SystemId = 0x2A23, ///< System ID
BtdrvGattCharacteristicUuidType_ModelNumberString = 0x2A24, ///< Model Number String
BtdrvGattCharacteristicUuidType_SerialNumberString = 0x2A25, ///< Serial Number String
BtdrvGattCharacteristicUuidType_FirmwareRevisionString = 0x2A26, ///< Firmware Revision String
BtdrvGattCharacteristicUuidType_HardwareRevisionString = 0x2A27, ///< Hardware Revision String
BtdrvGattCharacteristicUuidType_SoftwareRevisionString = 0x2A28, ///< Software Revision String
BtdrvGattCharacteristicUuidType_ManufacturerNameString = 0x2A29, ///< Manufacturer Name String
BtdrvGattCharacteristicUuidType_IeeeRegulatoryCertificationDataList = 0x2A2A, ///< IEEE 11073-20601 Regulatory Certification Data List
BtdrvGattCharacteristicUuidType_CurrentTime = 0x2A2B, ///< Current Time
BtdrvGattCharacteristicUuidType_MagneticDeclination = 0x2A2C, ///< Magnetic Declination
BtdrvGattCharacteristicUuidType_ScanRefresh = 0x2A31, ///< Scan Refresh
BtdrvGattCharacteristicUuidType_BootKeyboardOutputReport = 0x2A32, ///< Boot Keyboard Output Report
BtdrvGattCharacteristicUuidType_BootMouseInputReport = 0x2A33, ///< Boot Mouse Input Report
BtdrvGattCharacteristicUuidType_GlucoseMeasurementContext = 0x2A34, ///< Glucose Measurement Context
BtdrvGattCharacteristicUuidType_BloodPressureMeasurement = 0x2A35, ///< Blood Pressure Measurement
BtdrvGattCharacteristicUuidType_IntermediateCuffPressure = 0x2A36, ///< Intermediate Cuff Pressure
BtdrvGattCharacteristicUuidType_HeartRateMeasurement = 0x2A37, ///< Heart Rate Measurement
BtdrvGattCharacteristicUuidType_BodySensorLocation = 0x2A38, ///< Body Sensor Location
BtdrvGattCharacteristicUuidType_HeartRateControlPoint = 0x2A39, ///< Heart Rate Control Point
BtdrvGattCharacteristicUuidType_AlertStatus = 0x2A3F, ///< Alert Status
BtdrvGattCharacteristicUuidType_RingerControlPoint = 0x2A40, ///< Ringer Control Point
BtdrvGattCharacteristicUuidType_RingerSetting = 0x2A41, ///< Ringer Setting
BtdrvGattCharacteristicUuidType_AlertCategoryIdBitMask = 0x2A42, ///< Alert Category ID Bit Mask
BtdrvGattCharacteristicUuidType_AlertCategoryId = 0x2A43, ///< Alert Category ID
BtdrvGattCharacteristicUuidType_AlertNotificationControlPoint = 0x2A44, ///< Alert Notification Control Point
BtdrvGattCharacteristicUuidType_UnreadAlertStatus = 0x2A45, ///< Unread Alert Status
BtdrvGattCharacteristicUuidType_NewAlert = 0x2A46, ///< New Alert
BtdrvGattCharacteristicUuidType_SupportedNewAlertCategory = 0x2A47, ///< Supported New Alert Category
BtdrvGattCharacteristicUuidType_SupportedUnreadAlertCategory = 0x2A48, ///< Supported Unread Alert Category
BtdrvGattCharacteristicUuidType_BloodPressureFeature = 0x2A49, ///< Blood Pressure Feature
BtdrvGattCharacteristicUuidType_HidInformation = 0x2A4A, ///< HID Information
BtdrvGattCharacteristicUuidType_ReportMap = 0x2A4B, ///< Report Map
BtdrvGattCharacteristicUuidType_HidControlPoint = 0x2A4C, ///< HID Control Point
BtdrvGattCharacteristicUuidType_Report = 0x2A4D, ///< Report
BtdrvGattCharacteristicUuidType_ProtocolMode = 0x2A4E, ///< Protocol Mode
BtdrvGattCharacteristicUuidType_ScanIntervalWindow = 0x2A4F, ///< Scan Interval Window
BtdrvGattCharacteristicUuidType_PnpId = 0x2A50, ///< PnP ID
BtdrvGattCharacteristicUuidType_GlucoseFeature = 0x2A51, ///< Glucose Feature
BtdrvGattCharacteristicUuidType_RecordAccessControlPoint = 0x2A52, ///< Record Access Control Point
BtdrvGattCharacteristicUuidType_RscMeasurement = 0x2A53, ///< RSC Measurement
BtdrvGattCharacteristicUuidType_RscFeature = 0x2A54, ///< RSC Feature
BtdrvGattCharacteristicUuidType_ScControlPoint = 0x2A55, ///< SC Control Point
BtdrvGattCharacteristicUuidType_Aggregate = 0x2A5A, ///< Aggregate
BtdrvGattCharacteristicUuidType_CscMeasurement = 0x2A5B, ///< CSC Measurement
BtdrvGattCharacteristicUuidType_CscFeature = 0x2A5C, ///< CSC Feature
BtdrvGattCharacteristicUuidType_SensorLocation = 0x2A5D, ///< Sensor Location
BtdrvGattCharacteristicUuidType_PlxSpotCheckMeasurement = 0x2A5E, ///< PLX Spot-Check Measurement
BtdrvGattCharacteristicUuidType_PlxContinuousMeasurement = 0x2A5F, ///< PLX Continuous Measurement
BtdrvGattCharacteristicUuidType_PlxFeatures = 0x2A60, ///< PLX Features
BtdrvGattCharacteristicUuidType_CyclingPowerMeasurement = 0x2A63, ///< Cycling Power Measurement
BtdrvGattCharacteristicUuidType_CyclingPowerVector = 0x2A64, ///< Cycling Power Vector
BtdrvGattCharacteristicUuidType_CyclingPowerFeature = 0x2A65, ///< Cycling Power Feature
BtdrvGattCharacteristicUuidType_CyclingPowerControlPoint = 0x2A66, ///< Cycling Power Control Point
BtdrvGattCharacteristicUuidType_LocationAndSpeed = 0x2A67, ///< Location and Speed
BtdrvGattCharacteristicUuidType_Navigation = 0x2A68, ///< Navigation
BtdrvGattCharacteristicUuidType_PositionQuality = 0x2A69, ///< Position Quality
BtdrvGattCharacteristicUuidType_LnFeature = 0x2A6A, ///< LN Feature
BtdrvGattCharacteristicUuidType_LnControlPoint = 0x2A6B, ///< LN Control Point
BtdrvGattCharacteristicUuidType_Elevation = 0x2A6C, ///< Elevation
BtdrvGattCharacteristicUuidType_Pressure = 0x2A6D, ///< Pressure
BtdrvGattCharacteristicUuidType_Temperature = 0x2A6E, ///< Temperature
BtdrvGattCharacteristicUuidType_Humidity = 0x2A6F, ///< Humidity
BtdrvGattCharacteristicUuidType_TrueWindSpeed = 0x2A70, ///< True Wind Speed
BtdrvGattCharacteristicUuidType_TrueWindDirection = 0x2A71, ///< True Wind Direction
BtdrvGattCharacteristicUuidType_ApparentWindSpeed = 0x2A72, ///< Apparent Wind Speed
BtdrvGattCharacteristicUuidType_ApparentWindDirection = 0x2A73, ///< Apparent Wind Direction
BtdrvGattCharacteristicUuidType_GustFactor = 0x2A74, ///< Gust Factor
BtdrvGattCharacteristicUuidType_PollenConcentration = 0x2A75, ///< Pollen Concentration
BtdrvGattCharacteristicUuidType_UvIndex = 0x2A76, ///< UV Index
BtdrvGattCharacteristicUuidType_Irradiance = 0x2A77, ///< Irradiance
BtdrvGattCharacteristicUuidType_Rainfall = 0x2A78, ///< Rainfall
BtdrvGattCharacteristicUuidType_WindChill = 0x2A79, ///< Wind Chill
BtdrvGattCharacteristicUuidType_HeatIndex = 0x2A7A, ///< Heat Index
BtdrvGattCharacteristicUuidType_DewPoint = 0x2A7B, ///< Dew Point
BtdrvGattCharacteristicUuidType_DescriptorValueChanged = 0x2A7D, ///< Descriptor Value Changed
BtdrvGattCharacteristicUuidType_AerobicHeartRateLowerLimit = 0x2A7E, ///< Aerobic Heart Rate Lower Limit
BtdrvGattCharacteristicUuidType_AerobicThreshold = 0x2A7F, ///< Aerobic Threshold
BtdrvGattCharacteristicUuidType_Age = 0x2A80, ///< Age
BtdrvGattCharacteristicUuidType_AnaerobicHeartRateLowerLimit = 0x2A81, ///< Anaerobic Heart Rate Lower Limit
BtdrvGattCharacteristicUuidType_AnaerobicHeartRateUpperLimit = 0x2A82, ///< Anaerobic Heart Rate Upper Limit
BtdrvGattCharacteristicUuidType_AnaerobicThreshold = 0x2A83, ///< Anaerobic Threshold
BtdrvGattCharacteristicUuidType_AerobicHeartRateUpperLimit = 0x2A84, ///< Aerobic Heart Rate Upper Limit
BtdrvGattCharacteristicUuidType_DateOfBirth = 0x2A85, ///< Date of Birth
BtdrvGattCharacteristicUuidType_DateOfThresholdAssessment = 0x2A86, ///< Date of Threshold Assessment
BtdrvGattCharacteristicUuidType_EmailAddress = 0x2A87, ///< Email Address
BtdrvGattCharacteristicUuidType_FatBurnHeartRateLowerLimit = 0x2A88, ///< Fat Burn Heart Rate Lower Limit
BtdrvGattCharacteristicUuidType_FatBurnHeartRateUpperLimit = 0x2A89, ///< Fat Burn Heart Rate Upper Limit
BtdrvGattCharacteristicUuidType_FirstName = 0x2A8A, ///< First Name
BtdrvGattCharacteristicUuidType_FiveZoneHeartRateLimits = 0x2A8B, ///< Five Zone Heart Rate Limits
BtdrvGattCharacteristicUuidType_Gender = 0x2A8C, ///< Gender
BtdrvGattCharacteristicUuidType_HeartRateMax = 0x2A8D, ///< Heart Rate Max
BtdrvGattCharacteristicUuidType_Height = 0x2A8E, ///< Height
BtdrvGattCharacteristicUuidType_HipCircumference = 0x2A8F, ///< Hip Circumference
BtdrvGattCharacteristicUuidType_LastName = 0x2A90, ///< Last Name
BtdrvGattCharacteristicUuidType_MaximumRecommendedHeartRate = 0x2A91, ///< Maximum Recommended Heart Rate
BtdrvGattCharacteristicUuidType_RestingHeartRate = 0x2A92, ///< Resting Heart Rate
BtdrvGattCharacteristicUuidType_SportTypeForAerobicAndAnaerobicThresholds = 0x2A93, ///< Sport Type for Aerobic and Anaerobic Thresholds
BtdrvGattCharacteristicUuidType_ThreeZoneHeartRateLimits = 0x2A94, ///< Three Zone Heart Rate Limits
BtdrvGattCharacteristicUuidType_TwoZoneHeartRateLimits = 0x2A95, ///< Two Zone Heart Rate Limits
BtdrvGattCharacteristicUuidType_Vo2Max = 0x2A96, ///< VO2 Max
BtdrvGattCharacteristicUuidType_WaistCircumference = 0x2A97, ///< Waist Circumference
BtdrvGattCharacteristicUuidType_Weight = 0x2A98, ///< Weight
BtdrvGattCharacteristicUuidType_DatabaseChangeIncrement = 0x2A99, ///< Database Change Increment
BtdrvGattCharacteristicUuidType_UserIndex = 0x2A9A, ///< User Index
BtdrvGattCharacteristicUuidType_BodyCompositionFeature = 0x2A9B, ///< Body Composition Feature
BtdrvGattCharacteristicUuidType_BodyCompositionMeasurement = 0x2A9C, ///< Body Composition Measurement
BtdrvGattCharacteristicUuidType_WeightMeasurement = 0x2A9D, ///< Weight Measurement
BtdrvGattCharacteristicUuidType_WeightScaleFeature = 0x2A9E, ///< Weight Scale Feature
BtdrvGattCharacteristicUuidType_UserControlPoint = 0x2A9F, ///< User Control Point
BtdrvGattCharacteristicUuidType_MagneticFluxDensity2D = 0x2AA0, ///< Magnetic Flux Density - 2D
BtdrvGattCharacteristicUuidType_MagneticFluxDensity3D = 0x2AA1, ///< Magnetic Flux Density - 3D
BtdrvGattCharacteristicUuidType_Language = 0x2AA2, ///< Language
BtdrvGattCharacteristicUuidType_BarometricPressureTrend = 0x2AA3, ///< Barometric Pressure Trend
BtdrvGattCharacteristicUuidType_BondManagementControlPoint = 0x2AA4, ///< Bond Management Control Point
BtdrvGattCharacteristicUuidType_BondManagementFeature = 0x2AA5, ///< Bond Management Feature
BtdrvGattCharacteristicUuidType_CentralAddressResolution = 0x2AA6, ///< Central Address Resolution
BtdrvGattCharacteristicUuidType_CgmMeasurement = 0x2AA7, ///< CGM Measurement
BtdrvGattCharacteristicUuidType_CgmFeature = 0x2AA8, ///< CGM Feature
BtdrvGattCharacteristicUuidType_CgmStatus = 0x2AA9, ///< CGM Status
BtdrvGattCharacteristicUuidType_CgmSessionStartTime = 0x2AAA, ///< CGM Session Start Time
BtdrvGattCharacteristicUuidType_CgmSessionRunTime = 0x2AAB, ///< CGM Session Run Time
BtdrvGattCharacteristicUuidType_CgmSpecificOpsControlPoint = 0x2AAC, ///< CGM Specific Ops Control Point
BtdrvGattCharacteristicUuidType_IndoorPositioningConfiguration = 0x2AAD, ///< Indoor Positioning Configuration
BtdrvGattCharacteristicUuidType_Latitude = 0x2AAE, ///< Latitude
BtdrvGattCharacteristicUuidType_Longitude = 0x2AAF, ///< Longitude
BtdrvGattCharacteristicUuidType_LocalNorthCoordinate = 0x2AB0, ///< Local North Coordinate
BtdrvGattCharacteristicUuidType_LocalEastCoordinate = 0x2AB1, ///< Local East Coordinate
BtdrvGattCharacteristicUuidType_FloorNumber = 0x2AB2, ///< Floor Number
BtdrvGattCharacteristicUuidType_Altitude = 0x2AB3, ///< Altitude
BtdrvGattCharacteristicUuidType_Uncertainty = 0x2AB4, ///< Uncertainty
BtdrvGattCharacteristicUuidType_LocationName = 0x2AB5, ///< Location Name
BtdrvGattCharacteristicUuidType_Uri = 0x2AB6, ///< URI
BtdrvGattCharacteristicUuidType_HttpHeaders = 0x2AB7, ///< HTTP Headers
BtdrvGattCharacteristicUuidType_HttpStatusCode = 0x2AB8, ///< HTTP Status Code
BtdrvGattCharacteristicUuidType_HttpEntityBody = 0x2AB9, ///< HTTP Entity Body
BtdrvGattCharacteristicUuidType_HttpControlPoint = 0x2ABA, ///< HTTP Control Point
BtdrvGattCharacteristicUuidType_HttpsSecurity = 0x2ABB, ///< HTTPS Security
BtdrvGattCharacteristicUuidType_TdsControlPoint = 0x2ABC, ///< TDS Control Point
BtdrvGattCharacteristicUuidType_OtsFeature = 0x2ABD, ///< OTS Feature
BtdrvGattCharacteristicUuidType_ObjectName = 0x2ABE, ///< Object Name
BtdrvGattCharacteristicUuidType_ObjectType = 0x2ABF, ///< Object Type
BtdrvGattCharacteristicUuidType_ObjectSize = 0x2AC0, ///< Object Size
BtdrvGattCharacteristicUuidType_ObjectFirstCreated = 0x2AC1, ///< Object First-Created
BtdrvGattCharacteristicUuidType_ObjectLastModified = 0x2AC2, ///< Object Last-Modified
BtdrvGattCharacteristicUuidType_ObjectId = 0x2AC3, ///< Object ID
BtdrvGattCharacteristicUuidType_ObjectProperties = 0x2AC4, ///< Object Properties
BtdrvGattCharacteristicUuidType_ObjectActionControlPoint = 0x2AC5, ///< Object Action Control Point
BtdrvGattCharacteristicUuidType_ObjectListControlPoint = 0x2AC6, ///< Object List Control Point
BtdrvGattCharacteristicUuidType_ObjectListFilter = 0x2AC7, ///< Object List Filter
BtdrvGattCharacteristicUuidType_ObjectChanged = 0x2AC8, ///< Object Changed
BtdrvGattCharacteristicUuidType_ResolvablePrivateAddressOnly = 0x2AC9, ///< Resolvable Private Address Only
BtdrvGattCharacteristicUuidType_FitnessMachineFeature = 0x2ACC, ///< Fitness Machine Feature
BtdrvGattCharacteristicUuidType_TreadmillData = 0x2ACD, ///< Treadmill Data
BtdrvGattCharacteristicUuidType_CrossTrainerData = 0x2ACE, ///< Cross Trainer Data
BtdrvGattCharacteristicUuidType_StepClimberData = 0x2ACF, ///< Step Climber Data
BtdrvGattCharacteristicUuidType_StairClimberData = 0x2AD0, ///< Stair Climber Data
BtdrvGattCharacteristicUuidType_RowerData = 0x2AD1, ///< Rower Data
BtdrvGattCharacteristicUuidType_IndoorBikeData = 0x2AD2, ///< Indoor Bike Data
BtdrvGattCharacteristicUuidType_TrainingStatus = 0x2AD3, ///< Training Status
BtdrvGattCharacteristicUuidType_SupportedSpeedRange = 0x2AD4, ///< Supported Speed Range
BtdrvGattCharacteristicUuidType_SupportedInclinationRange = 0x2AD5, ///< Supported Inclination Range
BtdrvGattCharacteristicUuidType_SupportedResistanceLevelRange = 0x2AD6, ///< Supported Resistance Level Range
BtdrvGattCharacteristicUuidType_SupportedHeartRateRange = 0x2AD7, ///< Supported Heart Rate Range
BtdrvGattCharacteristicUuidType_SupportedPowerRange = 0x2AD8, ///< Supported Power Range
BtdrvGattCharacteristicUuidType_FitnessMachineControlPoint = 0x2AD9, ///< Fitness Machine Control Point
BtdrvGattCharacteristicUuidType_FitnessMachineStatus = 0x2ADA, ///< Fitness Machine Status
BtdrvGattCharacteristicUuidType_MeshProvisioningDataIn = 0x2ADB, ///< Mesh Provisioning Data In
BtdrvGattCharacteristicUuidType_MeshProvisioningDataOut = 0x2ADC, ///< Mesh Provisioning Data Out
BtdrvGattCharacteristicUuidType_MeshProxyDataIn = 0x2ADD, ///< Mesh Proxy Data In
BtdrvGattCharacteristicUuidType_MeshProxyDataOut = 0x2ADE, ///< Mesh Proxy Data Out
BtdrvGattCharacteristicUuidType_AverageCurrent = 0x2AE0, ///< Average Current
BtdrvGattCharacteristicUuidType_AverageVoltage = 0x2AE1, ///< Average Voltage
BtdrvGattCharacteristicUuidType_Boolean = 0x2AE2, ///< Boolean
BtdrvGattCharacteristicUuidType_ChromaticDistanceFromPlanckian = 0x2AE3, ///< Chromatic Distance from Planckian
BtdrvGattCharacteristicUuidType_ChromaticityCoordinates = 0x2AE4, ///< Chromaticity Coordinates
BtdrvGattCharacteristicUuidType_ChromaticityInCctAndDuvValues = 0x2AE5, ///< Chromaticity in CCT and Duv Values
BtdrvGattCharacteristicUuidType_ChromaticityTolerance = 0x2AE6, ///< Chromaticity Tolerance
BtdrvGattCharacteristicUuidType_CieColorRenderingIndex = 0x2AE7, ///< CIE 13.3-1995 Color Rendering Index
BtdrvGattCharacteristicUuidType_Coefficient = 0x2AE8, ///< Coefficient
BtdrvGattCharacteristicUuidType_CorrelatedColorTemperature = 0x2AE9, ///< Correlated Color Temperature
BtdrvGattCharacteristicUuidType_Count16 = 0x2AEA, ///< Count 16
BtdrvGattCharacteristicUuidType_Count24 = 0x2AEB, ///< Count 24
BtdrvGattCharacteristicUuidType_CountryCode = 0x2AEC, ///< Country Code
BtdrvGattCharacteristicUuidType_DateUtc = 0x2AED, ///< Date UTC
BtdrvGattCharacteristicUuidType_ElectricCurrent = 0x2AEE, ///< Electric Current
BtdrvGattCharacteristicUuidType_ElectricCurrentRange = 0x2AEF, ///< Electric Current Range
BtdrvGattCharacteristicUuidType_ElectricCurrentSpecification = 0x2AF0, ///< Electric Current Specification
BtdrvGattCharacteristicUuidType_ElectricCurrentStatistics = 0x2AF1, ///< Electric Current Statistics
BtdrvGattCharacteristicUuidType_Energy = 0x2AF2, ///< Energy
BtdrvGattCharacteristicUuidType_EnergyInAPeriodOfDay = 0x2AF3, ///< Energy in a Period of Day
BtdrvGattCharacteristicUuidType_EventStatistics = 0x2AF4, ///< Event Statistics
BtdrvGattCharacteristicUuidType_FixedString16 = 0x2AF5, ///< Fixed String 16
BtdrvGattCharacteristicUuidType_FixedString24 = 0x2AF6, ///< Fixed String 24
BtdrvGattCharacteristicUuidType_FixedString36 = 0x2AF7, ///< Fixed String 36
BtdrvGattCharacteristicUuidType_FixedString8 = 0x2AF8, ///< Fixed String 8
BtdrvGattCharacteristicUuidType_GenericLevel = 0x2AF9, ///< Generic Level
BtdrvGattCharacteristicUuidType_GlobalTradeItemNumber = 0x2AFA, ///< Global Trade Item Number
BtdrvGattCharacteristicUuidType_Illuminance = 0x2AFB, ///< Illuminance
BtdrvGattCharacteristicUuidType_LuminousEfficacy = 0x2AFC, ///< Luminous Efficacy
BtdrvGattCharacteristicUuidType_LuminousEnergy = 0x2AFD, ///< Luminous Energy
BtdrvGattCharacteristicUuidType_LuminousExposure = 0x2AFE, ///< Luminous Exposure
BtdrvGattCharacteristicUuidType_LuminousFlux = 0x2AFF, ///< Luminous Flux
BtdrvGattCharacteristicUuidType_LuminousFluxRange = 0x2B00, ///< Luminous Flux Range
BtdrvGattCharacteristicUuidType_LuminousIntensity = 0x2B01, ///< Luminous Intensity
BtdrvGattCharacteristicUuidType_MassFlow = 0x2B02, ///< Mass Flow
BtdrvGattCharacteristicUuidType_PerceivedLightness = 0x2B03, ///< Perceived Lightness
BtdrvGattCharacteristicUuidType_Percentage8 = 0x2B04, ///< Percentage 8
BtdrvGattCharacteristicUuidType_Power = 0x2B05, ///< Power
BtdrvGattCharacteristicUuidType_PowerSpecification = 0x2B06, ///< Power Specification
BtdrvGattCharacteristicUuidType_RelativeRuntimeInACurrentRange = 0x2B07, ///< Relative Runtime in a Current Range
BtdrvGattCharacteristicUuidType_RelativeRuntimeInAGenericLevelRange = 0x2B08, ///< Relative Runtime in a Generic Level Range
BtdrvGattCharacteristicUuidType_RelativeValueInAVoltageRange = 0x2B09, ///< Relative Value in a Voltage Range
BtdrvGattCharacteristicUuidType_RelativeValueInAnIlluminanceRange = 0x2B0A, ///< Relative Value in an Illuminance Range
BtdrvGattCharacteristicUuidType_RelativeValueInAPeriodOfDay = 0x2B0B, ///< Relative Value in a Period of Day
BtdrvGattCharacteristicUuidType_RelativeValueInATemperatureRange = 0x2B0C, ///< Relative Value in a Temperature Range
BtdrvGattCharacteristicUuidType_Temperature8 = 0x2B0D, ///< Temperature 8
BtdrvGattCharacteristicUuidType_Temperature8InAPeriodOfDay = 0x2B0E, ///< Temperature 8 in a Period of Day
BtdrvGattCharacteristicUuidType_Temperature8Statistics = 0x2B0F, ///< Temperature 8 Statistics
BtdrvGattCharacteristicUuidType_TemperatureRange = 0x2B10, ///< Temperature Range
BtdrvGattCharacteristicUuidType_TemperatureStatistics = 0x2B11, ///< Temperature Statistics
BtdrvGattCharacteristicUuidType_TimeDecihour8 = 0x2B12, ///< Time Decihour 8
BtdrvGattCharacteristicUuidType_TimeExponential8 = 0x2B13, ///< Time Exponential 8
BtdrvGattCharacteristicUuidType_TimeHour24 = 0x2B14, ///< Time Hour 24
BtdrvGattCharacteristicUuidType_TimeMillisecond24 = 0x2B15, ///< Time Millisecond 24
BtdrvGattCharacteristicUuidType_TimeSecond16 = 0x2B16, ///< Time Second 16
BtdrvGattCharacteristicUuidType_TimeSecond8 = 0x2B17, ///< Time Second 8
BtdrvGattCharacteristicUuidType_Voltage = 0x2B18, ///< Voltage
BtdrvGattCharacteristicUuidType_VoltageSpecification = 0x2B19, ///< Voltage Specification
BtdrvGattCharacteristicUuidType_VoltageStatistics = 0x2B1A, ///< Voltage Statistics
BtdrvGattCharacteristicUuidType_VolumeFlow = 0x2B1B, ///< Volume Flow
BtdrvGattCharacteristicUuidType_ChromaticityCoordinate = 0x2B1C, ///< Chromaticity Coordinate
BtdrvGattCharacteristicUuidType_RcFeature = 0x2B1D, ///< RC Feature
BtdrvGattCharacteristicUuidType_RcSettings = 0x2B1E, ///< RC Settings
BtdrvGattCharacteristicUuidType_ReconnectionConfigurationControlPoint = 0x2B1F, ///< Reconnection Configuration Control Point
BtdrvGattCharacteristicUuidType_IddStatusChanged = 0x2B20, ///< IDD Status Changed
BtdrvGattCharacteristicUuidType_IddStatus = 0x2B21, ///< IDD Status
BtdrvGattCharacteristicUuidType_IddAnnunciationStatus = 0x2B22, ///< IDD Annunciation Status
BtdrvGattCharacteristicUuidType_IddFeatures = 0x2B23, ///< IDD Features
BtdrvGattCharacteristicUuidType_IddStatusReaderControlPoint = 0x2B24, ///< IDD Status Reader Control Point
BtdrvGattCharacteristicUuidType_IddCommandControlPoint = 0x2B25, ///< IDD Command Control Point
BtdrvGattCharacteristicUuidType_IddCommandData = 0x2B26, ///< IDD Command Data
BtdrvGattCharacteristicUuidType_IddRecordAccessControlPoint = 0x2B27, ///< IDD Record Access Control Point
BtdrvGattCharacteristicUuidType_IddHistoryData = 0x2B28, ///< IDD History Data
BtdrvGattCharacteristicUuidType_ClientSupportedFeatures = 0x2B29, ///< Client Supported Features
BtdrvGattCharacteristicUuidType_DatabaseHash = 0x2B2A, ///< Database Hash
BtdrvGattCharacteristicUuidType_BssControlPoint = 0x2B2B, ///< BSS Control Point
BtdrvGattCharacteristicUuidType_BssResponse = 0x2B2C, ///< BSS Response
BtdrvGattCharacteristicUuidType_EmergencyId = 0x2B2D, ///< Emergency ID
BtdrvGattCharacteristicUuidType_EmergencyText = 0x2B2E, ///< Emergency Text
BtdrvGattCharacteristicUuidType_AcsStatus = 0x2B2F, ///< ACS Status
BtdrvGattCharacteristicUuidType_AcsDataIn = 0x2B30, ///< ACS Data In
BtdrvGattCharacteristicUuidType_AcsDataOutNotify = 0x2B31, ///< ACS Data Out Notify
BtdrvGattCharacteristicUuidType_AcsDataOutIndicate = 0x2B32, ///< ACS Data Out Indicate
BtdrvGattCharacteristicUuidType_AcsControlPoint = 0x2B33, ///< ACS Control Point
BtdrvGattCharacteristicUuidType_EnhancedBloodPressureMeasurement = 0x2B34, ///< Enhanced Blood Pressure Measurement
BtdrvGattCharacteristicUuidType_EnhancedIntermediateCuffPressure = 0x2B35, ///< Enhanced Intermediate Cuff Pressure
BtdrvGattCharacteristicUuidType_BloodPressureRecord = 0x2B36, ///< Blood Pressure Record
BtdrvGattCharacteristicUuidType_RegisteredUser = 0x2B37, ///< Registered User
BtdrvGattCharacteristicUuidType_BrEdrHandoverData = 0x2B38, ///< BR-EDR Handover Data
BtdrvGattCharacteristicUuidType_BluetoothSigData = 0x2B39, ///< Bluetooth SIG Data
BtdrvGattCharacteristicUuidType_ServerSupportedFeatures = 0x2B3A, ///< Server Supported Features
BtdrvGattCharacteristicUuidType_PhysicalActivityMonitorFeatures = 0x2B3B, ///< Physical Activity Monitor Features
BtdrvGattCharacteristicUuidType_GeneralActivityInstantaneousData = 0x2B3C, ///< General Activity Instantaneous Data
BtdrvGattCharacteristicUuidType_GeneralActivitySummaryData = 0x2B3D, ///< General Activity Summary Data
BtdrvGattCharacteristicUuidType_CardiorespiratoryActivityInstantaneousData = 0x2B3E, ///< CardioRespiratory Activity Instantaneous Data
BtdrvGattCharacteristicUuidType_CardiorespiratoryActivitySummaryData = 0x2B3F, ///< CardioRespiratory Activity Summary Data
BtdrvGattCharacteristicUuidType_StepCounterActivitySummaryData = 0x2B40, ///< Step Counter Activity Summary Data
BtdrvGattCharacteristicUuidType_SleepActivityInstantaneousData = 0x2B41, ///< Sleep Activity Instantaneous Data
BtdrvGattCharacteristicUuidType_SleepActivitySummaryData = 0x2B42, ///< Sleep Activity Summary Data
BtdrvGattCharacteristicUuidType_PhysicalActivityMonitorControlPoint = 0x2B43, ///< Physical Activity Monitor Control Point
BtdrvGattCharacteristicUuidType_ActivityCurrentSession = 0x2B44, ///< Activity Current Session
BtdrvGattCharacteristicUuidType_PhysicalActivitySessionDescriptor = 0x2B45, ///< Physical Activity Session Descriptor
BtdrvGattCharacteristicUuidType_PreferredUnits = 0x2B46, ///< Preferred Units
BtdrvGattCharacteristicUuidType_HighResolutionHeight = 0x2B47, ///< High Resolution Height
BtdrvGattCharacteristicUuidType_MiddleName = 0x2B48, ///< Middle Name
BtdrvGattCharacteristicUuidType_StrideLength = 0x2B49, ///< Stride Length
BtdrvGattCharacteristicUuidType_Handedness = 0x2B4A, ///< Handedness
BtdrvGattCharacteristicUuidType_DeviceWearingPosition = 0x2B4B, ///< Device Wearing Position
BtdrvGattCharacteristicUuidType_FourZoneHeartRateLimits = 0x2B4C, ///< Four Zone Heart Rate Limits
BtdrvGattCharacteristicUuidType_HighIntensityExerciseThreshold = 0x2B4D, ///< High Intensity Exercise Threshold
BtdrvGattCharacteristicUuidType_ActivityGoal = 0x2B4E, ///< Activity Goal
BtdrvGattCharacteristicUuidType_SedentaryIntervalNotification = 0x2B4F, ///< Sedentary Interval Notification
BtdrvGattCharacteristicUuidType_CaloricIntake = 0x2B50, ///< Caloric Intake
BtdrvGattCharacteristicUuidType_TmapRole = 0x2B51, ///< TMAP Role
BtdrvGattCharacteristicUuidType_AudioInputState = 0x2B77, ///< Audio Input State
BtdrvGattCharacteristicUuidType_GainSettingsAttribute = 0x2B78, ///< Gain Settings Attribute
BtdrvGattCharacteristicUuidType_AudioInputType = 0x2B79, ///< Audio Input Type
BtdrvGattCharacteristicUuidType_AudioInputStatus = 0x2B7A, ///< Audio Input Status
BtdrvGattCharacteristicUuidType_AudioInputControlPoint = 0x2B7B, ///< Audio Input Control Point
BtdrvGattCharacteristicUuidType_AudioInputDescription = 0x2B7C, ///< Audio Input Description
BtdrvGattCharacteristicUuidType_VolumeState = 0x2B7D, ///< Volume State
BtdrvGattCharacteristicUuidType_VolumeControlPoint = 0x2B7E, ///< Volume Control Point
BtdrvGattCharacteristicUuidType_VolumeFlags = 0x2B7F, ///< Volume Flags
BtdrvGattCharacteristicUuidType_VolumeOffsetState = 0x2B80, ///< Volume Offset State
BtdrvGattCharacteristicUuidType_AudioLocation = 0x2B81, ///< Audio Location
BtdrvGattCharacteristicUuidType_VolumeOffsetControlPoint = 0x2B82, ///< Volume Offset Control Point
BtdrvGattCharacteristicUuidType_AudioOutputDescription = 0x2B83, ///< Audio Output Description
BtdrvGattCharacteristicUuidType_SetIdentityResolvingKey = 0x2B84, ///< Set Identity Resolving Key
BtdrvGattCharacteristicUuidType_CoordinatedSetSize = 0x2B85, ///< Coordinated Set Size
BtdrvGattCharacteristicUuidType_SetMemberLock = 0x2B86, ///< Set Member Lock
BtdrvGattCharacteristicUuidType_SetMemberRank = 0x2B87, ///< Set Member Rank
BtdrvGattCharacteristicUuidType_EncryptedDataKeyMaterial = 0x2B88, ///< Encrypted Data Key Material
BtdrvGattCharacteristicUuidType_ApparentEnergy32 = 0x2B89, ///< Apparent Energy 32
BtdrvGattCharacteristicUuidType_ApparentPower = 0x2B8A, ///< Apparent Power
BtdrvGattCharacteristicUuidType_LiveHealthObservations = 0x2B8B, ///< Live Health Observations
BtdrvGattCharacteristicUuidType_CoTextsubscript2Concentration = 0x2B8C, ///< CO\textsubscript{2} Concentration
BtdrvGattCharacteristicUuidType_CosineOfTheAngle = 0x2B8D, ///< Cosine of the Angle
BtdrvGattCharacteristicUuidType_DeviceTimeFeature = 0x2B8E, ///< Device Time Feature
BtdrvGattCharacteristicUuidType_DeviceTimeParameters = 0x2B8F, ///< Device Time Parameters
BtdrvGattCharacteristicUuidType_DeviceTime = 0x2B90, ///< Device Time
BtdrvGattCharacteristicUuidType_DeviceTimeControlPoint = 0x2B91, ///< Device Time Control Point
BtdrvGattCharacteristicUuidType_TimeChangeLogData = 0x2B92, ///< Time Change Log Data
BtdrvGattCharacteristicUuidType_MediaPlayerName = 0x2B93, ///< Media Player Name
BtdrvGattCharacteristicUuidType_MediaPlayerIconObjectId = 0x2B94, ///< Media Player Icon Object ID
BtdrvGattCharacteristicUuidType_MediaPlayerIconUrl = 0x2B95, ///< Media Player Icon URL
BtdrvGattCharacteristicUuidType_TrackChanged = 0x2B96, ///< Track Changed
BtdrvGattCharacteristicUuidType_TrackTitle = 0x2B97, ///< Track Title
BtdrvGattCharacteristicUuidType_TrackDuration = 0x2B98, ///< Track Duration
BtdrvGattCharacteristicUuidType_TrackPosition = 0x2B99, ///< Track Position
BtdrvGattCharacteristicUuidType_PlaybackSpeed = 0x2B9A, ///< Playback Speed
BtdrvGattCharacteristicUuidType_SeekingSpeed = 0x2B9B, ///< Seeking Speed
BtdrvGattCharacteristicUuidType_CurrentTrackSegmentsObjectId = 0x2B9C, ///< Current Track Segments Object ID
BtdrvGattCharacteristicUuidType_CurrentTrackObjectId = 0x2B9D, ///< Current Track Object ID
BtdrvGattCharacteristicUuidType_NextTrackObjectId = 0x2B9E, ///< Next Track Object ID
BtdrvGattCharacteristicUuidType_ParentGroupObjectId = 0x2B9F, ///< Parent Group Object ID
BtdrvGattCharacteristicUuidType_CurrentGroupObjectId = 0x2BA0, ///< Current Group Object ID
BtdrvGattCharacteristicUuidType_PlayingOrder = 0x2BA1, ///< Playing Order
BtdrvGattCharacteristicUuidType_PlayingOrdersSupported = 0x2BA2, ///< Playing Orders Supported
BtdrvGattCharacteristicUuidType_MediaState = 0x2BA3, ///< Media State
BtdrvGattCharacteristicUuidType_MediaControlPoint = 0x2BA4, ///< Media Control Point
BtdrvGattCharacteristicUuidType_MediaControlPointOpcodesSupported = 0x2BA5, ///< Media Control Point Opcodes Supported
BtdrvGattCharacteristicUuidType_SearchResultsObjectId = 0x2BA6, ///< Search Results Object ID
BtdrvGattCharacteristicUuidType_SearchControlPoint = 0x2BA7, ///< Search Control Point
BtdrvGattCharacteristicUuidType_Energy32 = 0x2BA8, ///< Energy 32
BtdrvGattCharacteristicUuidType_MediaPlayerIconObjectType = 0x2BA9, ///< Media Player Icon Object Type
BtdrvGattCharacteristicUuidType_TrackSegmentsObjectType = 0x2BAA, ///< Track Segments Object Type
BtdrvGattCharacteristicUuidType_TrackObjectType = 0x2BAB, ///< Track Object Type
BtdrvGattCharacteristicUuidType_GroupObjectType = 0x2BAC, ///< Group Object Type
BtdrvGattCharacteristicUuidType_ConstantToneExtensionEnable = 0x2BAD, ///< Constant Tone Extension Enable
BtdrvGattCharacteristicUuidType_AdvertisingConstantToneExtensionMinimumLength = 0x2BAE, ///< Advertising Constant Tone Extension Minimum Length
BtdrvGattCharacteristicUuidType_AdvertisingConstantToneExtensionMinimumTransmitCount = 0x2BAF, ///< Advertising Constant Tone Extension Minimum Transmit Count
BtdrvGattCharacteristicUuidType_AdvertisingConstantToneExtensionTransmitDuration = 0x2BB0, ///< Advertising Constant Tone Extension Transmit Duration
BtdrvGattCharacteristicUuidType_AdvertisingConstantToneExtensionInterval = 0x2BB1, ///< Advertising Constant Tone Extension Interval
BtdrvGattCharacteristicUuidType_AdvertisingConstantToneExtensionPhy = 0x2BB2, ///< Advertising Constant Tone Extension PHY
BtdrvGattCharacteristicUuidType_BearerProviderName = 0x2BB3, ///< Bearer Provider Name
BtdrvGattCharacteristicUuidType_BearerUci = 0x2BB4, ///< Bearer UCI
BtdrvGattCharacteristicUuidType_BearerTechnology = 0x2BB5, ///< Bearer Technology
BtdrvGattCharacteristicUuidType_BearerUriSchemesSupportedList = 0x2BB6, ///< Bearer URI Schemes Supported List
BtdrvGattCharacteristicUuidType_BearerSignalStrength = 0x2BB7, ///< Bearer Signal Strength
BtdrvGattCharacteristicUuidType_BearerSignalStrengthReportingInterval = 0x2BB8, ///< Bearer Signal Strength Reporting Interval
BtdrvGattCharacteristicUuidType_BearerListCurrentCalls = 0x2BB9, ///< Bearer List Current Calls
BtdrvGattCharacteristicUuidType_ContentControlId = 0x2BBA, ///< Content Control ID
BtdrvGattCharacteristicUuidType_StatusFlags = 0x2BBB, ///< Status Flags
BtdrvGattCharacteristicUuidType_IncomingCallTargetBearerUri = 0x2BBC, ///< Incoming Call Target Bearer URI
BtdrvGattCharacteristicUuidType_CallState = 0x2BBD, ///< Call State
BtdrvGattCharacteristicUuidType_CallControlPoint = 0x2BBE, ///< Call Control Point
BtdrvGattCharacteristicUuidType_CallControlPointOptionalOpcodes = 0x2BBF, ///< Call Control Point Optional Opcodes
BtdrvGattCharacteristicUuidType_TerminationReason = 0x2BC0, ///< Termination Reason
BtdrvGattCharacteristicUuidType_IncomingCall = 0x2BC1, ///< Incoming Call
BtdrvGattCharacteristicUuidType_CallFriendlyName = 0x2BC2, ///< Call Friendly Name
BtdrvGattCharacteristicUuidType_Mute = 0x2BC3, ///< Mute
BtdrvGattCharacteristicUuidType_SinkAse = 0x2BC4, ///< Sink ASE
BtdrvGattCharacteristicUuidType_SourceAse = 0x2BC5, ///< Source ASE
BtdrvGattCharacteristicUuidType_AseControlPoint = 0x2BC6, ///< ASE Control Point
BtdrvGattCharacteristicUuidType_BroadcastAudioScanControlPoint = 0x2BC7, ///< Broadcast Audio Scan Control Point
BtdrvGattCharacteristicUuidType_BroadcastReceiveState = 0x2BC8, ///< Broadcast Receive State
BtdrvGattCharacteristicUuidType_SinkPac = 0x2BC9, ///< Sink PAC
BtdrvGattCharacteristicUuidType_SinkAudioLocations = 0x2BCA, ///< Sink Audio Locations
BtdrvGattCharacteristicUuidType_SourcePac = 0x2BCB, ///< Source PAC
BtdrvGattCharacteristicUuidType_SourceAudioLocations = 0x2BCC, ///< Source Audio Locations
BtdrvGattCharacteristicUuidType_AvailableAudioContexts = 0x2BCD, ///< Available Audio Contexts
BtdrvGattCharacteristicUuidType_SupportedAudioContexts = 0x2BCE, ///< Supported Audio Contexts
BtdrvGattCharacteristicUuidType_AmmoniaConcentration = 0x2BCF, ///< Ammonia Concentration
BtdrvGattCharacteristicUuidType_CarbonMonoxideConcentration = 0x2BD0, ///< Carbon Monoxide Concentration
BtdrvGattCharacteristicUuidType_MethaneConcentration = 0x2BD1, ///< Methane Concentration
BtdrvGattCharacteristicUuidType_NitrogenDioxideConcentration = 0x2BD2, ///< Nitrogen Dioxide Concentration
BtdrvGattCharacteristicUuidType_NonMethaneVolatileOrganicCompoundsConcentration = 0x2BD3, ///< Non-Methane Volatile Organic Compounds Concentration
BtdrvGattCharacteristicUuidType_OzoneConcentration = 0x2BD4, ///< Ozone Concentration
BtdrvGattCharacteristicUuidType_ParticulateMatterPm1Concentration = 0x2BD5, ///< Particulate Matter - PM1 Concentration
BtdrvGattCharacteristicUuidType_ParticulateMatterPm25Concentration = 0x2BD6, ///< Particulate Matter - PM2.5 Concentration
BtdrvGattCharacteristicUuidType_ParticulateMatterPm10Concentration = 0x2BD7, ///< Particulate Matter - PM10 Concentration
BtdrvGattCharacteristicUuidType_SulfurDioxideConcentration = 0x2BD8, ///< Sulfur Dioxide Concentration
BtdrvGattCharacteristicUuidType_SulfurHexafluorideConcentration = 0x2BD9, ///< Sulfur Hexafluoride Concentration
BtdrvGattCharacteristicUuidType_HearingAidFeatures = 0x2BDA, ///< Hearing Aid Features
BtdrvGattCharacteristicUuidType_HearingAidPresetControlPoint = 0x2BDB, ///< Hearing Aid Preset Control Point
BtdrvGattCharacteristicUuidType_ActivePresetIndex = 0x2BDC, ///< Active Preset Index
BtdrvGattCharacteristicUuidType_StoredHealthObservations = 0x2BDD, ///< Stored Health Observations
BtdrvGattCharacteristicUuidType_FixedString64 = 0x2BDE, ///< Fixed String 64
BtdrvGattCharacteristicUuidType_HighTemperature = 0x2BDF, ///< High Temperature
BtdrvGattCharacteristicUuidType_HighVoltage = 0x2BE0, ///< High Voltage
BtdrvGattCharacteristicUuidType_LightDistribution = 0x2BE1, ///< Light Distribution
BtdrvGattCharacteristicUuidType_LightOutput = 0x2BE2, ///< Light Output
BtdrvGattCharacteristicUuidType_LightSourceType = 0x2BE3, ///< Light Source Type
BtdrvGattCharacteristicUuidType_Noise = 0x2BE4, ///< Noise
BtdrvGattCharacteristicUuidType_RelativeRuntimeInACorrelatedColorTemperatureRange = 0x2BE5, ///< Relative Runtime in a Correlated Color Temperature Range
BtdrvGattCharacteristicUuidType_TimeSecond32 = 0x2BE6, ///< Time Second 32
BtdrvGattCharacteristicUuidType_VocConcentration = 0x2BE7, ///< VOC Concentration
BtdrvGattCharacteristicUuidType_VoltageFrequency = 0x2BE8, ///< Voltage Frequency
BtdrvGattCharacteristicUuidType_BatteryCriticalStatus = 0x2BE9, ///< Battery Critical Status
BtdrvGattCharacteristicUuidType_BatteryHealthStatus = 0x2BEA, ///< Battery Health Status
BtdrvGattCharacteristicUuidType_BatteryHealthInformation = 0x2BEB, ///< Battery Health Information
BtdrvGattCharacteristicUuidType_BatteryInformation = 0x2BEC, ///< Battery Information
BtdrvGattCharacteristicUuidType_BatteryLevelStatus = 0x2BED, ///< Battery Level Status
BtdrvGattCharacteristicUuidType_BatteryTimeStatus = 0x2BEE, ///< Battery Time Status
BtdrvGattCharacteristicUuidType_EstimatedServiceDate = 0x2BEF, ///< Estimated Service Date
BtdrvGattCharacteristicUuidType_BatteryEnergyStatus = 0x2BF0, ///< Battery Energy Status
BtdrvGattCharacteristicUuidType_ObservationScheduleChanged = 0x2BF1, ///< Observation Schedule Changed
BtdrvGattCharacteristicUuidType_CurrentElapsedTime = 0x2BF2, ///< Current Elapsed Time
BtdrvGattCharacteristicUuidType_HealthSensorFeatures = 0x2BF3, ///< Health Sensor Features
BtdrvGattCharacteristicUuidType_GhsControlPoint = 0x2BF4, ///< GHS Control Point
BtdrvGattCharacteristicUuidType_LeGattSecurityLevels = 0x2BF5, ///< LE GATT Security Levels
BtdrvGattCharacteristicUuidType_EslAddress = 0x2BF6, ///< ESL Address
BtdrvGattCharacteristicUuidType_ApSyncKeyMaterial = 0x2BF7, ///< AP Sync Key Material
BtdrvGattCharacteristicUuidType_EslResponseKeyMaterial = 0x2BF8, ///< ESL Response Key Material
BtdrvGattCharacteristicUuidType_EslCurrentAbsoluteTime = 0x2BF9, ///< ESL Current Absolute Time
BtdrvGattCharacteristicUuidType_EslDisplayInformation = 0x2BFA, ///< ESL Display Information
BtdrvGattCharacteristicUuidType_EslImageInformation = 0x2BFB, ///< ESL Image Information
BtdrvGattCharacteristicUuidType_EslSensorInformation = 0x2BFC, ///< ESL Sensor Information
BtdrvGattCharacteristicUuidType_EslLedInformation = 0x2BFD, ///< ESL LED Information
BtdrvGattCharacteristicUuidType_EslControlPoint = 0x2BFE, ///< ESL Control Point
BtdrvGattCharacteristicUuidType_UdiForMedicalDevices = 0x2BFF, ///< UDI for Medical Devices
} BtdrvGattCharacteristicUuidType;
/// GattDescriptorUuidType
typedef enum {
BtdrvGattDescriptorUuidType_CharacteristicExtendedProperties = 0x2900, ///< Characteristic Extended Properties
BtdrvGattDescriptorUuidType_CharacteristicUserDescription = 0x2901, ///< Characteristic User Description
BtdrvGattDescriptorUuidType_ClientCharacteristicConfiguration = 0x2902, ///< Client Characteristic Configuration
BtdrvGattDescriptorUuidType_ServerCharacteristicConfiguration = 0x2903, ///< Server Characteristic Configuration
BtdrvGattDescriptorUuidType_CharacteristicPresentationFormat = 0x2904, ///< Characteristic Presentation Format
BtdrvGattDescriptorUuidType_CharacteristicAggregateFormat = 0x2905, ///< Characteristic Aggregate Format
BtdrvGattDescriptorUuidType_ValidRange = 0x2906, ///< Valid Range
BtdrvGattDescriptorUuidType_ExternalReportReference = 0x2907, ///< External Report Reference
BtdrvGattDescriptorUuidType_ReportReference = 0x2908, ///< Report Reference
BtdrvGattDescriptorUuidType_NumberOfDigitals = 0x2909, ///< Number of Digitals
BtdrvGattDescriptorUuidType_ValueTriggerSetting = 0x290A, ///< Value Trigger Setting
BtdrvGattDescriptorUuidType_EnvironmentalSensingConfiguration = 0x290B, ///< Environmental Sensing Configuration
BtdrvGattDescriptorUuidType_EnvironmentalSensingMeasurement = 0x290C, ///< Environmental Sensing Measurement
BtdrvGattDescriptorUuidType_EnvironmentalSensingTriggerSetting = 0x290D, ///< Environmental Sensing Trigger Setting
BtdrvGattDescriptorUuidType_TimeTriggerSetting = 0x290E, ///< Time Trigger Setting
BtdrvGattDescriptorUuidType_CompleteBrEdrTransportBlockData = 0x290F, ///< Complete BR-EDR Transport Block Data
BtdrvGattDescriptorUuidType_ObservationSchedule = 0x2910, ///< Observation Schedule
BtdrvGattDescriptorUuidType_ValidRangeAndAccuracy = 0x2911, ///< Valid Range and Accuracy
} BtdrvGattDescriptorUuidType;

View File

@ -6,6 +6,7 @@
*/
#pragma once
#include "../types.h"
#include "btdrv_ids.h"
/// BluetoothPropertyType [1.0.0-11.0.1]
typedef enum {
@ -124,22 +125,105 @@ typedef enum {
/// BleEventType
typedef enum {
BtdrvBleEventType_Unknown0 = 0, ///< Unknown.
BtdrvBleEventType_Unknown1 = 1, ///< Unknown.
BtdrvBleEventType_Unknown2 = 2, ///< Unknown.
BtdrvBleEventType_Unknown3 = 3, ///< Unknown.
BtdrvBleEventType_Unknown4 = 4, ///< Unknown.
BtdrvBleEventType_Unknown5 = 5, ///< Unknown.
BtdrvBleEventType_Unknown6 = 6, ///< Unknown.
BtdrvBleEventType_Unknown7 = 7, ///< Unknown.
BtdrvBleEventType_Unknown8 = 8, ///< Unknown.
BtdrvBleEventType_Unknown9 = 9, ///< Unknown.
BtdrvBleEventType_Unknown10 = 10, ///< Unknown.
BtdrvBleEventType_Unknown11 = 11, ///< Unknown.
BtdrvBleEventType_Unknown12 = 12, ///< Unknown.
BtdrvBleEventType_Unknown13 = 13, ///< Unknown.
BtdrvBleEventType_ClientRegistration = 0, ///< GATT client registration.
BtdrvBleEventType_ServerRegistration = 1, ///< GATT server registration.
BtdrvBleEventType_ConnectionUpdate = 2, ///< Connection update.
BtdrvBleEventType_PreferredConnectionParameters = 3, ///< Preferred connection parameters.
BtdrvBleEventType_ClientConnection = 4, ///< GATT client connection.
BtdrvBleEventType_ServerConnection = 5, ///< GATT server connection.
BtdrvBleEventType_ScanResult = 6, ///< Scan result.
BtdrvBleEventType_ScanFilter = 7, ///< Scan filter status.
BtdrvBleEventType_ClientNotify = 8, ///< GATT client notify.
BtdrvBleEventType_ClientCacheSave = 9, ///< GATT client cache save.
BtdrvBleEventType_ClientCacheLoad = 10, ///< GATT client cache load.
BtdrvBleEventType_ClientConfigureMtu = 11, ///< GATT client configure MTU.
BtdrvBleEventType_ServerAddAttribute = 12, ///< GATT server add attribute.
BtdrvBleEventType_ServerAttributeOperation = 13, ///< GATT server attribute operation.
} BtdrvBleEventType;
/// GattAttributeType
typedef enum {
BtdrvGattAttributeType_IncludedService = 0, ///< Included service
BtdrvGattAttributeType_Characteristic = 1, ///< Characteristic
BtdrvGattAttributeType_Descriptor = 2, ///< Descriptor
BtdrvGattAttributeType_Service = 3, ///< Service
} BtdrvGattAttributeType;
/// GattAttributePermission
typedef enum {
BtdrvGattAttributePermission_Read = BIT(0),
BtdrvGattAttributePermission_ReadEncrypted = BIT(1),
BtdrvGattAttributePermission_ReadEncryptedMitm = BIT(2),
BtdrvGattAttributePermission_Write = BIT(4),
BtdrvGattAttributePermission_WriteEncrypted = BIT(5),
BtdrvGattAttributePermission_WriteEncryptedMitm = BIT(6),
BtdrvGattAttributePermission_WriteSigned = BIT(7),
BtdrvGattAttributePermission_WriteSignedMitm = BIT(8),
BtdrvGattAttributePermission_ReadAllowed = BtdrvGattAttributePermission_Read | BtdrvGattAttributePermission_ReadEncrypted | BtdrvGattAttributePermission_ReadEncryptedMitm,
BtdrvGattAttributePermission_ReadAuthRequired = BtdrvGattAttributePermission_ReadEncrypted,
BtdrvGattAttributePermission_ReadMitmRequired = BtdrvGattAttributePermission_ReadEncryptedMitm,
BtdrvGattAttributePermission_ReadEncryptedRequired = BtdrvGattAttributePermission_ReadEncrypted | BtdrvGattAttributePermission_ReadEncryptedMitm,
BtdrvGattAttributePermission_WriteAllowed = BtdrvGattAttributePermission_Write | BtdrvGattAttributePermission_WriteEncrypted | BtdrvGattAttributePermission_WriteEncryptedMitm | BtdrvGattAttributePermission_WriteSigned | BtdrvGattAttributePermission_WriteSignedMitm,
BtdrvGattAttributePermission_WriteAuthRequired = BtdrvGattAttributePermission_WriteEncrypted | BtdrvGattAttributePermission_WriteSigned,
BtdrvGattAttributePermission_WriteMitmRequired = BtdrvGattAttributePermission_WriteEncryptedMitm | BtdrvGattAttributePermission_WriteSignedMitm,
BtdrvGattAttributePermission_WriteEncryptedRequired = BtdrvGattAttributePermission_WriteEncrypted | BtdrvGattAttributePermission_WriteEncryptedMitm,
BtdrvGattAttributePermission_WriteSignedRequired = BtdrvGattAttributePermission_WriteSigned | BtdrvGattAttributePermission_WriteSignedMitm,
} BtdrvGattAttributePermission;
/// GattCharacteristicProperty
typedef enum {
BtdrvGattCharacteristicProperty_Broadcast = BIT(0),
BtdrvGattCharacteristicProperty_Read = BIT(1),
BtdrvGattCharacteristicProperty_WriteNoResponse = BIT(2),
BtdrvGattCharacteristicProperty_Write = BIT(3),
BtdrvGattCharacteristicProperty_Notify = BIT(4),
BtdrvGattCharacteristicProperty_Indicate = BIT(5),
BtdrvGattCharacteristicProperty_Authentication = BIT(6),
BtdrvGattCharacteristicProperty_ExtendedProperties = BIT(7),
} BtdrvGattCharacteristicProperty;
/// GattAuthReqType
typedef enum {
BtdrvGattAuthReqType_None = 0,
BtdrvGattAuthReqType_NoMitm = 1,
BtdrvGattAuthReqType_Mitm = 2,
BtdrvGattAuthReqType_SignedNoMitm = 3,
BtdrvGattAuthReqType_SignedMitm = 4,
} BtdrvGattAuthReqType;
/// BtdrvBleAdBit
typedef enum {
BtdrvBleAdBit_DeviceName = BIT(0),
BtdrvBleAdBit_Flags = BIT(1),
BtdrvBleAdBit_Manufacturer = BIT(2),
BtdrvBleAdBit_TxPower = BIT(3),
BtdrvBleAdBit_Service32 = BIT(4),
BtdrvBleAdBit_IntRange = BIT(5),
BtdrvBleAdBit_Service = BIT(6),
BtdrvBleAdBit_ServiceSol = BIT(7),
BtdrvBleAdBit_ServiceData = BIT(8),
BtdrvBleAdBit_SignData = BIT(9),
BtdrvBleAdBit_Service128Sol = BIT(10),
BtdrvBleAdBit_Appearance = BIT(11),
BtdrvBleAdBit_PublicAddress = BIT(12),
BtdrvBleAdBit_RandomAddress = BIT(13),
BtdrvBleAdBit_Service32Sol = BIT(14),
BtdrvBleAdBit_Proprietary = BIT(15),
BtdrvBleAdBit_Service128 = BIT(16),
} BtdrvBleAdBit;
/// BtdrvBleAdFlag
typedef enum {
BtdrvBleAdFlag_None = 0,
BtdrvBleAdFlag_LimitedDiscovery = BIT(0),
BtdrvBleAdFlag_GeneralDiscovery = BIT(1),
BtdrvBleAdFlag_BrEdrNotSupported = BIT(2),
BtdrvBleAdFlag_DualModeControllerSupport = BIT(3),
BtdrvBleAdFlag_DualModeHostSupport = BIT(4),
} BtdrvBleAdFlag;
/// AudioEventType
typedef enum {
BtdrvAudioEventType_None = 0, ///< None
@ -227,74 +311,6 @@ typedef struct {
u8 unk_x0[0x88]; ///< Unknown
} BtdrvChannelMapList;
/// LeConnectionParams
typedef struct {
u8 unk_x0[0x14]; ///< Unknown
} BtdrvLeConnectionParams;
/// BleConnectionParameter
typedef struct {
u8 unk_x0[0xC]; ///< Unknown
} BtdrvBleConnectionParameter;
/// BtdrvBleAdvertisePacketDataEntry
typedef struct {
u16 unk_x0; ///< Unknown
u8 unused[0x12]; ///< Unused
} BtdrvBleAdvertisePacketDataEntry;
/// BleAdvertisePacketData
typedef struct {
u32 unk_x0; ///< Unknown
u8 unk_x4; ///< Unknown
u8 size0; ///< Size of the data at unk_x6.
u8 unk_x6[0x1F]; ///< Unknown, see size0.
u8 pad[3]; ///< Padding
u8 count; ///< Total array entries, see entries.
u8 pad2[7]; ///< Padding
BtdrvBleAdvertisePacketDataEntry entries[0x5]; ///< \ref BtdrvBleAdvertisePacketDataEntry
u8 pad3[0x10]; ///< Padding
u8 size2; ///< Size of the data at unk_xA8.
u8 unk_xA5; ///< Unknown
u8 pad4[2]; ///< Padding
u8 unk_xA8[0x1F]; ///< Unknown, see size2.
u8 unk_xC7; ///< Unknown
u8 unk_xC8; ///< Unknown
u8 pad5[3]; ///< Padding
} BtdrvBleAdvertisePacketData;
typedef struct {
u8 length;
u8 type;
u8 value[0x1d];
} BtdrvBleAdvertisementData;
/// BleAdvertiseFilter
typedef struct {
u8 unk_x0[0x3E]; ///< Unknown
} BtdrvBleAdvertiseFilter;
/// BleAdvertisePacketParameter
typedef struct {
u8 data[0x8]; ///< Unknown
} BtdrvBleAdvertisePacketParameter;
/// BleScanResult
typedef struct {
u8 unk_x0; ///< Unknown
BtdrvAddress addr; ///< \ref BtdrvAddress
u8 unk_x7[0x139]; ///< Unknown
s32 unk_x140; ///< Unknown
s32 unk_x144; ///< Unknown
} BtdrvBleScanResult;
/// BleConnectionInfo
typedef struct {
u32 connection_handle; ///< ConnectionHandle, 0xFFFFFFFF ([5.0.0-5.0.2] 0xFFFF) is invalid.
BtdrvAddress addr; ///< \ref BtdrvAddress
u8 pad[2]; ///< Padding
} BtdrvBleConnectionInfo;
/// GattAttributeUuid
typedef struct {
u32 size; ///< UUID size, must be 0x2, 0x4, or 0x10.
@ -308,6 +324,96 @@ typedef struct {
BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
} BtdrvGattId;
/// GattAttribute
typedef struct {
BtdrvGattId id; ///< \ref BtdrvGattId
u16 type; ///< \ref BtdrvGattAttributeType
u16 handle;
u16 group_end_handle;
u8 property; ///< Only used when type is characteristic. \ref BtdrvGattCharacteristicProperty
bool is_primary; ///< Only used when type is service
} BtdrvGattAttribute;
/// LeConnectionParams [5.0.0-8.1.1]
typedef struct {
BtdrvAddress addr; ///< \ref BtdrvAddress
u16 min_conn_interval; ///< Minimum connection interval
u16 max_conn_interval; ///< Maximum connection interval
u16 scan_interval; ///< Scan interval
u16 scan_window; ///< Scan window
u16 slave_latency; ///< Slave latency
u16 supervision_tout; ///< Connection supervision timeout multiplier
u8 preference; ///< Unused
u8 pad; ///< Padding
} BtdrvLeConnectionParams;
/// BleConnectionParameter [9.0.0+]
typedef struct {
u16 min_conn_interval; ///< Minimum connection interval
u16 max_conn_interval; ///< Maximum connection interval
u16 scan_interval; ///< Scan interval
u16 scan_window; ///< Scan window
u16 slave_latency; ///< Slave latency
u16 supervision_tout; ///< Connection supervision timeout multiplier
} BtdrvBleConnectionParameter;
/// BtdrvBleAdvertisePacketData
typedef struct {
u32 adv_data_mask; ///< Bitmask of following AD data to be included in advertising packets \ref BtdrvBleAdBit
u8 flag; ///< AD flag value to be advertised \ref BtdrvBleAdFlag. Included with BtdrvBleAdBit_Flags
u8 manu_data_len; ///< Size of manu_data below
u8 manu_data[0x1F]; ///< Manufacturer-specific data to be advertised. Included with BtdrvBleAdBit_Manufacturer
u8 pad[1]; ///< Padding
u16 appearance_data; ///< Device appearance data to be advertised \ref BtdrvAppearanceType. Included with BtdrvBleAdBit_Appearance
u8 num_service; ///< Number of services in uuid_val array below
u8 pad2[3]; ///< Padding
BtdrvGattAttributeUuid uuid_val[0x6]; ///< Array of 16-bit UUIDs to be advertised \ref BtdrvGattAttributeUuid. Included with BtdrvBleAdBit_Service
u8 service_data_len; ///< Size of service_data below
u8 pad3[1]; ///< Padding
u16 service_data_uuid; ///< 16-bit UUID of service_data below
u8 service_data[0x1F]; ///< Service data to be advertised. Included with BtdrvBleAdBit_ServiceData
bool is_scan_rsp; ///< Whether this is an inquiry scan response or advertising data
u8 tx_power; ///< Inquiry transmit power to be advertised. Included with BtdrvBleAdBit_TxPower
u8 pad4[3]; ///< Padding
} BtdrvBleAdvertisePacketData;
/// BleAdvertisement
typedef struct {
u8 size; ///< Size of data below.
u8 type; ///< \ref BtdrvAdType
u8 data[0x1D]; ///< Advertisement data
} BtdrvBleAdvertisement;
/// BleAdvertiseFilter
typedef struct {
u8 index; ///< Filter index
BtdrvBleAdvertisement adv; ///< \ref BtdrvBleAdvertisement
u8 mask[0x1D]; ///< Mask for advertisement data above
u8 mask_size; ///< Size of mask above.
} BtdrvBleAdvertiseFilter;
/// BleAdvertisePacketParameter
typedef struct {
u16 company_id;
u8 pattern_data[6];
} BtdrvBleAdvertisePacketParameter;
/// BleScanResult
typedef struct {
u8 unk_x0; ///< Unknown
BtdrvAddress addr; ///< \ref BtdrvAddress
u8 unk_x7[0x139]; ///< Unknown
s32 count; ///< Unknown
s32 unk_x144; ///< Unknown
} BtdrvBleScanResult;
/// BleConnectionInfo
typedef struct {
u32 connection_handle; ///< ConnectionHandle, 0xFFFFFFFF ([5.0.0-5.0.2] 0xFFFF) is invalid.
BtdrvAddress addr; ///< \ref BtdrvAddress
u8 pad[2]; ///< Padding
} BtdrvBleConnectionInfo;
/// LeEventInfo
typedef struct {
u32 unk_x0; ///< Unknown

View File

@ -60,6 +60,7 @@ typedef enum {
typedef enum {
BtmProfile_None = 0, ///< None
BtmProfile_Hid = 1, ///< Hid
BtmProfile_Audio = 2, ///< [13.0.0+] Audio
} BtmProfile;
/// BdName
@ -297,3 +298,8 @@ typedef struct {
BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
} BtmBleDataPath;
/// AudioDevice
typedef struct {
BtdrvAddress addr; ///< Device address
char name[0xF9]; ///< Device name
} BtmAudioDevice;

View File

@ -6,6 +6,8 @@
#pragma once
#include "../types.h"
#include "../kernel/event.h"
#include "../services/btdrv_types.h"
#include "../services/btm_types.h"
#include "../sf/service.h"
/// Initialize btm:sys.
@ -80,3 +82,104 @@ Result btmsysAcquireGamepadPairingEvent(Event* out_event);
*/
Result btmsysIsGamepadPairingStarted(bool *out);
/**
* @brief StartAudioDeviceDiscovery
* @note Only available on [13.0.0+].
*/
Result btmsysStartAudioDeviceDiscovery(void);
/**
* @brief StopAudioDeviceDiscovery
* @note Only available on [13.0.0+].
*/
Result btmsysStopAudioDeviceDiscovery(void);
/**
* @brief IsDiscoveryingAudioDevice
* @note Only available on [13.0.0+].
* @param[out] out Output flag.
*/
Result btmsysIsDiscoveryingAudioDevice(bool *out);
/**
* @brief GetDiscoveredAudioDevice
* @note Only available on [13.0.0+].
* @param[out] out Output array of \ref BtmAudioDevice.
* @param[in] count Size of the out array in entries. The max is 15.
* @param[out] total_out Total output entries.
*/
Result btmsysGetDiscoveredAudioDevice(BtmAudioDevice *out, s32 count, s32 *total_out);
/**
* @brief AcquireAudioDeviceConnectionEvent
* @note Only available on [13.0.0+].
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=true.
*/
Result btmsysAcquireAudioDeviceConnectionEvent(Event* out_event);
/**
* @brief ConnectAudioDevice
* @note Only available on [13.0.0+].
* @param[in] addr \ref BtdrvAddress
*/
Result btmsysConnectAudioDevice(BtdrvAddress addr);
/**
* @brief IsConnectingAudioDevice
* @note Only available on [13.0.0+].
* @param[out] out Output flag.
*/
Result btmsysIsConnectingAudioDevice(bool *out);
/**
* @brief GetConnectedAudioDevices
* @note Only available on [13.0.0+].
* @param[out] out Output array of \ref BtmAudioDevice.
* @param[in] count Size of the out array in entries. The max is 8.
* @param[out] total_out Total output entries.
*/
Result btmsysGetConnectedAudioDevices(BtmAudioDevice *out, s32 count, s32 *total_out);
/**
* @brief DisconnectAudioDevice
* @note Only available on [13.0.0+].
* @param[in] addr \ref BtdrvAddress
*/
Result btmsysDisconnectAudioDevice(BtdrvAddress addr);
/**
* @brief AcquirePairedAudioDeviceInfoChangedEvent
* @note Only available on [13.0.0+].
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=true.
*/
Result btmsysAcquirePairedAudioDeviceInfoChangedEvent(Event* out_event);
/**
* @brief GetPairedAudioDevices
* @note Only available on [13.0.0+].
* @param[out] out Output array of \ref BtmAudioDevice.
* @param[in] count Size of the out array in entries. The max is 10.
* @param[out] total_out Total output entries.
*/
Result btmsysGetPairedAudioDevices(BtmAudioDevice *out, s32 count, s32 *total_out);
/**
* @brief RemoveAudioDevicePairing
* @note Only available on [13.0.0+].
* @param[in] addr \ref BtdrvAddress
*/
Result btmsysRemoveAudioDevicePairing(BtdrvAddress addr);
/**
* @brief RequestAudioDeviceConnectionRejection
* @note Only available on [13.0.0+].
*/
Result btmsysRequestAudioDeviceConnectionRejection(void);
/**
* @brief CancelAudioDeviceConnectionRejection
* @note Only available on [13.0.0+].
*/
Result btmsysCancelAudioDeviceConnectionRejection(void);

View File

@ -93,7 +93,9 @@ typedef struct {
CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
u8 storage; ///< \ref CapsAlbumStorage
u8 content; ///< \ref CapsAlbumFileContents
u8 pad_x12[0x6]; ///< padding
u8 unknown_12; ///< [19.0.0+]
u8 unknown_13; ///< [19.0.0+]
u8 pad_x14[0x4]; ///< padding
} CapsAlbumFileId;
/// AlbumEntry

View File

@ -9,6 +9,13 @@
#include "../sf/service.h"
#include "../services/caps.h"
typedef struct {
u64 application_id;
u8 unknown_08;
u8 unknown_09;
u8 reserved[6];
} CapsApplicationId;
/// Initialize caps:c
Result capscInitialize(void);
@ -40,7 +47,7 @@ Result capscNotifyAlbumStorageIsUnAvailable(CapsAlbumStorage storage);
* @param[in] appletResourceUserId AppletResourceUserId.
* @param[in] application_id ApplicationId.
*/
Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id);
Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, const CapsApplicationId *application_id);
/**
* @brief Unregister an applet.
@ -49,7 +56,7 @@ Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, u64 applicati
* @param[in] appletResourceUserId AppletResourceUserId.
* @param[in] application_id ApplicationId.
*/
Result capscUnregisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id);
Result capscUnregisterAppletResourceUserId(u64 appletResourceUserId, const CapsApplicationId *application_id);
/**
* @brief Get an ApplicationId that corresponds to an AppletResourceUserId.
@ -58,7 +65,7 @@ Result capscUnregisterAppletResourceUserId(u64 appletResourceUserId, u64 applica
* @param[out] application_id ApplicationId.
* @param[in] appletResourceUserId AppletResourceUserId.
*/
Result capscGetApplicationIdFromAruid(u64 *application_id, u64 aruid);
Result capscGetApplicationIdFromAruid(CapsApplicationId *application_id, u64 aruid);
/**
* @brief Checks whether an ApplicationId is registered.
@ -74,7 +81,7 @@ Result capscCheckApplicationIdRegistered(u64 application_id);
* @param[in] contents \ref CapsAlbumFileContents
* @param[out] file_id \ref CapsAlbumFileId
*/
Result capscGenerateCurrentAlbumFileId(u64 application_id, CapsAlbumFileContents contents, CapsAlbumFileId *file_id);
Result capscGenerateCurrentAlbumFileId(const CapsApplicationId *application_id, CapsAlbumFileContents contents, CapsAlbumFileId *file_id);
/**
* @brief Generate an ApplicationAlbumEntry based on parameters.

View File

@ -30,3 +30,34 @@ Service* capsdcGetServiceSession(void);
* @param[in] out_image_size Output image buffer size, should be at least large enough for RGBA8 width x height.
*/
Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_image, size_t out_image_size);
/**
* @brief Shrinks a jpeg's dimensions by 2.
* @note Tries to compress with jpeg quality in this order: 98, 95, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0.
* @note Only available on [17.0.0+].
* @param[in] width Input image width.
* @param[in] height Input image width.
* @param[in] opts \ref CapsScreenShotDecodeOption.
* @param[in] jpeg Jpeg image input buffer.
* @param[in] jpeg_size Input image buffer size.
* @param[out] out_jpeg Jpeg image output buffer
* @param[in] out_jpeg_size Output image buffer size.
* @param[out] out_result_size size of the resulting JPEG.
*/
Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size);
/**
* @brief Shrinks a jpeg.
* @note Fails if the scaled size is larger than the original or the output buffer isn't large enough.
* @note Only available on [19.0.0+].
* @param[in] scaled_width Wanted image width.
* @param[in] scaled_height Wanted image width.
* @param[in] jpeg_quality has to be in range 0-100.
* @param[in] opts \ref CapsScreenShotDecodeOption.
* @param[in] jpeg Jpeg image input buffer.
* @param[in] jpeg_size Input image buffer size.
* @param[out] out_jpeg Jpeg image output buffer
* @param[in] out_jpeg_size Output image buffer size.
* @param[out] out_result_size size of the resulting jpeg.
*/
Result capsdcShrinkJpegEx(u32 scaled_width, u32 scaled_height, u32 jpeg_quality, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size);

View File

@ -27,3 +27,4 @@ Result clkrstOpenSession(ClkrstSession* session_out, PcvModuleId module_id, u32
void clkrstCloseSession(ClkrstSession* session);
Result clkrstSetClockRate(ClkrstSession* session, u32 hz);
Result clkrstGetClockRate(ClkrstSession* session, u32 *out_hz);
Result clkrstGetPossibleClockRates(ClkrstSession *session, u32 *rates, s32 max_count, PcvClockRatesListType *out_type, s32 *out_count);

View File

@ -79,7 +79,7 @@ typedef struct {
* @note This function does not return.
* @note This uses \ref fatalThrowWithPolicy with \ref FatalPolicy_ErrorScreen internally.
*/
void NORETURN fatalThrow(Result err);
void NX_NORETURN fatalThrow(Result err);
/**
* @brief Triggers a system fatal error with a custom \ref FatalPolicy.

View File

@ -265,6 +265,12 @@ typedef struct {
u32 value;
} FsGameCardHandle;
typedef struct {
u32 version;
u8 pad[0x4];
u64 id;
} FsGameCardUpdatePartitionInfo;
typedef struct {
u32 aes_ctr_key_type; ///< Contains bitflags describing how data is AES encrypted.
u32 speed_emulation_type; ///< Contains bitflags describing how data is emulated.
@ -320,6 +326,38 @@ typedef enum {
FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard = 2, ///< [8.0.0+]
} FsFileSystemQueryId;
/// FileSystemAttribute
typedef struct {
bool directory_name_length_max_has_value;
bool file_name_length_max_has_value;
bool directory_path_length_max_has_value;
bool file_path_length_max_has_value;
bool utf16_create_directory_path_length_max_has_value;
bool utf16_delete_directory_path_length_max_has_value;
bool utf16_rename_source_directory_path_length_max_has_value;
bool utf16_rename_destination_directory_path_length_max_has_value;
bool utf16_open_directory_path_length_max_has_value;
bool utf16_directory_name_length_max_has_value;
bool utf16_file_name_length_max_has_value;
bool utf16_directory_path_length_max_has_value;
bool utf16_file_path_length_max_has_value;
u8 reserved1[0x1B];
s32 directory_name_length_max;
s32 file_name_length_max;
s32 directory_path_length_max;
s32 file_path_length_max;
s32 utf16_create_directory_path_length_max;
s32 utf16_delete_directory_path_length_max;
s32 utf16_rename_source_directory_path_length_max;
s32 utf16_rename_destination_directory_path_length_max;
s32 utf16_open_directory_path_length_max;
s32 utf16_directory_name_length_max;
s32 utf16_file_name_length_max;
s32 utf16_directory_path_length_max;
s32 utf16_file_path_length_max;
u8 reserved2[0x64];
} FsFileSystemAttribute;
/// FsPriority
typedef enum {
FsPriority_Normal = 0,
@ -340,6 +378,108 @@ typedef enum {
FsMountHostOptionFlag_PseudoCaseSensitive = BIT(0), ///< Host filesystem will be pseudo case sensitive.
} FsMountHostOption;
/// FsStorageErrorInfo
typedef struct {
u32 num_activation_failures;
u32 num_activation_error_corrections;
u32 num_read_write_failures;
u32 num_read_write_error_corrections;
} FsStorageErrorInfo;
/// FatFatError
typedef struct {
s32 error;
s32 extra_error;
s32 drive_id;
char name[16];
u8 reserved[4];
} FatFatError;
/// FatFatReportInfo1
typedef struct {
u16 open_file_peak_count;
u16 open_directory_peak_count;
} FatFatReportInfo1;
/// FatFatReportInfo2
typedef struct {
u16 open_unique_file_entry_peak_count;
u16 open_unique_directory_entry_peak_count;
} FatFatReportInfo2;
/// FatFatSafeInfo
typedef struct {
u32 result;
u32 error_number;
u32 safe_error_number;
} FatFatSafeInfo;
/// FsFileSystemProxyErrorInfo
typedef struct {
u32 rom_fs_remount_for_data_corruption_count;
u32 rom_fs_unrecoverable_data_corruption_by_remount_count;
FatFatError fat_fs_error;
u32 rom_fs_recovered_by_invalidate_cache_count;
u32 save_data_index_count;
FatFatReportInfo1 bis_system_fat_report_info_1;
FatFatReportInfo1 bis_user_fat_report_info_1;
FatFatReportInfo1 sd_card_fat_report_info_1;
FatFatReportInfo2 bis_system_fat_report_info_2;
FatFatReportInfo2 bis_user_fat_report_info_2;
FatFatReportInfo2 sd_card_fat_report_info_2;
u32 rom_fs_deep_retry_start_count;
u32 rom_fs_unrecoverable_by_game_card_access_failed_count;
FatFatSafeInfo bis_system_fat_safe_info;
FatFatSafeInfo bis_user_fat_safe_info;
u8 reserved[0x18];
} FsFileSystemProxyErrorInfo;
/// FsMemoryReportInfo
typedef struct {
u64 pooled_buffer_peak_free_size;
u64 pooled_buffer_retried_count;
u64 pooled_buffer_reduce_allocation_count;
u64 buffer_manager_peak_free_size;
u64 buffer_manager_retried_count;
u64 exp_heap_peak_free_size;
u64 buffer_pool_peak_free_size;
u64 patrol_read_allocate_buffer_success_count;
u64 patrol_read_allocate_buffer_failure_count;
u64 buffer_manager_peak_total_allocatable_size;
u64 buffer_pool_max_allocate_size;
u64 pooled_buffer_failed_ideal_allocation_count_on_async_access;
u8 reserved[0x20];
} FsMemoryReportInfo;
/// FsGameCardErrorReportInfo
typedef struct {
u16 game_card_crc_error_num;
u16 reserved1;
u16 asic_crc_error_num;
u16 reserved2;
u16 refresh_num;
u16 reserved3;
u16 retry_limit_out_num;
u16 timeout_retry_num;
u16 asic_reinitialize_failure_detail;
u16 insertion_count;
u16 removal_count;
u16 asic_reinitialize_num;
u32 initialize_count;
u16 asic_reinitialize_failure_num;
u16 awaken_failure_num;
u16 reserved4;
u16 refresh_succeeded_count;
u32 last_read_error_page_address;
u32 last_read_error_page_count;
u32 awaken_count;
u32 read_count_from_insert;
u32 read_count_from_awaken;
u8 reserved5[8];
} FsGameCardErrorReportInfo;
/// Initialize fsp-srv. Used automatically during app startup.
Result fsInitialize(void);
@ -405,18 +545,26 @@ Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
Result fsIsSignedSystemPartitionOnSdCardValid(bool *out);
Result fsGetProgramId(u64* out, const char *path, FsContentAttributes attr); ///< [17.0.0+]
/// Retrieves the rights id corresponding to the content path. Only available on [2.0.0-15.0.1].
Result fsGetRightsIdByPath(const char* path, FsRightsId* out_rights_id);
/// Retrieves the rights id and key generation corresponding to the content path. Only available on [3.0.0+], attr is ignored before [16.0.0].
Result fsGetRightsIdAndKeyGenerationByPath(const char* path, FsContentAttributes attr, u8* out_key_generation, FsRightsId* out_rights_id);
Result fsGetContentStorageInfoIndex(s32 *out); ///< [19.0.0+]
Result fsDisableAutoSaveDataCreation(void);
Result fsSetGlobalAccessLogMode(u32 mode);
Result fsGetGlobalAccessLogMode(u32* out_mode);
Result fsOutputAccessLogToSdCard(const char *log, size_t size);
Result fsGetAndClearErrorInfo(FsFileSystemProxyErrorInfo *out); ///< [2.0.0+]
Result fsGetAndClearMemoryReportInfo(FsMemoryReportInfo* out); ///< [4.0.0+]
/// Only available on [7.0.0+].
Result fsGetProgramIndexForAccessLog(u32 *out_program_index, u32 *out_program_count);
@ -477,6 +625,7 @@ Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, s64* out);
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRaw *out); ///< [3.0.0+]
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path); ///< [3.0.0+]
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryId query_id); ///< [4.0.0+]
Result fsFsGetFileSystemAttribute(FsFileSystem* fs, FsFileSystemAttribute *out); ///< [15.0.0+]
void fsFsClose(FsFileSystem* fs);
/// Uses \ref fsFsQueryEntry to set the archive bit on the specified absolute directory path.
@ -522,7 +671,23 @@ void fsEventNotifierClose(FsEventNotifier* e);
// IDeviceOperator
Result fsDeviceOperatorIsSdCardInserted(FsDeviceOperator* d, bool* out);
Result fsDeviceOperatorGetSdCardSpeedMode(FsDeviceOperator* d, s64* out);
Result fsDeviceOperatorGetSdCardCid(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
Result fsDeviceOperatorGetSdCardUserAreaSize(FsDeviceOperator* d, s64* out);
Result fsDeviceOperatorGetSdCardProtectedAreaSize(FsDeviceOperator* d, s64* out);
Result fsDeviceOperatorGetAndClearSdCardErrorInfo(FsDeviceOperator* d, FsStorageErrorInfo* out, s64 *out_log_size, void *dst, size_t dst_size, s64 size);
Result fsDeviceOperatorGetMmcCid(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
Result fsDeviceOperatorGetMmcSpeedMode(FsDeviceOperator* d, s64* out);
Result fsDeviceOperatorGetMmcPatrolCount(FsDeviceOperator* d, u32* out);
Result fsDeviceOperatorGetAndClearMmcErrorInfo(FsDeviceOperator* d, FsStorageErrorInfo* out, s64 *out_log_size, void *dst, size_t dst_size, s64 size);
Result fsDeviceOperatorGetMmcExtendedCsd(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
Result fsDeviceOperatorIsGameCardInserted(FsDeviceOperator* d, bool* out);
Result fsDeviceOperatorGetGameCardHandle(FsDeviceOperator* d, FsGameCardHandle* out);
Result fsDeviceOperatorGetGameCardUpdatePartitionInfo(FsDeviceOperator* d, const FsGameCardHandle* handle, FsGameCardUpdatePartitionInfo* out);
Result fsDeviceOperatorGetGameCardAttribute(FsDeviceOperator* d, const FsGameCardHandle* handle, u8 *out);
Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator* d, const FsGameCardHandle* handle, void* dst, size_t dst_size, s64* out_size, s64 size);
Result fsDeviceOperatorGetGameCardIdSet(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
Result fsDeviceOperatorGetGameCardErrorReportInfo(FsDeviceOperator* d, FsGameCardErrorReportInfo* out);
Result fsDeviceOperatorGetGameCardDeviceId(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
Result fsDeviceOperatorChallengeCardExistence(FsDeviceOperator* d, const FsGameCardHandle* handle, void* dst, size_t dst_size, void* seed, size_t seed_size, void* value, size_t value_size);
void fsDeviceOperatorClose(FsDeviceOperator* d);

View File

@ -9,6 +9,7 @@
#include "../sf/service.h"
#include "../services/fs.h"
#include "../crypto/sha256.h"
#include "../services/ncm_types.h"
typedef struct {
u8 signature[0x100];
@ -26,5 +27,5 @@ void fsldrExit(void);
/// Gets the Service object for the actual fsp-ldr service session.
Service* fsldrGetServiceSession(void);
Result fsldrOpenCodeFileSystem(FsCodeInfo* out_code_info, u64 tid, const char *path, FsContentAttributes attr, FsFileSystem* out);
Result fsldrOpenCodeFileSystem(FsCodeInfo* out_code_info, u64 tid, NcmStorageId storage_id, const char *path, FsContentAttributes attr, FsFileSystem* out);
Result fsldrIsArchivedProgram(u64 pid, bool *out);

View File

@ -18,7 +18,7 @@ void fsprExit(void);
/// Gets the Service object for the actual fsp-pr service session.
Service* fsprGetServiceSession(void);
Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size);
Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size, u8 fs_access_control_restriction_mode);
Result fsprUnregisterProgram(u64 pid);
Result fsprSetCurrentProcess(void);
Result fsprSetEnabledProgramVerification(bool enabled);

View File

@ -64,8 +64,8 @@ Result gpioPadSetInterruptMode(GpioPadSession *p, GpioInterruptMode mode);
Result gpioPadGetInterruptMode(GpioPadSession *p, GpioInterruptMode *out);
Result gpioPadSetInterruptEnable(GpioPadSession *p, bool en);
Result gpioPadGetInterruptEnable(GpioPadSession *p, bool *out);
Result gpioPadGetInterruptStatus(GpioPadSession *p, GpioInterruptStatus *out);
Result gpioPadClearInterruptStatus(GpioPadSession *p);
Result gpioPadGetInterruptStatus(GpioPadSession *p, GpioInterruptStatus *out); ///< [1.0.0-16.1.0]
Result gpioPadClearInterruptStatus(GpioPadSession *p); ///< [1.0.0-16.1.0]
Result gpioPadSetValue(GpioPadSession *p, GpioValue val);
Result gpioPadGetValue(GpioPadSession *p, GpioValue *out);
Result gpioPadBindInterrupt(GpioPadSession *p, Event *out);

View File

@ -755,6 +755,297 @@ typedef struct HidKeyboardSharedMemoryFormat {
// End HidKeyboard
// Begin HidBasicXpad
/// HidBasicXpadState
typedef struct {
u64 sampling_number;
u32 attributes;
u32 buttons;
u64 analog_stick_left;
u64 analog_stick_right;
} HidBasicXpadState;
/// HidBasicXpadStateAtomicStorage
typedef struct {
u64 sampling_number;
HidBasicXpadState state;
} HidBasicXpadStateAtomicStorage;
/// HidBasicXpadLifo
typedef struct {
HidCommonLifoHeader header;
HidBasicXpadStateAtomicStorage storage[17];
} HidBasicXpadLifo;
/// HidBasicXpadSharedMemoryEntry
typedef struct {
HidBasicXpadLifo lifo;
u8 padding[0x138];
} HidBasicXpadSharedMemoryEntry;
/// HidBasicXpadSharedMemoryFormat
typedef struct {
HidBasicXpadSharedMemoryEntry entries[4];
} HidBasicXpadSharedMemoryFormat;
// End HidBasicXpad
// Begin HidDigitizer
/// HidDigitizerState
typedef struct {
u64 sampling_number;
u32 unk_0x8;
u32 unk_0xC;
u32 attributes;
u32 buttons;
u32 unk_0x18;
u32 unk_0x1C;
u32 unk_0x20;
u32 unk_0x24;
u32 unk_0x28;
u32 unk_0x2C;
u32 unk_0x30;
u32 unk_0x34;
u32 unk_0x38;
u32 unk_0x3C;
u32 unk_0x40;
u32 unk_0x44;
u32 unk_0x48;
u32 unk_0x4C;
u32 unk_0x50;
u32 unk_0x54;
} HidDigitizerState;
/// HidDigitizerStateAtomicStorage
typedef struct {
u64 sampling_number;
HidDigitizerState state;
} HidDigitizerStateAtomicStorage;
/// HidDigitizerLifo
typedef struct {
HidCommonLifoHeader header;
HidDigitizerStateAtomicStorage storage[17];
} HidDigitizerLifo;
/// HidDigitizerSharedMemoryFormat
typedef struct {
HidDigitizerLifo lifo;
u8 padding[0x980];
} HidDigitizerSharedMemoryFormat;
// End HidDigitizer
// Begin HidHomeButton
/// HidHomeButtonState
typedef struct {
u64 sampling_number;
u64 buttons;
} HidHomeButtonState;
/// HidHomeButtonStateAtomicStorage
typedef struct {
u64 sampling_number;
HidHomeButtonState state;
} HidHomeButtonStateAtomicStorage;
/// HidHomeButtonLifo
typedef struct {
HidCommonLifoHeader header;
HidHomeButtonStateAtomicStorage storage[17];
} HidHomeButtonLifo;
/// HidHomeButtonSharedMemoryFormat
typedef struct {
HidHomeButtonLifo lifo;
u8 padding[0x48];
} HidHomeButtonSharedMemoryFormat;
// End HidHomeButton
// Begin HidSleepButton
/// HidSleepButtonState
typedef struct {
u64 sampling_number;
u64 buttons;
} HidSleepButtonState;
/// HidSleepButtonStateAtomicStorage
typedef struct {
u64 sampling_number;
HidSleepButtonState state;
} HidSleepButtonStateAtomicStorage;
/// HidSleepButtonLifo
typedef struct {
HidCommonLifoHeader header;
HidSleepButtonStateAtomicStorage storage[17];
} HidSleepButtonLifo;
/// HidSleepButtonSharedMemoryFormat
typedef struct {
HidSleepButtonLifo lifo;
u8 padding[0x48];
} HidSleepButtonSharedMemoryFormat;
// End HidSleepButton
// Begin HidCaptureButton
/// HidCaptureButtonState
typedef struct {
u64 sampling_number;
u64 buttons;
} HidCaptureButtonState;
/// HidCaptureButtonStateAtomicStorage
typedef struct {
u64 sampling_number;
HidCaptureButtonState state;
} HidCaptureButtonStateAtomicStorage;
/// HidCaptureButtonLifo
typedef struct {
HidCommonLifoHeader header;
HidCaptureButtonStateAtomicStorage storage[17];
} HidCaptureButtonLifo;
/// HidCaptureButtonSharedMemoryFormat
typedef struct {
HidCaptureButtonLifo lifo;
u8 padding[0x48];
} HidCaptureButtonSharedMemoryFormat;
// End HidCaptureButton
// Begin HidInputDetector
/// HidInputDetectorState
typedef struct {
u64 input_source_state;
u64 sampling_number;
} HidInputDetectorState;
/// HidInputDetectorStateAtomicStorage
typedef struct {
u64 sampling_number;
HidInputDetectorState state;
} HidInputDetectorStateAtomicStorage;
/// HidInputDetectorLifo
typedef struct {
HidCommonLifoHeader header;
HidInputDetectorStateAtomicStorage storage[2];
} HidInputDetectorLifo;
/// HidInputDetectorSharedMemoryEntry
typedef struct {
HidInputDetectorLifo lifo;
u8 padding[0x30];
} HidInputDetectorSharedMemoryEntry;
/// HidInputDetectorSharedMemoryFormat
typedef struct {
HidInputDetectorSharedMemoryEntry entries[16];
} HidInputDetectorSharedMemoryFormat;
// End HidInputDetector
// Begin HidUniquePad
/// HidUniquePadConfigMutex
typedef struct {
u8 unk_0x0[0x20];
} HidUniquePadConfigMutex;
/// HidSixAxisSensorUserCalibrationState
typedef struct {
u32 flags;
u8 reserved[4];
u64 stage;
u64 sampling_number;
} HidSixAxisSensorUserCalibrationState;
/// HidSixAxisSensorUserCalibrationStateAtomicStorage
typedef struct {
u64 sampling_number;
HidSixAxisSensorUserCalibrationState calib_state;
} HidSixAxisSensorUserCalibrationStateAtomicStorage;
/// HidSixAxisSensorUserCalibrationStateLifo
typedef struct {
HidCommonLifoHeader header;
HidSixAxisSensorUserCalibrationStateAtomicStorage storage[2];
} HidSixAxisSensorUserCalibrationStateLifo;
/// HidAnalogStickCalibrationStateImpl
typedef struct {
u64 state;
u64 flags;
u64 stage;
u64 sampling_number;
} HidAnalogStickCalibrationStateImpl;
/// HidAnalogStickCalibrationStateImplAtomicStorage
typedef struct {
u64 sampling_number;
HidAnalogStickCalibrationStateImpl calib_state;
} HidAnalogStickCalibrationStateImplAtomicStorage;
/// HidAnalogStickCalibrationStateImplLifo
typedef struct {
HidCommonLifoHeader header;
HidAnalogStickCalibrationStateImplAtomicStorage storage[2];
} HidAnalogStickCalibrationStateImplLifo;
/// HidUniquePadConfig
typedef struct {
u32 type;
u32 interface;
u8 serial_number[0x10];
u32 controller_number;
bool is_active;
u8 reserved[3];
u64 sampling_number;
} HidUniquePadConfig;
/// HidUniquePadConfigAtomicStorage
typedef struct {
u64 sampling_number;
HidUniquePadConfig config;
} HidUniquePadConfigAtomicStorage;
/// HidUniquePadConfigLifo
typedef struct {
HidCommonLifoHeader header;
HidUniquePadConfigAtomicStorage storage[2];
} HidUniquePadConfigLifo;
/// HidUniquePadLifo
typedef struct {
HidUniquePadConfigLifo config_lifo;
HidAnalogStickCalibrationStateImplLifo analog_stick_calib_lifo[2];
HidSixAxisSensorUserCalibrationStateLifo sixaxis_calib_lifo;
HidUniquePadConfigMutex mutex;
} HidUniquePadLifo;
/// HidUniquePadSharedMemoryEntry
typedef struct {
HidUniquePadLifo lifo;
u8 padding[0x220];
} HidUniquePadSharedMemoryEntry;
/// HidUniquePadSharedMemoryFormat
typedef struct {
HidUniquePadSharedMemoryEntry entries[16];
} HidUniquePadSharedMemoryFormat;
// End HidUniquePad
// Begin HidNpad
/// Npad colors.
@ -1080,12 +1371,15 @@ typedef struct HidSharedMemory {
HidTouchScreenSharedMemoryFormat touchscreen;
HidMouseSharedMemoryFormat mouse;
HidKeyboardSharedMemoryFormat keyboard;
u8 digitizer[0x1000]; ///< [10.0.0+] Digitizer [1.0.0-9.2.0] BasicXpad
u8 home_button[0x200];
u8 sleep_button[0x200];
u8 capture_button[0x200];
u8 input_detector[0x800];
u8 unique_pad[0x4000]; ///< [1.0.0-4.1.0] UniquePad
union {
HidBasicXpadSharedMemoryFormat basic_xpad; ///< [1.0.0-9.2.0] BasicXpad
HidDigitizerSharedMemoryFormat digitizer; ///< [10.0.0+] Digitizer
};
HidHomeButtonSharedMemoryFormat home_button;
HidSleepButtonSharedMemoryFormat sleep_button;
HidCaptureButtonSharedMemoryFormat capture_button;
HidInputDetectorSharedMemoryFormat input_detector;
HidUniquePadSharedMemoryFormat unique_pad; ///< [1.0.0-4.1.0] UniquePad
HidNpadSharedMemoryFormat npad;
HidGestureSharedMemoryFormat gesture;
HidConsoleSixAxisSensor console_six_axis_sensor; ///< [5.0.0+] ConsoleSixAxisSensor
@ -1245,6 +1539,48 @@ NX_CONSTEXPR bool hidKeyboardStateGetKey(const HidKeyboardState *state, HidKeybo
///@}
///@name HomeButton
///@{
/**
* @brief Gets \ref HidHomeButtonState.
* @note Home button shmem must be activated with \ref hidsysActivateHomeButton
* @param[out] states Output array of \ref HidHomeButtonState.
* @param[in] count Size of the states array in entries.
* @return Total output entries.
*/
size_t hidGetHomeButtonStates(HidHomeButtonState *states, size_t count);
///@}
///@name SleepButton
///@{
/**
* @brief Gets \ref HidSleepButtonState.
* @note Sleep button shmem must be activated with \ref hidsysActivateSleepButton
* @param[out] states Output array of \ref HidSleepButtonState.
* @param[in] count Size of the states array in entries.
* @return Total output entries.
*/
size_t hidGetSleepButtonStates(HidSleepButtonState *states, size_t count);
///@}
///@name CaptureButton
///@{
/**
* @brief Gets \ref HidCaptureButtonState.
* @note Capture button shmem must be activated with \ref hidsysActivateCaptureButton
* @param[out] states Output array of \ref HidCaptureButtonState.
* @param[in] count Size of the states array in entries.
* @return Total output entries.
*/
size_t hidGetCaptureButtonStates(HidCaptureButtonState *states, size_t count);
///@}
///@name Npad
///@{

View File

@ -255,6 +255,17 @@ Result hidsysAcquireCaptureButtonEventHandle(Event* out_event, bool autoclear);
**/
Result hidsysActivateCaptureButton(void);
/**
* @brief Applies npad system common policy.
*/
Result hidsysApplyNpadSystemCommonPolicy(void);
/**
* @brief Gets the npad id type of the last controller that was active.
* @param[out] out of \ref HidNpadIdType.
*/
Result hidsysGetLastActiveNpad(u32 *out);
/**
* @brief Gets the SupportedNpadStyleSet for the CallerApplet. applet must be initialized in order to use this (uses \ref appletGetAppletResourceUserIdOfCallerApplet).
* @note Only available on [6.0.0+].
@ -312,6 +323,51 @@ Result hidsysGetUniquePadsFromNpad(HidNpadIdType id, HidsysUniquePadId *unique_p
**/
Result hidsysEnableAppletToGetInput(bool enable);
/**
* @brief EnableHandheldHids
**/
Result hidsysEnableHandheldHids(void);
/**
* @brief DisableHandheldHids
**/
Result hidsysDisableHandheldHids(void);
/**
* @brief SetJoyConRailEnabled
* @note Only available on [9.0.0+].
* @param[in] enable Input flag.
**/
Result hidsysSetJoyConRailEnabled(bool enable);
/**
* @brief IsJoyConRailEnabled
* @note Only available on [9.0.0+].
* @param[out] out Output flag.
**/
Result hidsysIsJoyConRailEnabled(bool *out);
/**
* @brief IsHandheldHidsEnabled
* @note Only available on [10.0.0+].
* @param[out] out Output flag.
**/
Result hidsysIsHandheldHidsEnabled(bool *out);
/**
* @brief IsJoyConAttachedOnAllRail
* @note Only available on [11.0.0+].
* @param[out] out Output flag.
**/
Result hidsysIsJoyConAttachedOnAllRail(bool *out);
/**
* @brief IsInvertedControllerConnectedOnRail
* @note Only available on [19.0.0+].
* @param[out] out Output flag.
**/
Result hidsysIsInvertedControllerConnectedOnRail(bool *out);
/**
* @brief AcquireUniquePadConnectionEventHandle
* @param[out] out_event Output Event.
@ -326,6 +382,13 @@ Result hidsysAcquireUniquePadConnectionEventHandle(Event *out_event);
*/
Result hidsysGetUniquePadIds(HidsysUniquePadId *unique_pad_ids, s32 count, s32 *total_out);
/**
* @brief AcquireJoyDetachOnBluetoothOffEventHandle
* @param[out] out_event Output Event.
* @param[in] Event autoclear.
*/
Result hidsysAcquireJoyDetachOnBluetoothOffEventHandle(Event *out_event, bool autoclear);
/**
* @brief GetUniquePadBluetoothAddress
* @note Only available on [3.0.0+].
@ -413,6 +476,13 @@ Result hidsysEnableUsbFullKeyController(bool flag);
*/
Result hidsysIsUsbConnected(HidsysUniquePadId unique_pad_id, bool *out);
/**
* @brief GetTouchScreenDefaultConfiguration
* @note Only available on [9.0.0+].
* @param[out] touch_screen_configuration \ref HidTouchScreenConfigurationForNx.
*/
Result hidsysGetTouchScreenDefaultConfiguration(HidTouchScreenConfigurationForNx *touch_screen_configuration);
/**
* @brief IsFirmwareUpdateNeededForNotification
* @note Only available on [9.0.0+].
@ -423,7 +493,7 @@ Result hidsysIsFirmwareUpdateNeededForNotification(HidsysUniquePadId unique_pad_
/**
* @brief Legacy IsButtonConfigSupported.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysIsButtonConfigSupported instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysIsButtonConfigSupported instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] out Output bool flag.
*/
@ -431,7 +501,7 @@ Result hidsysLegacyIsButtonConfigSupported(HidsysUniquePadId unique_pad_id, bool
/**
* @brief IsButtonConfigSupported
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigSupported instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigSupported instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] out Output bool flag.
*/
@ -439,34 +509,34 @@ Result hidsysIsButtonConfigSupported(BtdrvAddress addr, bool *out);
/**
* @brief IsButtonConfigEmbeddedSupported
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
* @param[out] out Output bool flag.
*/
Result hidsysIsButtonConfigEmbeddedSupported(bool *out);
/**
* @brief Legacy DeleteButtonConfig.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysDeleteButtonConfig instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysDeleteButtonConfig instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
*/
Result hidsysLegacyDeleteButtonConfig(HidsysUniquePadId unique_pad_id);
/**
* @brief DeleteButtonConfig
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyDeleteButtonConfig instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyDeleteButtonConfig instead.
* @param[in] addr \ref BtdrvAddress
*/
Result hidsysDeleteButtonConfig(BtdrvAddress addr);
/**
* @brief DeleteButtonConfigEmbedded
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
*/
Result hidsysDeleteButtonConfigEmbedded(void);
/**
* @brief Legacy SetButtonConfigEnabled.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigEnabled instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigEnabled instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] flag Input flag.
*/
@ -474,7 +544,7 @@ Result hidsysLegacySetButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool
/**
* @brief SetButtonConfigEnabled
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEnabled instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEnabled instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] flag Input flag.
*/
@ -482,14 +552,14 @@ Result hidsysSetButtonConfigEnabled(BtdrvAddress addr, bool flag);
/**
* @brief SetButtonConfigEmbeddedEnabled
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
* @param[in] flag Input flag.
*/
Result hidsysSetButtonConfigEmbeddedEnabled(bool flag);
/**
* @brief Legacy IsButtonConfigEnabled.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysIsButtonConfigEnabled instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysIsButtonConfigEnabled instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] out Output bool flag.
*/
@ -497,7 +567,7 @@ Result hidsysLegacyIsButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool *
/**
* @brief IsButtonConfigEnabled
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigEnabled instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigEnabled instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] out Output bool flag.
*/
@ -505,14 +575,14 @@ Result hidsysIsButtonConfigEnabled(BtdrvAddress addr, bool *out);
/**
* @brief IsButtonConfigEmbeddedEnabled
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
* @param[out] out Output bool flag.
*/
Result hidsysIsButtonConfigEmbeddedEnabled(bool *out);
/**
* @brief Legacy SetButtonConfigEmbedded.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigEmbedded instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigEmbedded instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigEmbedded
*/
@ -520,14 +590,14 @@ Result hidsysLegacySetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, cons
/**
* @brief SetButtonConfigEmbedded
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEmbedded instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEmbedded instead.
* @param[in] config \ref HidsysButtonConfigEmbedded
*/
Result hidsysSetButtonConfigEmbedded(const HidsysButtonConfigEmbedded *config);
/**
* @brief Legacy SetButtonConfigFull.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigFull instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigFull instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigFull
*/
@ -535,7 +605,7 @@ Result hidsysLegacySetButtonConfigFull(HidsysUniquePadId unique_pad_id, const Hi
/**
* @brief SetButtonConfigFull
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigFull instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigFull instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] config \ref HidsysButtonConfigFull
*/
@ -543,7 +613,7 @@ Result hidsysSetButtonConfigFull(BtdrvAddress addr, const HidsysButtonConfigFull
/**
* @brief Legacy SetButtonConfigLeft.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigLeft instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigLeft instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigLeft
*/
@ -551,7 +621,7 @@ Result hidsysLegacySetButtonConfigLeft(HidsysUniquePadId unique_pad_id, const Hi
/**
* @brief SetButtonConfigLeft
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigLeft instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigLeft instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] config \ref HidsysButtonConfigLeft
*/
@ -559,7 +629,7 @@ Result hidsysSetButtonConfigLeft(BtdrvAddress addr, const HidsysButtonConfigLeft
/**
* @brief Legacy SetButtonConfigRight.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigRight instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigRight instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigRight
*/
@ -567,7 +637,7 @@ Result hidsysLegacySetButtonConfigRight(HidsysUniquePadId unique_pad_id, const H
/**
* @brief SetButtonConfigRight
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigRight instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigRight instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] config \ref HidsysButtonConfigRight
*/
@ -575,7 +645,7 @@ Result hidsysSetButtonConfigRight(BtdrvAddress addr, const HidsysButtonConfigRig
/**
* @brief Legacy GetButtonConfigEmbedded.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigEmbedded instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigEmbedded instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigEmbedded
*/
@ -583,14 +653,14 @@ Result hidsysLegacyGetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, Hids
/**
* @brief GetButtonConfigEmbedded
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigEmbedded instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigEmbedded instead.
* @param[out] config \ref HidsysButtonConfigEmbedded
*/
Result hidsysGetButtonConfigEmbedded(HidsysButtonConfigEmbedded *config);
/**
* @brief Legacy GetButtonConfigFull.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigFull instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigFull instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigFull
*/
@ -598,7 +668,7 @@ Result hidsysLegacyGetButtonConfigFull(HidsysUniquePadId unique_pad_id, HidsysBu
/**
* @brief GetButtonConfigFull
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigFull instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigFull instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] config \ref HidsysButtonConfigFull
*/
@ -606,7 +676,7 @@ Result hidsysGetButtonConfigFull(BtdrvAddress addr, HidsysButtonConfigFull *conf
/**
* @brief Legacy GetButtonConfigLeft.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigLeft instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigLeft instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigLeft
*/
@ -614,7 +684,7 @@ Result hidsysLegacyGetButtonConfigLeft(HidsysUniquePadId unique_pad_id, HidsysBu
/**
* @brief GetButtonConfigLeft
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigLeft instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigLeft instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] config \ref HidsysButtonConfigLeft
*/
@ -622,7 +692,7 @@ Result hidsysGetButtonConfigLeft(BtdrvAddress addr, HidsysButtonConfigLeft *conf
/**
* @brief Legacy GetButtonConfigRight.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigRight instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigRight instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigRight
*/
@ -630,7 +700,7 @@ Result hidsysLegacyGetButtonConfigRight(HidsysUniquePadId unique_pad_id, HidsysB
/**
* @brief GetButtonConfigRight
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigRight instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigRight instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] config \ref HidsysButtonConfigRight
*/
@ -964,4 +1034,3 @@ Result hidsysSetButtonConfigStorageLeft(s32 index, const HidcfgButtonConfigLeft
* @param[in] name \ref HidcfgStorageName
*/
Result hidsysSetButtonConfigStorageRight(s32 index, const HidcfgButtonConfigRight *config, const HidcfgStorageName *name);

View File

@ -67,6 +67,12 @@ typedef enum {
LdnWirelessControllerRestriction_Unknown1 = 1, ///< Unknown
} LdnWirelessControllerRestriction;
/// Protocol
typedef enum {
LdnProtocol_NX = 1, ///< NX (default)
LdnProtocol_Unknown3 = 3, ///< (NXAndOunce?)
} LdnProtocol;
/// Ipv4Address. This is essentially the same as struct in_addr - hence this can be used with standard sockets (byteswap required).
typedef struct {
u32 addr; ///< Address
@ -331,6 +337,13 @@ Result ldnScanPrivate(s32 channel, const LdnScanFilter *filter, LdnNetworkInfo *
*/
Result ldnSetWirelessControllerRestriction(LdnWirelessControllerRestriction restriction);
/**
* @brief SetProtocol
* @note This is only usable with [20.0.0+] (with [18.0.0-19-0.1] this is available but not usable).
* @param[in] protocol \ref LdnProtocol
*/
Result ldnSetProtocol(LdnProtocol protocol);
/**
* @brief OpenAccessPoint
* @note \ref LdnState must be ::LdnState_Initialized, this eventually sets the State to ::LdnState_AccessPointOpened.

View File

@ -20,6 +20,20 @@ typedef struct {
u32 acid_fac_size;
u32 aci0_fah_size;
u8 ac_buffer[0x3E0];
} LoaderProgramInfoV1;
typedef struct {
u8 main_thread_priority;
u8 default_cpu_id;
u16 application_type;
u32 main_thread_stack_size;
u64 program_id;
u32 acid_sac_size;
u32 aci0_sac_size;
u32 acid_fac_size;
u32 aci0_fah_size;
u8 unused_20[0x10];
u8 ac_buffer[0x3E0];
} LoaderProgramInfo;
typedef struct {
@ -28,6 +42,11 @@ typedef struct {
u64 size;
} LoaderModuleInfo;
typedef struct {
u8 platform; ///< NcmContentMetaPlatform
u8 content_attributes; ///< FsContentAttributes
} LoaderProgramAttributes;
/// Initialize ldr:shel.
Result ldrShellInitialize(void);
@ -62,8 +81,9 @@ Result ldrDmntSetProgramArguments(u64 program_id, const void *args, size_t args_
Result ldrDmntFlushArguments(void);
Result ldrDmntGetProcessModuleInfo(u64 pid, LoaderModuleInfo *out_module_infos, size_t max_out_modules, s32 *num_out);
Result ldrPmCreateProcess(u64 pin_id, u32 flags, Handle reslimit_h, Handle *out_process_h);
Result ldrPmGetProgramInfo(const NcmProgramLocation *loc, LoaderProgramInfo *out_program_info);
Result ldrPmCreateProcess(u64 pin_id, u32 flags, Handle reslimit_h, const LoaderProgramAttributes *attrs, Handle *out_process_h);
Result ldrPmGetProgramInfo(const NcmProgramLocation *loc, const LoaderProgramAttributes *attrs, LoaderProgramInfo *out_program_info); ///< [19.0.0+/Atmosphere]
Result ldrPmGetProgramInfoV1(const NcmProgramLocation *loc, LoaderProgramInfoV1 *out_program_info); ///< [1.0.0-18.1.0/Non-Atmosphere]
Result ldrPmPinProgram(const NcmProgramLocation *loc, u64 *out_pin_id);
Result ldrPmUnpinProgram(u64 pin_id);
Result ldrPmSetEnabledProgramVerification(bool enabled); ///< [10.0.0+]

View File

@ -113,6 +113,27 @@ typedef struct {
u8 unk_x57;
} MiiCharInfo;
typedef struct {
u8 data[0x44];
} MiiStoreData;
// Mii format used in 3DS (https://www.3dbrew.org/wiki/Mii#Mii_format).
typedef struct {
u8 data[0x5C];
} MiiVer3StoreData;
// Original Mii colors and types before Ver3StoreData conversion
typedef struct {
u8 faceline_color;
u8 hair_color;
u8 eye_color;
u8 eyebrow_color;
u8 mouth_color;
u8 beard_color;
u8 glass_color;
u8 glass_type;
} MiiNfpStoreDataExtension;
/// Initialize mii.
Result miiInitialize(MiiServiceType service_type);

View File

@ -20,7 +20,7 @@ typedef struct {
MiiCreateId create_id; ///< Mii's create ID.
u32 unk;
u16 mii_name[10+1]; ///< utf-16be, null-terminated
} PACKED MiiimgImageAttribute;
} NX_PACKED MiiimgImageAttribute;
/// Initialize miiimg.
Result miiimgInitialize(void);

View File

@ -83,6 +83,7 @@ Result ncmContentStorageRepairInvalidFileAttribute(NcmContentStorage* cs); ///<
Result ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(NcmContentStorage* cs, NcmRightsId* out_rights_id, const NcmPlaceHolderId* placeholder_id, const NcmContentId* cache_content_id, FsContentAttributes attr); ///< [8.0.0+]
Result ncmContentStorageRegisterPath(NcmContentStorage* cs, const NcmContentId* content_id, const char *path); ///< [13.0.0+]
Result ncmContentStorageClearRegisteredPath(NcmContentStorage* cs); ///< [13.0.0+]
Result ncmContentStorageGetProgramId(NcmContentStorage* cs, u64* out, const NcmContentId* content_id, FsContentAttributes attr); ///< [17.0.0+]
void ncmContentMetaDatabaseClose(NcmContentMetaDatabase* db);
Result ncmContentMetaDatabaseSet(NcmContentMetaDatabase* db, const NcmContentMetaKey* key, const void* data, u64 data_size);
@ -106,3 +107,4 @@ Result ncmContentMetaDatabaseListContentMetaInfo(NcmContentMetaDatabase* db, s32
Result ncmContentMetaDatabaseGetAttributes(NcmContentMetaDatabase* db, const NcmContentMetaKey* key, u8* out);
Result ncmContentMetaDatabaseGetRequiredApplicationVersion(NcmContentMetaDatabase* db, u32* out_version, const NcmContentMetaKey* key); ///< [2.0.0+]
Result ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(NcmContentMetaDatabase* db, NcmContentId* out_content_id, const NcmContentMetaKey* key, NcmContentType type, u8 id_offset); ///< [5.0.0+]
Result ncmContentMetaDatabaseGetPlatform(NcmContentMetaDatabase* db, u8* out, const NcmContentMetaKey* key); ///< [17.0.0+]

View File

@ -60,6 +60,11 @@ typedef enum {
NcmContentInstallType_Unknown = 7, ///< Unknown
} NcmContentInstallType;
/// ContentMetaPlatform
typedef enum {
NcmContentMetaPlatform_Nx = 0, ///< Nx
} NcmContentMetaPlatform;
/// ContentId
typedef struct {
u8 c[0x10]; ///< Id

View File

@ -24,9 +24,9 @@ typedef enum {
} NfcServiceType;
typedef enum {
NfpState_NonInitialized = 0,
NfpState_Initialized = 1,
} NfpState;
NfcState_NonInitialized = 0,
NfcState_Initialized = 1,
} NfcState;
typedef enum {
NfpDeviceState_Initialized = 0,
@ -35,51 +35,218 @@ typedef enum {
NfpDeviceState_TagRemoved = 3,
NfpDeviceState_TagMounted = 4,
NfpDeviceState_Unavailable = 5,
NfpDeviceState_Finalized = 6,
} NfpDeviceState;
typedef enum {
NfcDeviceState_Initialized = 0,
NfcDeviceState_SearchingForTag = 1,
NfcDeviceState_TagFound = 2,
NfcDeviceState_TagRemoved = 3,
NfcDeviceState_TagMounted = 4,
} NfcDeviceState;
typedef enum {
NfcMifareDeviceState_Initialized = 0,
NfcMifareDeviceState_SearchingForTag = 1,
NfcMifareDeviceState_TagFound = 2,
NfcMifareDeviceState_TagRemoved = 3,
NfcMifareDeviceState_TagMounted = 4,
NfcMifareDeviceState_Unavailable = 5,
} NfcMifareDeviceState;
typedef enum {
NfpApplicationAreaVersion_3DS = 0, ///< Application area created by a 3DS game.
NfpApplicationAreaVersion_WiiU = 1, ///< Application area created by a Wii U game.
NfpApplicationAreaVersion_3DSv2 = 2, ///< Application area created by a (new?) 3DS game.
NfpApplicationAreaVersion_Switch = 3, ///< Application area created by a Switch game.
NfpApplicationAreaVersion_Invalid = 0xFF, ///< Invalid value (application area not created).
} NfpApplicationAreaVersion;
typedef enum {
NfpDeviceType_Amiibo = 0,
} NfpDeviceType;
typedef enum {
NfpMountTarget_Rom = 1,
NfpMountTarget_Ram = 2,
NfpMountTarget_All = 3,
NfpMountTarget_Rom = BIT(0),
NfpMountTarget_Ram = BIT(1),
NfpMountTarget_All = NfpMountTarget_Rom | NfpMountTarget_Ram,
} NfpMountTarget;
typedef struct {
u8 uuid[10];
u8 uuid_length;
u8 reserved1[0x15];
u32 protocol;
u32 tag_type;
u8 reserved2[0x30];
} PACKED NfpTagInfo;
typedef enum {
NfcProtocol_None = 0,
NfcProtocol_TypeA = BIT(0), ///< ISO14443A
NfcProtocol_TypeB = BIT(1), ///< ISO14443B
NfcProtocol_TypeF = BIT(2), ///< Sony FeliCa
NfcProtocol_All = 0xFFFFFFFF,
} NfcProtocol;
typedef enum {
NfcTagType_None = 0,
NfcTagType_Type1 = BIT(0), ///< ISO14443A RW. Topaz
NfcTagType_Type2 = BIT(1), ///< ISO14443A RW. Ultralight, NTAGX, ST25TN
NfcTagType_Type3 = BIT(2), ///< ISO14443A RW/RO. Sony FeliCa
NfcTagType_Type4A = BIT(3), ///< ISO14443A RW/RO. DESFire
NfcTagType_Type4B = BIT(4), ///< ISO14443B RW/RO. DESFire
NfcTagType_Type5 = BIT(5), ///< ISO15693 RW/RO. SLI, SLIX, ST25TV
NfcTagType_Mifare = BIT(6), ///< Mifare clasic. Skylanders
NfcTagType_All = 0xFFFFFFFF,
} NfcTagType;
typedef enum {
NfcMifareCommand_Read = 0x30,
NfcMifareCommand_AuthA = 0x60,
NfcMifareCommand_AuthB = 0x61,
NfcMifareCommand_Write = 0xA0,
NfcMifareCommand_Transfer = 0xB0,
NfcMifareCommand_Decrement = 0xC0,
NfcMifareCommand_Increment = 0xC1,
NfcMifareCommand_Store = 0xC2,
} NfcMifareCommand;
typedef enum {
NfpAmiiboFlag_Valid = BIT(0), ///< Initialized in system settings.
NfpAmiiboFlag_ApplicationAreaExists = BIT(1), ///< Application area exists.
} NfpAmiiboFlag;
typedef enum {
NfpBreakType_Flush = 0,
NfpBreakType_Break1 = 1,
NfpBreakType_Break2 = 2,
} NfpBreakType;
typedef struct {
u16 last_write_year;
u8 last_write_month;
u8 last_write_day;
u16 year;
u8 month;
u8 day;
} NfpDate;
typedef struct {
u8 uid[10]; ///< UUID.
u8 uid_length; ///< UUID length.
u8 reserved[0x15];
} NfcTagUid;
typedef struct {
NfcTagUid uid; ///< UUID.
u32 protocol; ///< \ref NfcProtocol
u32 tag_type; ///< \ref NfcTagType
u8 reserved[0x30];
} NfpTagInfo;
typedef struct {
NfcTagUid uid; ///< UUID.
u32 protocol; ///< \ref NfcProtocol
u32 tag_type; ///< \ref NfcTagType
u8 reserved[0x30];
} NfcTagInfo;
typedef struct {
NfpDate last_write_date;
u16 write_counter;
u16 version;
u32 application_area_size;
u8 reserved[0x34];
} PACKED NfpCommonInfo;
u8 reserved[0x34];
} NfpCommonInfo;
typedef struct {
u8 amiibo_id[0x8];
u8 reserved[0x38];
} PACKED NfpModelInfo;
union {
u8 character_id[3];
struct {
u16 game_character_id;
u8 character_variant;
} NX_PACKED;
};
u8 series_id; ///< Series.
u16 numbering_id; ///< Model number.
u8 nfp_type; ///< Figure type.
u8 reserved[0x39];
} NfpModelInfo;
typedef struct {
MiiCharInfo mii;
u16 first_write_year;
u8 first_write_month;
u8 first_write_day;
char amiibo_name[10+1]; ///< utf-8, null-terminated
u8 reserved[0x99];
} PACKED NfpRegisterInfo;
NfpDate first_write_date;
char amiibo_name[(10*4)+1]; ///< Amiibo name (utf-8, null-terminated).
u8 font_region;
u8 reserved[0x7A];
} NfpRegisterInfo;
typedef struct {
MiiStoreData mii_store_data;
NfpDate first_write_date;
char amiibo_name[(10*4)+1]; ///< Amiibo name (utf-8, null-terminated).
u8 font_region;
u8 reserved[0x8E];
} NfpRegisterInfoPrivate;
typedef struct {
u64 application_id;
u32 access_id;
u16 crc32_change_counter;
u8 flags;
u8 tag_type;
u8 application_area_version;
u8 reserved[0x2F];
} NfpAdminInfo;
typedef struct {
u8 tag_magic; ///< Tag magic (always 0xA5: https://www.3dbrew.org/wiki/Amiibo#Page_layout).
u8 reserved1[0x1];
u16 tag_write_counter; ///< Incremented every tag write.
u32 crc32_1; ///< CRC32 of some internal 8-byte data.
u8 reserved2[0x38];
NfpDate last_write_date; ///< Updated every write.
u16 write_counter; ///< Incremented every write, until it maxes out at 0xFFFF.
u16 version; ///< Version.
u32 application_area_size; ///< Size of the application area.
u8 reserved3[0x34];
MiiVer3StoreData mii_v3; ///< Ver3StoreData (Mii format used in 3DS).
u8 pad[0x2];
u16 mii_v3_crc16; ///< CRC16 of Ver3StoreData.
MiiNfpStoreDataExtension mii_store_data_extension; ///< StoreDataExtension
NfpDate first_write_date; ///< Set when the amiibo is first written to.
u16 amiibo_name[10+1]; ///< Amiibo name (utf-16, null-terminated).
u8 font_region; ///< Font region.
u8 unknown1; ///< Normally zero
u32 crc32_2; ///< CRC32 of Ver3StoreData + application_id_byte + unknown1 + StoreDataExtension + unknown2 (0x7E bytes total)
u32 unknown2[0x5]; ///< Normally zero
u8 reserved4[0x64];
u64 application_id; ///< Modified application ID (Application ID & 0xFFFFFFFF0FFFFFFF | 0x30000000)
u32 access_id; ///< Application area access ID
u16 settings_crc32_change_counter;
u8 flags; ///< \ref NfpAmiiboFlag
u8 tag_type; ///< \ref NfcTagType
u8 application_area_version; ///< \ref NfpApplicationAreaVersion
u8 application_id_byte; ///< Application ID byte ((Application ID >> 28) & 0xFF)
u8 reserved5[0x2E];
u8 application_area[0xD8]; ///< Application area.
} NfpData;
typedef struct {
u8 mifare_command;
u8 unknown; ///< Usually 1
u8 reserved1[0x6];
u8 sector_key[0x6];
u8 reserved2[0x2];
} NX_PACKED NfcSectorKey;
typedef struct {
u8 sector_number;
u8 reserved[0x7];
NfcSectorKey sector_key;
} NX_PACKED NfcMifareReadBlockParameter;
typedef struct {
u8 data[0x10];
u8 sector_number;
u8 reserved[0x7];
} NX_PACKED NfcMifareReadBlockData;
typedef struct {
u8 data[0x10];
u8 sector_number;
u8 reserved[0x7];
NfcSectorKey sector_key;
} NfcMifareWriteBlockParameter;
typedef struct {
u64 version;
@ -103,6 +270,12 @@ Result nfcInitialize(NfcServiceType service_type);
/// Exit nfc:*.
void nfcExit(void);
/// Initialize nfc:mf:u.
Result nfcMfInitialize();
/// Exit nfc:mf:u.
void nfcMfExit(void);
/// Gets the Service object for the actual nfp:* service session.
Service* nfpGetServiceSession(void);
@ -115,47 +288,179 @@ Service* nfcGetServiceSession(void);
/// Gets the Service object for the interface from nfc:*.
Service* nfcGetServiceSession_Interface(void);
/// Gets the Service object for the actual nfc:mf:u service session.
Service* nfcMfGetServiceSession(void);
/// Gets the Service object for the interface from nfc:mf:u.
Service* nfcMfGetServiceSession_Interface(void);
Result nfpListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count);
Result nfpStartDetection(const NfcDeviceHandle *handle);
Result nfpStopDetection(const NfcDeviceHandle *handle);
Result nfpMount(const NfcDeviceHandle *handle, NfpDeviceType device_type, NfpMountTarget mount_target);
Result nfpUnmount(const NfcDeviceHandle *handle);
/// Only available with [4.0.0+].
Result nfcListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count);
/// Only available with [4.0.0+].
Result nfcStartDetection(const NfcDeviceHandle *handle, NfcProtocol protocol);
/// Only available with [4.0.0+].
Result nfcStopDetection(const NfcDeviceHandle *handle);
Result nfcMfListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count);
Result nfcMfStartDetection(const NfcDeviceHandle *handle);
Result nfcMfStopDetection(const NfcDeviceHandle *handle);
/// Not available with ::NfpServiceType_System.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpOpenApplicationArea(const NfcDeviceHandle *handle, u32 app_id);
/// Not available with ::NfpServiceType_System.
Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void* buf, size_t buf_size);
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram, and the application area to be opened.
Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void* buf, size_t buf_size, u32 *out_size);
/// Not available with ::NfpServiceType_System.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram, and the application area to be opened.
Result nfpSetApplicationArea(const NfcDeviceHandle *handle, const void* buf, size_t buf_size);
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpFlush(const NfcDeviceHandle *handle);
Result nfpRestore(const NfcDeviceHandle *handle);
/// Not available with ::NfpServiceType_System.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpCreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void* buf, size_t buf_size);
/// Not available with ::NfpServiceType_System.
/// Only available with [3.0.0+].
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram, and the application area to be opened.
Result nfpRecreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void* buf, size_t buf_size);
/// Not available with ::NfpServiceType_System.
Result nfpGetApplicationAreaSize(const NfcDeviceHandle *handle, u32 *out_app_area_size);
/// Not available with ::NfpServiceType_User.
Result nfpDeleteApplicationArea(const NfcDeviceHandle *handle);
/// Not available with ::NfpServiceType_User.
Result nfpExistsApplicationArea(const NfcDeviceHandle *handle, bool *out);
Result nfpGetTagInfo(const NfcDeviceHandle *handle, NfpTagInfo *out);
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpGetRegisterInfo(const NfcDeviceHandle *handle, NfpRegisterInfo *out);
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpGetCommonInfo(const NfcDeviceHandle *handle, NfpCommonInfo *out);
/// Requires the amiibo to be mounted with ::NfpMountTarget_Rom.
Result nfpGetModelInfo(const NfcDeviceHandle *handle, NfpModelInfo *out);
/// Not available with ::NfpServiceType_User.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpGetAdminInfo(const NfcDeviceHandle *handle, NfpAdminInfo *out);
/// Only available with [4.0.0+].
Result nfcGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out);
Result nfcMfGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out);
/// Returned event will have autoclear off.
Result nfpAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event);
/// Returned event will have autoclear off.
Result nfpAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event);
Result nfpGetState(NfpState *out);
/// Returned event will have autoclear off.
/// Only available with [4.0.0+].
Result nfcAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event);
/// Returned event will have autoclear off.
/// Only available with [4.0.0+].
Result nfcAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event);
/// Returned event will have autoclear off.
Result nfcMfAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event);
/// Returned event will have autoclear off.
Result nfcMfAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event);
Result nfpGetState(NfcState *out);
Result nfpGetDeviceState(const NfcDeviceHandle *handle, NfpDeviceState *out);
Result nfpGetNpadId(const NfcDeviceHandle *handle, u32 *out);
/// Only available with [4.0.0+].
Result nfcGetState(NfcState *out);
/// Only available with [4.0.0+].
Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out);
/// Only available with [4.0.0+].
Result nfcGetNpadId(const NfcDeviceHandle *handle, u32 *out);
Result nfcMfGetState(NfcState *out);
Result nfcMfGetDeviceState(const NfcDeviceHandle *handle, NfcMifareDeviceState *out);
Result nfcMfGetNpadId(const NfcDeviceHandle *handle, u32 *out);
/// Returned event will have autoclear on.
/// Only available with [3.0.0+].
Result nfpAttachAvailabilityChangeEvent(Event *out_event);
/// Returned event will have autoclear on.
/// Only available with [4.0.0+].
Result nfcAttachAvailabilityChangeEvent(Event *out_event);
/// Returned event will have autoclear on.
Result nfcMfAttachAvailabilityChangeEvent(Event *out_event);
/// Not available with ::NfpServiceType_User.
Result nfpFormat(const NfcDeviceHandle *handle);
/// Not available with ::NfpServiceType_User.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpGetRegisterInfoPrivate(const NfcDeviceHandle *handle, NfpRegisterInfoPrivate *out);
/// Not available with ::NfpServiceType_User.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpSetRegisterInfoPrivate(const NfcDeviceHandle *handle, const NfpRegisterInfoPrivate *register_info_private);
/// Not available with ::NfpServiceType_User.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpDeleteRegisterInfo(const NfcDeviceHandle *handle);
/// Only available with ::NfpServiceType_Debug.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpGetAll(const NfcDeviceHandle *handle, NfpData *out);
/// Only available with ::NfpServiceType_Debug.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpSetAll(const NfcDeviceHandle *handle, const NfpData *nfp_data);
/// Only available with ::NfpServiceType_Debug.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpFlushDebug(const NfcDeviceHandle *handle);
/// Only available with ::NfpServiceType_Debug.
/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
Result nfpBreakTag(const NfcDeviceHandle *handle, NfpBreakType break_type);
/// Only available with ::NfpServiceType_Debug.
Result nfpReadBackupData(const NfcDeviceHandle *handle, void* out_buf, size_t buf_size, u32 *out_size);
/// Only available with ::NfpServiceType_Debug.
Result nfpWriteBackupData(const NfcDeviceHandle *handle, const void* buf, size_t buf_size);
/// Only available with ::NfpServiceType_Debug.
Result nfpWriteNtf(const NfcDeviceHandle *handle, u32 write_type, const void* buf, size_t buf_size);
/// This uses nfc:*.
Result nfcIsNfcEnabled(bool *out);
/// Only available with [4.0.0+].
Result nfcReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count);
/// Only available with [4.0.0+].
Result nfcWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count);
Result nfcMfReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count);
Result nfcMfWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count);
/// Only available with [4.0.0+].
Result nfcSendCommandByPassThrough(const NfcDeviceHandle *handle, u64 timeout, const void* cmd_buf, size_t cmd_buf_size, void* reply_buf, size_t reply_buf_size, u64 *out_size);
/// Only available with [4.0.0+].
Result nfcKeepPassThroughSession(const NfcDeviceHandle *handle);
/// Only available with [4.0.0+].
Result nfcReleasePassThroughSession(const NfcDeviceHandle *handle);

View File

@ -771,6 +771,18 @@ Result nsIsAnyApplicationEntityInstalled(u64 application_id, bool *out);
*/
Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid);
/**
* @brief EstimateSizeToMove
* @note Only available on [10.0.0+].
* @param[in] storage_ids Array of u8 \ref NcmStorageId.
* @param[in] count Size of the storage_ids array in entries.
* @param[in] storage_id storage_id \ref NcmStorageId
* @param[in] flags Flags
* @param[in] application_id ApplicationId.
* @param[out] Out Output value.
*/
Result nsEstimateSizeToMove(u8 *storage_ids, s32 count, NcmStorageId storage_id, u32 flags, u64 application_id, s64 *out);
/**
* @brief FormatSdCard
* @note Only available on [2.0.0+].
@ -1327,8 +1339,8 @@ Result nsdevGetShellEventInfo(NsShellEventInfo* out); ///< [1.0.0-9.2.0]
Result nsdevTerminateApplication(void);
Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* path, size_t path_len); ///< [1.0.0-9.2.0]
Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 flags); ///< [1.0.0-9.2.0]
Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags); ///< [10.0.0+]
Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id);
Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags); ///< [10.0.0-17.0.1]
Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id); ///< [1.0.0-17.0.1]
Result nsdevIsSystemMemoryResourceLimitBoosted(bool* out); ///< [6.0.0-8.1.0]
Result nsdevGetRunningApplicationProcessIdForDevelop(u64* out_pid); ///< [6.0.0+]
Result nsdevSetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop(bool can_be_active); ///< [6.0.0+]

View File

@ -9,6 +9,15 @@
#include "../sf/service.h"
#include "../kernel/event.h"
/// NvServiceType, for __nx_nv_service_type.
typedef enum {
NvServiceType_Auto = -1, ///< This is the default. Automatically select the type using \ref appletGetAppletType.
NvServiceType_Application = 0, ///< Initializes nvdrv.
NvServiceType_Applet = 1, ///< Initializes nvdrv:a.
NvServiceType_System = 2, ///< Initializes nvdrv:s.
NvServiceType_Factory = 3, ///< Initializes nvdrv:t.
} NvServiceType;
/// Initialize nvdrv*.
Result nvInitialize(void);

View File

@ -7,8 +7,15 @@
#pragma once
#include "../types.h"
#include "../kernel/event.h"
#include "../sf/service.h"
typedef struct {
u8 rating_age;
bool sns_post_restriction;
bool free_communication_restriction;
} PctlRestrictionSettings;
/// Initialize pctl.
Result pctlInitialize(void);
@ -21,15 +28,41 @@ Service* pctlGetServiceSession(void);
/// Gets the Service object for IParentalControlService.
Service* pctlGetServiceSession_Service(void);
/// Gets whether Parental Controls restrictions are temporarily unlocked.
Result pctlIsRestrictionTemporaryUnlocked(bool *flag);
/// Confirm whether VrMode is allowed. Only available with [4.0.0+].
Result pctlConfirmStereoVisionPermission(void);
/// Gets whether Parental Controls are enabled.
Result pctlIsRestrictionEnabled(bool *flag);
/// Gets whether Parental Controls are enabled.
Result pctlGetSafetyLevel(u32 *safety_level);
/// Returns the current restrictions settings.
Result pctlGetCurrentSettings(PctlRestrictionSettings *settings);
/// Gets the count of applications that have free communication.
Result pctlGetFreeCommunicationApplicationListCount(u32 *count);
/// Reset the confirmation done by \ref pctlConfirmStereoVisionPermission. Only available with [5.0.0+].
Result pctlResetConfirmedStereoVisionPermission(void);
/// Gets whether VrMode is allowed. Only available with [5.0.0+].
Result pctlIsStereoVisionPermitted(bool *flag);
/// Confirm whether pairing is active.
Result pctlIsPairingActive(bool *flag);
/// Returns the synchronization event.
Result pctlGetSynchronizationEvent(Event* out_event);
/// Returns the supension event.
Result pctlGetPlayTimerEventToRequestSuspension(Event* out_event);
/// Confirm whether play timer alarm is disabled. Only available with [4.0.0+].
Result pctlIsPlayTimerAlarmDisabled(bool *flag);
/// Returns the unlinked event.
Result pctlGetUnlinkedEvent(Event* out_event);

View File

@ -191,6 +191,13 @@ typedef enum {
PcvModuleId_EXTPERIPH2 = 0x40000057,
} PcvModuleId;
// Clock list type returned by GetPossibleClockRates
typedef enum {
PcvClockRatesListType_Invalid = 0,
PcvClockRatesListType_Discrete = 1,
PcvClockRatesListType_Range = 2,
} PcvClockRatesListType;
/// Initialize pcv.
Result pcvInitialize(void);
@ -210,3 +217,5 @@ Result pcvSetClockRate(PcvModule module, u32 hz);
Result pcvSetVoltageEnabled(u32 power_domain, bool state);
/// Only available on [1.0.0-7.0.1].
Result pcvGetVoltageEnabled(bool *isEnabled, u32 power_domain);
/// Only available on [1.0.0-7.0.1].
Result pcvGetPossibleClockRates(PcvModule module, u32 *rates, s32 max_count, PcvClockRatesListType *out_type, s32 *out_count);

View File

@ -31,7 +31,7 @@ typedef enum {
SetSysProductModel_Iowa = 3, ///< Mariko Model
SetSysProductModel_Hoag = 4, ///< Mariko Lite Model
SetSysProductModel_Calcio = 5, ///< Mariko "Simulation" Model
SetSysProductModel_Aula = 6, ///< Mariko Pro Model(?)
SetSysProductModel_Aula = 6, ///< Mariko OLED Model
} SetSysProductModel;
/// IDs for Language.
@ -312,7 +312,7 @@ typedef struct {
/// BluetoothDevicesSettings
typedef struct {
BtdrvAddress addr; ///< \ref BtdrvAddress
BtmBdName name; ///< BdName. Unused on 13.0.0+
BtmBdName name; ///< [1.0.0-12.1.0] BdName. On 13.0.0+ name2 is used instead.
BtmClassOfDevice class_of_device; ///< ClassOfDevice
u8 link_key[0x10]; ///< LinkKey
u8 link_key_present; ///< LinkKeyPresent
@ -328,14 +328,11 @@ typedef struct {
u8 device_type; ///< DeviceType
u16 brr_size; ///< BrrSize
u8 brr[0x9]; ///< Brr
union {
u8 reserved[0x12B]; ///< Reserved [1.0.0-12.1.0]
struct {
u8 pad; ///< Padding
char name2[0xF9]; ///< Name
}; ///< [13.0.0+]
};
u8 audio_source_volume; ///< [13.0.0+] AudioSourceVolume
char name2[0xF9]; ///< [13.0.0+] Name
u8 audio_sink_volume; ///< [15.0.0+] AudioSinkVolume
u32 audio_flags; ///< [14.0.0+] AudioFlags
u8 reserved[0x2C]; ///< Reserved
} SetSysBluetoothDevicesSettings;
/// Structure returned by \ref setsysGetFirmwareVersion.
@ -440,8 +437,8 @@ typedef struct {
u8 vertical_active_lines_msb : 4;
u8 horizontal_sync_offset_pixels_lsb;
u8 horizontal_sync_pulse_width_pixels_lsb;
u8 horizontal_sync_pulse_width_lines_lsb : 4;
u8 horizontal_sync_offset_lines_lsb : 4;
u8 vertical_sync_pulse_width_lines_lsb : 4;
u8 vertical_sync_offset_lines_lsb : 4;
u8 vertical_sync_pulse_width_lines_msb : 2;
u8 vertical_sync_offset_lines_msb : 2;
u8 horizontal_sync_pulse_width_pixels_msb : 2;
@ -468,7 +465,7 @@ typedef struct {
u8 svd_index : 7;
u8 native_flag : 1;
} svd[0xC];
} PACKED video;
} NX_PACKED video;
struct {
u8 size : 5;
SetSysBlockType block_type : 3;
@ -477,7 +474,7 @@ typedef struct {
u8 padding1 : 1;
u8 sampling_rates_bitmap;
u8 bitrate;
} PACKED audio;
} NX_PACKED audio;
struct {
u8 size : 5;
SetSysBlockType block_type : 3;
@ -486,7 +483,7 @@ typedef struct {
u8 mode_bitmap;
u8 max_tmds_frequency;
u8 latency_bitmap;
} PACKED vendor_specific;
} NX_PACKED vendor_specific;
u8 padding[2];
} SetSysDataBlock;
@ -497,7 +494,7 @@ typedef struct {
u16 product_code;
u32 serial_number;
u8 manufacture_week;
u8 manufacture_year;
u8 manufacture_year; ///< Real value is val - 10.
u8 edid_version;
u8 edid_revision;
u8 video_input_parameters_bitmap;
@ -560,6 +557,8 @@ typedef struct {
SetSysModeLine extended_timing_descriptor[5];
u8 padding[5];
u8 extended_checksum; ///< Sum of 128 extended bytes should equal 0 mod 256.
u8 data2[0x80]; ///< [13.0.0+]
u8 data3[0x80]; ///< [13.0.0+]
} SetSysEdid;
/// DataDeletionSettings

View File

@ -7,6 +7,7 @@
#pragma once
#include "../types.h"
#include "../kernel/event.h"
#include "../sf/service.h"
#define SPL_RSA_BUFFER_SIZE (0x100)

View File

@ -180,6 +180,7 @@ typedef enum {
/// PrivateOptionType
typedef enum {
SslPrivateOptionType_DtlsSession = 1, ///< \ref sslConnectionSetSessionCacheMode will throw an error if the input ::SslSessionCacheMode is non-zero and this option flag is set.
SslPrivateOptionType_SetCipher = 2, ///< [17.0.0+] This exclusively enables the cipher suite specified in the input u32 value passed to \ref sslConnectionSetPrivateOption (all other ciphers disabled).
} SslPrivateOptionType;
/// AlpnProtoState
@ -747,9 +748,9 @@ Result sslConnectionGetDtlsHandshakeTimeout(SslConnection *c, u64 *out);
* @note Only available on [16.0.0+].
* @param c \ref SslConnection
* @param[in] option \ref SslPrivateOptionType
* @param[in] flag Input flag value.
* @param[in] value Input value.
*/
Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, bool flag);
Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, u32 value);
/**
* @brief SetSrtpCiphers

View File

@ -14,6 +14,15 @@ typedef enum {
TsLocation_External = 1, ///< TMP451 External: SoC
} TsLocation;
typedef enum {
TsDeviceCode_LocationInternal = 0x41000001u,
TsDeviceCode_LocationExternal = 0x41000002u,
} TsDeviceCode;
typedef struct {
Service s;
} TsSession;
/// Initialize ts.
Result tsInitialize(void);
@ -45,3 +54,7 @@ Result tsGetTemperature(TsLocation location, s32 *temperature);
*/
Result tsGetTemperatureMilliC(TsLocation location, s32 *temperature);
Result tsOpenSession(TsSession *s, u32 device_code); ///< [8.0.0+]
Result tsSessionGetTemperature(TsSession *s, float *temperature); ///< [10.0.0+]
void tsSessionClose(TsSession *s);

View File

@ -54,6 +54,7 @@ Service* uartGetServiceSession(void);
/**
* @brief HasPort
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPort
* @param[out] out Output success flag.
*/
@ -61,6 +62,7 @@ Result uartHasPort(UartPort port, bool *out);
/**
* @brief HasPortForDev
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPortForDev
* @param[out] out Output success flag.
*/
@ -68,6 +70,7 @@ Result uartHasPortForDev(UartPortForDev port, bool *out);
/**
* @brief IsSupportedBaudRate
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPort
* @param[in] baud_rate BaudRate
* @param[out] out Output success flag.
@ -76,6 +79,7 @@ Result uartIsSupportedBaudRate(UartPort port, u32 baud_rate, bool *out);
/**
* @brief IsSupportedBaudRateForDev
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPortForDev
* @param[in] baud_rate BaudRate
* @param[out] out Output success flag.
@ -84,6 +88,7 @@ Result uartIsSupportedBaudRateForDev(UartPortForDev port, u32 baud_rate, bool *o
/**
* @brief IsSupportedFlowControlMode
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPort
* @param[in] flow_control_mode \ref UartFlowControlMode
* @param[out] out Output success flag.
@ -92,6 +97,7 @@ Result uartIsSupportedFlowControlMode(UartPort port, UartFlowControlMode flow_co
/**
* @brief IsSupportedFlowControlModeForDev
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPortForDev
* @param[in] flow_control_mode \ref UartFlowControlMode
* @param[out] out Output success flag.
@ -107,6 +113,7 @@ Result uartCreatePortSession(UartPortSession *s);
/**
* @brief IsSupportedPortEvent
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPort
* @param[in] port_event_type \ref UartPortEventType
* @param[out] out Output success flag.
@ -115,6 +122,7 @@ Result uartIsSupportedPortEvent(UartPort port, UartPortEventType port_event_type
/**
* @brief IsSupportedPortEventForDev
* @note Only available on [1.0.0-16.1.0].
* @param[in] port \ref UartPortForDev
* @param[in] port_event_type \ref UartPortEventType
* @param[out] out Output success flag.
@ -123,7 +131,7 @@ Result uartIsSupportedPortEventForDev(UartPortForDev port, UartPortEventType por
/**
* @brief IsSupportedDeviceVariation
* @note Only available on [7.0.0+].
* @note Only available on [7.0.0-16.1.0].
* @param[in] port \ref UartPort
* @param[in] device_variation DeviceVariation
* @param[out] out Output success flag.
@ -132,7 +140,7 @@ Result uartIsSupportedDeviceVariation(UartPort port, u32 device_variation, bool
/**
* @brief IsSupportedDeviceVariationForDev
* @note Only available on [7.0.0+].
* @note Only available on [7.0.0-16.1.0].
* @param[in] port \ref UartPortForDev
* @param[in] device_variation DeviceVariation
* @param[out] out Output success flag.

View File

@ -29,7 +29,7 @@ struct usb_endpoint_descriptor {
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
} PACKED;
} NX_PACKED;
/// Imported from libusb, with some adjustments.
struct usb_interface_descriptor {
@ -72,7 +72,7 @@ struct usb_config_descriptor {
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t MaxPower;
} PACKED;
} NX_PACKED;
/// Imported from libusb, with some adjustments.
struct usb_ss_endpoint_companion_descriptor {

View File

@ -60,7 +60,7 @@ typedef struct {
u8 pad_x155[0x6];
struct usb_ss_endpoint_companion_descriptor output_ss_endpoint_companion_descs[15]; ///< ?
u8 pad_x1b5[0x3];
} PACKED UsbHsInterfaceInfo;
} NX_PACKED UsbHsInterfaceInfo;
/// Interface struct. Note that devices have a seperate \ref UsbHsInterface for each interface.
typedef struct {
@ -75,7 +75,7 @@ typedef struct {
u8 pad_x21b[0x5];
u64 timestamp; ///< Unknown u64 timestamp for when the device was inserted?
} PACKED UsbHsInterface;
} NX_PACKED UsbHsInterface;
typedef struct {
u32 xferId;

View File

@ -6,6 +6,7 @@
* @copyright libnx Authors
*/
#pragma once
#include <assert.h>
#include "hipc.h"
#include "cmif.h"
@ -473,14 +474,45 @@ NX_INLINE Result serviceDispatchImpl(
return rc;
}
#ifndef __cplusplus
#define serviceMacroDetectIsSameType(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
#define serviceMacroDetectIsPointerOrArray(p) (__builtin_classify_type(p) == 5)
#define serviceMacroDecay(p) (&*__builtin_choose_expr(serviceMacroDetectIsPointerOrArray(p), p, NULL))
#define serviceMacroDetectIsPointer(p) serviceMacroDetectIsSameType(p, serviceMacroDecay(p))
#else
extern "C++" {
namespace libnx::impl {
template<typename T> struct is_pointer { static constexpr bool value = false; };
template<typename T> struct is_pointer<T*> { static constexpr bool value = true; };
template<typename T> struct is_pointer<T* const> { static constexpr bool value = true; };
template<typename T> struct is_pointer<T* volatile> { static constexpr bool value = true; };
template<typename T> struct is_pointer<T* const volatile> { static constexpr bool value = true; };
}
}
#define serviceMacroDetectIsPointer(p) (::libnx::impl::is_pointer<decltype(p)>::value)
#endif
#define serviceDispatch(_s,_rid,...) \
serviceDispatchImpl((_s),(_rid),NULL,0,NULL,0,(SfDispatchParams){ __VA_ARGS__ })
#define serviceDispatchIn(_s,_rid,_in,...) \
serviceDispatchImpl((_s),(_rid),&(_in),sizeof(_in),NULL,0,(SfDispatchParams){ __VA_ARGS__ })
({ static_assert(!(serviceMacroDetectIsPointer(_in))); \
serviceDispatchImpl((_s),(_rid),&(_in),sizeof(_in),NULL,0,(SfDispatchParams){ __VA_ARGS__ }); })
#define serviceDispatchOut(_s,_rid,_out,...) \
serviceDispatchImpl((_s),(_rid),NULL,0,&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ })
({ static_assert(!(serviceMacroDetectIsPointer(_out))); \
serviceDispatchImpl((_s),(_rid),NULL,0,&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ }); })
#define serviceDispatchInOut(_s,_rid,_in,_out,...) \
serviceDispatchImpl((_s),(_rid),&(_in),sizeof(_in),&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ })
({ static_assert(!(serviceMacroDetectIsPointer(_in))); \
static_assert(!(serviceMacroDetectIsPointer(_out))); \
serviceDispatchImpl((_s),(_rid),&(_in),sizeof(_in),&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ }); })

View File

@ -59,26 +59,26 @@ typedef struct { float value[3]; } UtilFloat3; ///< 3 floats.
#endif
/// Packs a struct so that it won't include padding bytes.
#ifndef PACKED
#define PACKED __attribute__((packed))
#ifndef NX_PACKED
#define NX_PACKED __attribute__((packed))
#endif
/// Marks a function as not returning, for the purposes of compiler optimization.
#ifndef NORETURN
#define NORETURN __attribute__((noreturn))
#ifndef NX_NORETURN
#define NX_NORETURN __attribute__((noreturn))
#endif
/// Performs a dummy operation on the specified argument in order to silence compiler warnings about unused arguments.
#ifndef IGNORE_ARG
#define IGNORE_ARG(x) (void)(x)
#ifndef NX_IGNORE_ARG
#define NX_IGNORE_ARG(x) (void)(x)
#endif
/// Flags a function as deprecated.
#ifndef DEPRECATED
#ifndef NX_DEPRECATED
#ifndef LIBNX_NO_DEPRECATION
#define DEPRECATED __attribute__ ((deprecated))
#define NX_DEPRECATED __attribute__ ((deprecated))
#else
#define DEPRECATED
#define NX_DEPRECATED
#endif
#endif

View File

@ -553,7 +553,7 @@ Result swkbdInlineGetImage(SwkbdInline* s, void* buffer, u64 size, bool *data_av
if (!buffer || !size) return MAKERESULT(Module_Libnx, LibnxError_BadInput);
if (_swkbdInlineHandleFinished(s)) {
data_available = false;
*data_available = false;
return 0;
}

View File

@ -261,8 +261,9 @@ static inline void _aes128CbcDecryptBlocks(Aes128CbcContext *ctx, u8 *dst_u8, co
AES_ENC_DEC_INPUT_ROUND_KEY(10)
);
/* Update IV. */
cur_iv = tmp0;
/* Do XOR for CBC. */
tmp0 = veorq_u8(tmp0, cur_iv);
cur_iv = block0;
/* Store to output. */
vst1q_u8(dst_u8, tmp0);
@ -478,8 +479,9 @@ static inline void _aes192CbcDecryptBlocks(Aes192CbcContext *ctx, u8 *dst_u8, co
AES_ENC_DEC_INPUT_ROUND_KEY(12)
);
/* Update IV. */
cur_iv = tmp0;
/* Do XOR for CBC. */
tmp0 = veorq_u8(tmp0, cur_iv);
cur_iv = block0;
/* Store to output. */
vst1q_u8(dst_u8, tmp0);
@ -711,8 +713,9 @@ static inline void _aes256CbcDecryptBlocks(Aes256CbcContext *ctx, u8 *dst_u8, co
AES_ENC_DEC_INPUT_ROUND_KEY(14)
);
/* Update IV. */
cur_iv = tmp0;
/* Do XOR for CBC. */
tmp0 = veorq_u8(tmp0, cur_iv);
cur_iv = block0;
/* Store to output. */
vst1q_u8(dst_u8, tmp0);

View File

@ -163,7 +163,7 @@ static void _sha256ProcessBlocks(Sha256Context *ctx, const u8 *src_u8, size_t nu
[cur_hash0]"+w"(cur_hash0), [cur_hash1]"+w"(cur_hash1),
[prev_hash0]"+w"(prev_hash0), [prev_hash1]"+w"(prev_hash1),
[tmp_hash]"=w"(tmp_hash), [src_u8]"+r"(src_u8)
: [round_constants]"r"(s_roundConstants)
: "m"(*(const u8 (*)[num_blocks*SHA256_BLOCK_SIZE])src_u8), [round_constants]"r"(s_roundConstants)
:
);

View File

@ -27,6 +27,19 @@ static Result _nwindowConnect(NWindow* nw)
return rc;
}
static Result _nwindowCancelBuffer(NWindow* nw, s32 slot, const NvMultiFence* fence)
{
static const NvMultiFence s_emptyFence = {0};
if (!fence)
fence = &s_emptyFence;
Result rc = bqCancelBuffer(&nw->bq, slot, fence);
if (R_SUCCEEDED(rc))
nw->cur_slot = -1;
return rc;
}
static Result _nwindowDisconnect(NWindow* nw)
{
Result rc = bqDisconnect(&nw->bq, NATIVE_WINDOW_API_CPU);
@ -267,13 +280,7 @@ Result nwindowCancelBuffer(NWindow* nw, s32 slot, const NvMultiFence* fence)
return MAKERESULT(Module_Libnx, LibnxError_BadGfxQueueBuffer);
}
static const NvMultiFence s_emptyFence = {0};
if (!fence)
fence = &s_emptyFence;
Result rc = bqCancelBuffer(&nw->bq, slot, fence);
if (R_SUCCEEDED(rc))
nw->cur_slot = -1;
Result rc = _nwindowCancelBuffer(nw, slot, fence);
mutexUnlock(&nw->mutex);
return rc;
@ -323,8 +330,9 @@ Result nwindowReleaseBuffers(NWindow* nw)
mutexLock(&nw->mutex);
if (nw->cur_slot >= 0)
rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
else if (nw->is_connected && nw->slots_configured)
rc = _nwindowCancelBuffer(nw, nw->cur_slot, NULL);
if (R_SUCCEEDED(rc) && nw->is_connected && nw->slots_configured)
rc = _nwindowDisconnect(nw);
mutexUnlock(&nw->mutex);

View File

@ -23,6 +23,21 @@ typedef struct {
void* tls_tp; // !! Offset needs to be TLS+0x1F8 for __aarch64_read_tp !!
} ThreadVars;
extern const u8 __tdata_lma[];
extern const u8 __tdata_lma_end[];
extern u8 __tls_start[];
extern u8 __tls_end[];
extern size_t __tls_align;
static inline ThreadVars* getThreadVars(void) {
return (ThreadVars*)((u8*)armGetTls() + 0x200 - sizeof(ThreadVars));
}
NX_INLINE size_t getTlsStartOffset(void)
{
// TLS region begins with the Thread Control Block (TCB), which is intended
// to contain two pointers. The actual tdata/tbss segment follows the TCB,
// however if it requires special alignment the offset is rounded up.
size_t tcb_sz = 2*sizeof(void*);
return __tls_align > tcb_sz ? __tls_align : tcb_sz;
}

View File

@ -514,7 +514,7 @@ SVC_BEGIN svcQueryPhysicalAddress
ret
SVC_END
SVC_BEGIN svcQueryIoMapping
SVC_BEGIN svcQueryMemoryMapping
stp x0, x1, [sp, #-16]!
svc 0x55
ldp x3, x4, [sp], #16
@ -799,12 +799,12 @@ SVC_BEGIN svcCallSecureMonitor
ret
SVC_END
SVC_BEGIN svcMapInsecureMemory
SVC_BEGIN svcMapInsecurePhysicalMemory
svc 0x90
ret
SVC_END
SVC_BEGIN svcUnmapInsecureMemory
SVC_BEGIN svcUnmapInsecurePhysicalMemory
svc 0x91
ret
SVC_END

View File

@ -16,11 +16,6 @@
#define USER_TLS_END (0x200 - sizeof(ThreadVars))
#define NUM_TLS_SLOTS ((USER_TLS_END - USER_TLS_BEGIN) / sizeof(void*))
extern const u8 __tdata_lma[];
extern const u8 __tdata_lma_end[];
extern u8 __tls_start[];
extern u8 __tls_end[];
static Mutex g_threadMutex;
static Thread* g_threadList;
@ -45,7 +40,7 @@ static void _EntryWrap(ThreadEntryArgs* args) {
tv->magic = THREADVARS_MAGIC;
tv->thread_ptr = args->t;
tv->reent = args->reent;
tv->tls_tp = (u8*)args->tls-2*sizeof(void*); // subtract size of Thread Control Block (TCB)
tv->tls_tp = (u8*)args->tls-getTlsStartOffset();
tv->handle = args->t->handle;
// Initialize thread info
@ -94,28 +89,35 @@ Result threadCreate(
Thread* t, ThreadFunc entry, void* arg, void* stack_mem, size_t stack_sz,
int prio, int cpuid)
{
const size_t tls_sz = (__tls_end-__tls_start+0xF) &~ 0xF;
const size_t reent_sz = (sizeof(struct _reent)+0xF) &~ 0xF;
const size_t tls_sz = (__tls_end-__tls_start+0xF) &~ 0xF;
// Verify stack size alignment
if (stack_sz & 0xFFF) {
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
}
bool owns_stack_mem;
if (stack_mem == NULL) {
// Allocate new memory, stack then reent then tls.
stack_mem = __libnx_aligned_alloc(0x1000, stack_sz + reent_sz + tls_sz);
// Allocate new memory for the stack, tls and reent.
stack_mem = __libnx_aligned_alloc(0x1000, stack_sz + tls_sz + reent_sz);
owns_stack_mem = true;
} else {
// Use provided memory for stack, reent, and tls.
if (((uintptr_t)stack_mem & 0xFFF) || (stack_sz & 0xFFF)) {
// Verify alignment of provided memory.
if ((uintptr_t)stack_mem & 0xFFF) {
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
}
// Ensure we don't go out of bounds.
if (stack_sz <= tls_sz + reent_sz) {
size_t align_mask = getTlsStartOffset()-1;
size_t needed_sz = (tls_sz + reent_sz + align_mask) &~ align_mask;
if (stack_sz <= needed_sz + sizeof(ThreadEntryArgs)) {
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
}
stack_sz -= tls_sz + reent_sz;
// Use provided memory for the stack, tls and reent.
stack_sz -= needed_sz;
owns_stack_mem = false;
}
@ -123,9 +125,9 @@ Result threadCreate(
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
}
// Stack size may be unaligned in either case.
// Total allocation size may be unaligned in either case.
virtmemLock();
const size_t aligned_stack_sz = (stack_sz + tls_sz + reent_sz +0xFFF) & ~0xFFF;
const size_t aligned_stack_sz = (stack_sz + tls_sz + reent_sz + 0xFFF) & ~0xFFF;
void* stack_mirror = virtmemFindStack(aligned_stack_sz, 0x4000);
Result rc = svcMapMemory(stack_mirror, stack_mem, aligned_stack_sz);
virtmemUnlock();
@ -134,8 +136,9 @@ Result threadCreate(
{
uintptr_t stack_top = (uintptr_t)stack_mirror + stack_sz - sizeof(ThreadEntryArgs);
ThreadEntryArgs* args = (ThreadEntryArgs*) stack_top;
void *reent = (void*)((uintptr_t)stack_mirror + stack_sz);
void *tls = (void*)((uintptr_t)reent + reent_sz);
void *tls = (void*)((uintptr_t)stack_mirror + stack_sz);
void *reent = (void*)((uintptr_t)tls + tls_sz);
Handle handle;
t->handle = INVALID_HANDLE;

View File

@ -160,6 +160,13 @@ void virtmemSetup(void) {
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_WeirdKernel));
}
// Account for the alias region extra size.
u64 alias_extra_size;
rc = svcGetInfo(&alias_extra_size, InfoType_AliasRegionExtraSize, CUR_PROCESS_HANDLE, 0);
if (R_SUCCEEDED(rc)) {
g_AliasRegion.end -= alias_extra_size;
}
// Retrieve memory region information for the reserved heap region.
rc = _memregionInitWithInfo(&g_HeapRegion, InfoType_HeapRegionAddress, InfoType_HeapRegionSize);
if (R_FAILED(rc)) {

View File

@ -82,6 +82,11 @@ void _nvFenceCleanup(void)
}
}
u32 nvFenceGetFd(void)
{
return g_ctrl_fd;
}
static Result _nvFenceEventWaitCommon(Event* event, u32 event_id, s32 timeout_us)
{
u64 timeout_ns = UINT64_MAX;

View File

@ -204,16 +204,15 @@ Result nvioctlChannel_Submit(u32 fd, const nvioctl_cmdbuf *cmdbufs, u32 num_cmdb
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
struct {
__nv_in u32 num_cmdbufs;
__nv_in u32 num_relocs;
__nv_in u32 num_syncpt_incrs;
__nv_in u32 num_fences;
__nv_in nvioctl_cmdbuf cmdbufs [num_cmdbufs];
__nv_in nvioctl_reloc relocs [num_relocs];
__nv_in nvioctl_reloc_shift reloc_shifts[num_relocs];
__nv_in nvioctl_syncpt_incr syncpt_incrs[num_syncpt_incrs];
__nv_in nvioctl_syncpt_incr wait_checks [num_syncpt_incrs];
__nv_out nvioctl_fence fences [num_fences];
__nv_in u32 num_cmdbufs;
__nv_in u32 num_relocs;
__nv_in u32 num_syncpt_incrs;
__nv_in u32 num_fences;
__nv_in nvioctl_cmdbuf cmdbufs [num_cmdbufs];
__nv_in nvioctl_reloc relocs [num_relocs];
__nv_in nvioctl_reloc_shift reloc_shifts[num_relocs];
__nv_in nvioctl_syncpt_incr syncpt_incrs[num_syncpt_incrs];
__nv_inout u32 thresholds [num_fences];
} data;
memset(&data, 0, sizeof(data));
@ -229,9 +228,12 @@ Result nvioctlChannel_Submit(u32 fd, const nvioctl_cmdbuf *cmdbufs, u32 num_cmdb
Result rc = nvIoctl(fd, _NV_IOWR(0, 0x01, data), &data);
if (R_SUCCEEDED(rc)) {
memcpy(fences, data.fences, num_fences * sizeof(nvioctl_fence));
for (int i = 0; i < num_fences; ++i)
fences[i].id = data.syncpt_incrs[i].syncpt_id;
for (int i = 0; i < num_fences; ++i) {
fences[i] = (nvioctl_fence){
.id = syncpt_incrs[i].syncpt_id,
.value = data.thresholds[i],
};
}
}
return rc;
@ -254,15 +256,12 @@ Result nvioctlChannel_GetSyncpt(u32 fd, u32 id, u32 *syncpt) {
}
Result nvioctlChannel_GetModuleClockRate(u32 fd, u32 module_id, u32 *freq) {
struct {
__nv_out u32 rate;
__nv_in u32 module;
} data = {
.module = module_id,
nvioctl_clk_rate data = {
.moduleid = module_id,
};
u32 ioctl = _NV_IOWR(0, hosversionAtLeast(8,0,0) ? 0x14 : 0x23, data);
Result rc = nvIoctl(fd, ioctl, &data);
u32 nr = _NV_IOWR(0, hosversionBefore(8,0,0) ? 0x14 : 0x23, data);
Result rc = nvIoctl(fd, nr, &data);
if (R_SUCCEEDED(rc) && freq)
*freq = data.rate;
@ -270,6 +269,25 @@ Result nvioctlChannel_GetModuleClockRate(u32 fd, u32 module_id, u32 *freq) {
return rc;
}
Result nvioctlChannel_SetModuleClockRate(u32 fd, u32 module_id, u32 freq) {
nvioctl_clk_rate data = {
.rate = freq,
.moduleid = module_id,
};
return nvIoctl(fd, _NV_IOW(0, 0x08, data), &data);
}
Result nvioctlChannel_SetSubmitTimeout(u32 fd, u32 timeout) {
struct {
__nv_in u32 timeout;
} data = {
.timeout = timeout,
};
return nvIoctl(fd, _NV_IOW(0, 0x07, data), &data);
}
Result nvioctlChannel_MapCommandBuffer(u32 fd, nvioctl_command_buffer_map *maps, u32 num_maps, bool compressed) {
if (num_maps > 0x200)
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);

View File

@ -62,8 +62,6 @@ static const devoptab_t g_socketDevoptab = {
};
static const SocketInitConfig g_defaultSocketInitConfig = {
.bsdsockets_version = 1,
.tcp_tx_buf_size = 0x8000,
.tcp_rx_buf_size = 0x10000,
.tcp_tx_buf_max_size = 0x40000,
@ -82,13 +80,35 @@ const SocketInitConfig *socketGetDefaultInitConfig(void) {
return &g_defaultSocketInitConfig;
}
static u32 socketSelectVersion(void) {
if (hosversionBefore(3,0,0)) {
return 1;
} else if (hosversionBefore(4,0,0)) {
return 2;
} else if (hosversionBefore(5,0,0)) {
return 3;
} else if (hosversionBefore(6,0,0)) {
return 4;
} else if (hosversionBefore(8,0,0)) {
return 5;
} else if (hosversionBefore(9,0,0)) {
return 6;
} else if (hosversionBefore(13,0,0)) {
return 7;
} else if (hosversionBefore(16,0,0)) {
return 8;
} else /* latest known version */ {
return 9;
}
}
Result socketInitialize(const SocketInitConfig *config) {
Result ret = 0;
if (!config)
config = &g_defaultSocketInitConfig;
BsdInitConfig bcfg = {
.version = config->bsdsockets_version,
.version = socketSelectVersion(),
.tcp_tx_buf_size = config->tcp_tx_buf_size,
.tcp_rx_buf_size = config->tcp_rx_buf_size,

View File

@ -1,34 +1,46 @@
#include "result.h"
#include "kernel/svc.h"
#include "runtime/diag.h"
#include <elf.h>
#include <string.h>
void __nx_dynamic(uintptr_t base, const Elf64_Dyn* dyn)
typedef struct Mod0Header {
u32 magic_mod0;
s32 dyn_offset;
s32 bss_start_offset;
s32 bss_end_offset;
s32 eh_frame_hdr_start_offset;
s32 eh_frame_hdr_end_offset;
s32 unused;
u32 magic_lny0;
s32 got_start_offset;
s32 got_end_offset;
u32 magic_lny1;
s32 relro_start_offset;
s32 relro_end_offset;
} Mod0Header;
NX_INLINE void* _dynResolveOffset(const Mod0Header* mod0, s32 offset)
{
const Elf64_Rela* rela = NULL;
u64 relasz = 0;
return (void*)((uintptr_t)mod0 + offset);
}
for (; dyn->d_tag != DT_NULL; dyn++)
{
switch (dyn->d_tag)
{
case DT_RELA:
rela = (const Elf64_Rela*)(base + dyn->d_un.d_ptr);
static void _dynProcessRela(uintptr_t base, const Elf64_Rela* rela, size_t relasz)
{
for (; relasz--; rela++) {
switch (ELF64_R_TYPE(rela->r_info)) {
default: {
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_BadReloc));
break;
case DT_RELASZ:
relasz = dyn->d_un.d_val / sizeof(Elf64_Rela);
}
case R_AARCH64_NONE: {
break;
}
}
}
if (rela == NULL)
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_BadReloc));
for (; relasz--; rela++)
{
switch (ELF64_R_TYPE(rela->r_info))
{
case R_AARCH64_RELATIVE:
{
case R_AARCH64_RELATIVE: {
u64* ptr = (u64*)(base + rela->r_offset);
*ptr = base + rela->r_addend;
break;
@ -36,3 +48,91 @@ void __nx_dynamic(uintptr_t base, const Elf64_Dyn* dyn)
}
}
}
static void _dynProcessRelr(uintptr_t base, const Elf64_Relr* relr, size_t relrsz)
{
u64* ptr = NULL;
for (; relrsz--; relr++) {
if ((*relr & 1) == 0) {
ptr = (u64*)(base + *relr);
*ptr++ += base;
} else {
u64 bitmap = *relr >> 1;
while (bitmap) {
unsigned id = __builtin_ffsl(bitmap)-1;
bitmap &= ~(1UL << id);
ptr[id] += base;
}
ptr += 63;
}
}
}
void __nx_dynamic(uintptr_t base, const Mod0Header* mod0)
{
// Return early if MOD0 header has been invalidated
if (mod0->magic_mod0 != 0x30444f4d) { // MOD0
return;
}
// Clear the BSS area
u8* bss_start = _dynResolveOffset(mod0, mod0->bss_start_offset);
u8* bss_end = _dynResolveOffset(mod0, mod0->bss_end_offset);
if (bss_start != bss_end) {
memset(bss_start, 0, bss_end - bss_start);
}
// Retrieve pointer to the ELF dynamic section
const Elf64_Dyn* dyn = _dynResolveOffset(mod0, mod0->dyn_offset);
// Extract relevant information from the ELF dynamic section
const Elf64_Rela* rela = NULL;
size_t relasz = 0;
const Elf64_Relr* relr = NULL;
size_t relrsz = 0;
for (; dyn->d_tag != DT_NULL; dyn++) {
switch (dyn->d_tag) {
case DT_RELA:
rela = (const Elf64_Rela*)(base + dyn->d_un.d_ptr);
break;
case DT_RELASZ:
relasz = dyn->d_un.d_val / sizeof(Elf64_Rela);
break;
case DT_RELR:
relr = (const Elf64_Relr*)(base + dyn->d_un.d_ptr);
break;
case DT_RELRSZ:
relrsz = dyn->d_un.d_val / sizeof(Elf64_Relr);
break;
}
}
// Apply RELA relocations if present
if (rela && relasz) {
_dynProcessRela(base, rela, relasz);
}
// Apply RELR relocations if present
if (relr && relrsz) {
_dynProcessRelr(base, relr, relrsz);
}
// Return early if LNY0/LNY1 extensions are not present
if (mod0->magic_lny0 != 0x30594e4c || mod0->magic_lny1 != 0x31594e4c) { // LNY0, LNY1
return;
}
// Reprotect relro segment as read-only now that we're done processing relocations
u8* relro_start = _dynResolveOffset(mod0, mod0->relro_start_offset);
size_t relro_sz = (u8*)_dynResolveOffset(mod0, mod0->relro_end_offset) - relro_start;
Result rc = svcSetMemoryPermission(relro_start, relro_sz, Perm_R);
if (R_FAILED(rc)) {
diagAbortWithResult(rc);
}
// Lock the relro segment's permissions
svcSetMemoryAttribute(relro_start, relro_sz, MemAttr_IsPermissionLocked, MemAttr_IsPermissionLocked);
}

View File

@ -7,7 +7,7 @@
#include "services/acc.h"
#include "runtime/diag.h"
void NORETURN __nx_exit(Result rc, LoaderReturnFn retaddr);
void NX_NORETURN __nx_exit(Result rc, LoaderReturnFn retaddr);
static bool g_isNso = false;
static const char* g_loaderInfo = NULL;

View File

@ -10,7 +10,7 @@
#include "runtime/diag.h"
#include "runtime/devices/fs_dev.h"
void NORETURN __nx_exit(Result rc, LoaderReturnFn retaddr);
void NX_NORETURN __nx_exit(Result rc, LoaderReturnFn retaddr);
void virtmemSetup(void);
void newlibSetup(void);
@ -187,12 +187,8 @@ void __attribute__((weak)) __libnx_init(void* ctx, Handle main_thread, void* sav
__libc_init_array();
}
void __attribute__((weak)) NORETURN __libnx_exit(int rc)
void __attribute__((weak)) NX_NORETURN __libnx_exit(int rc)
{
// Call destructors.
void __libc_fini_array(void);
__libc_fini_array();
// Clean up services.
__appExit();

View File

@ -28,11 +28,7 @@ struct __pthread_t
void *rc;
};
void __attribute__((weak)) NORETURN __libnx_exit(int rc);
extern const u8 __tdata_lma[];
extern const u8 __tdata_lma_end[];
extern u8 __tls_start[];
void __attribute__((weak)) NX_NORETURN __libnx_exit(int rc);
/// TimeType passed to timeGetCurrentTime() during time initialization. If that fails and __nx_time_type isn't TimeType_Default, timeGetCurrentTime() will be called again with TimeType_Default.
__attribute__((weak)) TimeType __nx_time_type = TimeType_Default;
@ -438,7 +434,7 @@ void newlibSetup(void)
tv->reent = _impure_ptr;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
tv->tls_tp = __tls_start-2*sizeof(void*); // subtract size of Thread Control Block (TCB)
tv->tls_tp = __tls_start-getTlsStartOffset();
#pragma GCC diagnostic pop
tv->handle = envGetMainThreadHandle();

View File

@ -240,12 +240,12 @@ Result ringconReadId(RingCon *c, u64 *id_l, u64 *id_h) {
struct {
u32 data_x0;
u16 data_x4;
} PACKED id_l;
} NX_PACKED id_l;
struct {
u32 data_x0;
u16 data_x4;
} PACKED id_h;
} NX_PACKED id_h;
} id;
} reply;

View File

@ -23,36 +23,20 @@ _start:
b __libnx_exception_entry
.Lcrt0_main_entry:
// Get pointer to MOD0 struct (contains offsets to important places)
adr x28, __nx_mod0
// Calculate BSS address/size
ldp w8, w9, [x28, #8] // load BSS start/end offset from MOD0
sub w9, w9, w8 // calculate BSS size
add w9, w9, #7 // round up to 8
bic w9, w9, #7 // ^
add x8, x28, x8 // fixup the start pointer
// Clear the BSS in 8-byte units
1: subs w9, w9, #8
str xzr, [x8], #8
bne 1b
// Preserve registers across function calls
mov x25, x0 // entrypoint argument 0
mov x26, x1 // entrypoint argument 1
mov x27, x30 // loader return address
mov x28, sp // initial stack pointer
// Perform runtime linking on ourselves (including relocations)
adr x0, _start // get aslr base
adr x1, __nx_mod0 // get pointer to MOD0 struct
bl __nx_dynamic
// Save initial stack pointer
mov x8, sp
adrp x9, __stack_top
str x8, [x9, #:lo12:__stack_top]
// Parse ELF .dynamic section (which applies relocations to our module)
adr x0, _start // get aslr base
ldr w1, [x28, #4] // pointer to .dynamic section
add x1, x28, x1
bl __nx_dynamic
str x28, [x9, #:lo12:__stack_top]
// Perform system initialization
mov x0, x25
@ -65,8 +49,8 @@ _start:
ldr w0, [x0, #:lo12:__system_argc]
adrp x1, __system_argv // argv
ldr x1, [x1, #:lo12:__system_argv]
adrp x30, exit
add x30, x30, #:lo12:exit
adrp x30, :got:exit
ldr x30, [x30, #:got_lo12:exit]
b main
.global __nx_exit
@ -95,6 +79,10 @@ __nx_mod0:
.word __got_start__ - __nx_mod0
.word __got_end__ - __nx_mod0
.ascii "LNY1"
.word __relro_start - __nx_mod0
.word __data_start - __nx_mod0
.section .bss.__stack_top, "aw", %nobits
.global __stack_top
.align 3

View File

@ -160,10 +160,7 @@ static int inet_pton4(const char *src, void *dst) {
* Paul Vixie, 1996.
*/
static const char *
inet_ntop6(src, dst, size)
const u_char *src;
char *dst;
size_t size;
inet_ntop6(const u_char *src, char *dst, size_t size)
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
@ -276,9 +273,7 @@ inet_ntop6(src, dst, size)
* Paul Vixie, 1996.
*/
static int
inet_pton6(src, dst)
const char *src;
u_char *dst;
inet_pton6(const char *src, u_char *dst)
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";

View File

@ -357,7 +357,7 @@ static void _appletInfiniteSleepLoop(void) {
while(1) svcSleepThread(86400000000000ULL);
}
static void NORETURN _appletExitProcess(int result_code) {
static void NX_NORETURN _appletExitProcess(int result_code) {
appletInitialize();
appletExit();

View File

@ -99,6 +99,9 @@ Result audctlSetTargetMute(AudioTarget target, bool mute) {
}
Result audctlIsTargetConnected(bool* connected_out, AudioTarget target) {
if (hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u32 target;
} in = { target };
@ -166,6 +169,9 @@ Result audctlSetAudioOutputMode(AudioTarget target, AudioOutputMode mode) {
}
Result audctlSetForceMutePolicy(AudioForceMutePolicy policy) {
if (hosversionAtLeast(14,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u32 policy;
} in = { policy };
@ -174,6 +180,9 @@ Result audctlSetForceMutePolicy(AudioForceMutePolicy policy) {
}
Result audctlGetForceMutePolicy(AudioForceMutePolicy* policy_out) {
if (hosversionAtLeast(14,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
struct {
u32 policy;
} out;
@ -256,7 +265,7 @@ Result audctlGetHeadphoneOutputLevelMode(AudioHeadphoneOutputLevelMode* mode_out
}
Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out) {
if (hosversionBefore(3,0,0))
if (!hosversionBetween(3,14))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Handle tmp_handle;
@ -274,7 +283,7 @@ Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out) {
}
Result audctlAcquireAudioOutputDeviceUpdateEventForPlayReport(Event* event_out) {
if (hosversionBefore(3,0,0))
if (!hosversionBetween(3,14))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Handle tmp_handle;

View File

@ -24,50 +24,50 @@ Service* btGetServiceSession(void) {
return &g_btSrv;
}
Result btLeClientReadCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk) {
Result btLeClientReadCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u8 auth_req) {
const struct {
u8 primary_service;
u8 unk;
u8 is_primary;
u8 auth_req;
u8 pad[2];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId serv_id;
BtdrvGattId char_id;
u64 AppletResourceUserId;
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, 0, in,
.in_send_pid = true,
);
}
Result btLeClientReadDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk) {
Result btLeClientReadDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, u8 auth_req) {
const struct {
u8 primary_service;
u8 unk;
u8 is_primary;
u8 auth_req;
u8 pad[2];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId id2;
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattId desc_id;
u64 AppletResourceUserId;
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2, appletGetAppletResourceUserId() };
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, *desc_id, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, 1, in,
.in_send_pid = true,
);
}
Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag) {
Result btLeClientWriteCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const void* buffer, size_t size, u8 auth_req, bool with_response) {
const struct {
u8 primary_service;
u8 unk;
u8 flag;
u8 is_primary;
u8 auth_req;
u8 with_response;
u8 pad;
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId serv_id;
BtdrvGattId char_id;
u64 AppletResourceUserId;
} in = { primary_service!=0, unk, flag!=0, 0, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
} in = { is_primary!=0, auth_req, with_response!=0, 0, connection_handle, *serv_id, *char_id, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, 2, in,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
@ -76,17 +76,17 @@ Result btLeClientWriteCharacteristic(u32 connection_handle, bool primary_service
);
}
Result btLeClientWriteDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk) {
Result btLeClientWriteDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const void* buffer, size_t size, u8 auth_req) {
const struct {
u8 primary_service;
u8 unk;
u8 is_primary;
u8 auth_req;
u8 pad[2];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId id2;
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattId desc_id;
u64 AppletResourceUserId;
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2, appletGetAppletResourceUserId() };
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, *desc_id, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, 3, in,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
@ -95,38 +95,38 @@ Result btLeClientWriteDescriptor(u32 connection_handle, bool primary_service, co
);
}
static Result _btLeClientNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
static Result _btLeClientNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u32 cmd_id) {
const struct {
u8 primary_service;
u8 is_primary;
u8 pad[3];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId serv_id;
BtdrvGattId char_id;
u64 AppletResourceUserId;
} in = { primary_service!=0, {0}, connection_handle, *id0, *id1, appletGetAppletResourceUserId() };
} in = { is_primary!=0, {0}, connection_handle, *serv_id, *char_id, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, cmd_id, in,
.in_send_pid = true,
);
}
Result btLeClientRegisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
return _btLeClientNotification(connection_handle, primary_service, id0, id1, 4);
Result btLeClientRegisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id) {
return _btLeClientNotification(connection_handle, is_primary, serv_id, char_id, 4);
}
Result btLeClientDeregisterNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
return _btLeClientNotification(connection_handle, primary_service, id0, id1, 5);
Result btLeClientDeregisterNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id) {
return _btLeClientNotification(connection_handle, is_primary, serv_id, char_id, 5);
}
Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size) {
Result btSetLeResponse(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size) {
const struct {
u8 unk;
u8 server_if;
u8 pad[3];
BtdrvGattAttributeUuid uuid0;
BtdrvGattAttributeUuid uuid1;
BtdrvGattAttributeUuid serv_uuid;
BtdrvGattAttributeUuid char_uuid;
u8 pad2[4];
u64 AppletResourceUserId;
} in = { unk, {0}, *uuid0, *uuid1, {0}, appletGetAppletResourceUserId() };
} in = { server_if, {0}, *serv_uuid, *char_uuid, {0}, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, 6, in,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
@ -135,16 +135,16 @@ Result btSetLeResponse(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvG
);
}
Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, const void* buffer, size_t size, bool flag) {
Result btLeSendIndication(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, const void* buffer, size_t size, bool noconfirm) {
const struct {
u8 unk;
u8 flag;
u8 server_if;
u8 noconfirm;
u8 pad[2];
BtdrvGattAttributeUuid uuid0;
BtdrvGattAttributeUuid uuid1;
BtdrvGattAttributeUuid serv_uuid;
BtdrvGattAttributeUuid char_uuid;
u8 pad2[4];
u64 AppletResourceUserId;
} in = { unk, flag!=0, {0}, *uuid0, *uuid1, {0}, appletGetAppletResourceUserId() };
} in = { server_if, noconfirm!=0, {0}, *serv_uuid, *char_uuid, {0}, appletGetAppletResourceUserId() };
return serviceDispatchIn(&g_btSrv, 7, in,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
@ -153,7 +153,7 @@ Result btLeSendIndication(u8 unk, const BtdrvGattAttributeUuid *uuid0, const Btd
);
}
Result btGetLeEventInfo(void* buffer, size_t size, u32 *type) {
Result btGetLeEventInfo(void* buffer, size_t size, BtdrvBleEventType *type) {
u64 AppletResourceUserId = appletGetAppletResourceUserId();
return serviceDispatchInOut(&g_btSrv, 8, AppletResourceUserId, *type,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },

View File

@ -166,14 +166,14 @@ static Result _btdrvCmdOutU32OutBuf(void* buffer, size_t size, u32 *out, u32 cmd
);
}
static Result _btdrvGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u32 cmd_id) {
static Result _btdrvGattNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u32 cmd_id) {
const struct {
u8 primary_service;
u8 is_primary;
u8 pad[3];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
} in = { primary_service!=0, {0}, connection_handle, *id0, *id1 };
BtdrvGattId serv_id;
BtdrvGattId char_id;
} in = { is_primary!=0, {0}, connection_handle, *serv_id, *char_id };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
@ -417,13 +417,13 @@ Result btdrvGetHidReport(BtdrvAddress addr, u8 report_id, BtdrvBluetoothHhReport
return serviceDispatchIn(&g_btdrvSrv, 22, in);
}
Result btdrvTriggerConnection(BtdrvAddress addr, u16 unk) {
Result btdrvTriggerConnection(BtdrvAddress addr, u16 timeout) {
if (hosversionBefore(9,0,0)) return _btdrvCmdInAddrNoOut(addr, 23);
const struct {
BtdrvAddress addr;
u16 unk;
} in = { addr, unk };
u16 timeout;
} in = { addr, timeout };
return serviceDispatchIn(&g_btdrvSrv, 23, in);
}
@ -708,15 +708,15 @@ Result btdrvSetBleAdvertiseData(const BtdrvBleAdvertisePacketData *data) {
return _btdrvCmdInBufPtrFixed(data, sizeof(*data), 53);
}
Result btdrvSetBleAdvertiseParameter(BtdrvAddress addr, u16 unk0, u16 unk1) {
Result btdrvSetBleAdvertiseParameter(BtdrvAddress addr, u16 min_interval, u16 max_interval) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
BtdrvAddress addr;
u16 unk0;
u16 unk1;
} in = { addr, unk0, unk1 };
u16 min_interval;
u16 max_interval;
} in = { addr, min_interval, max_interval };
return serviceDispatchIn(&g_btdrvSrv, 54, in);
}
@ -749,11 +749,11 @@ Result btdrvDeleteBleScanFilterCondition(const BtdrvBleAdvertiseFilter *filter)
return _btdrvCmdInBufPtrFixed(filter, sizeof(*filter), 58);
}
Result btdrvDeleteBleScanFilter(u8 unk) {
Result btdrvDeleteBleScanFilter(u8 index) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btdrvCmdInU8NoOut(unk, 59);
return _btdrvCmdInU8NoOut(index, 59);
}
Result btdrvClearBleScanFilters(void) {
@ -777,11 +777,11 @@ Result btdrvRegisterGattClient(const BtdrvGattAttributeUuid *uuid) {
return _btdrvCmdInUuidNoOut(uuid, 62);
}
Result btdrvUnregisterGattClient(u8 unk) {
Result btdrvUnregisterGattClient(u8 client_if) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btdrvCmdInU8NoOut(unk, 63);
return _btdrvCmdInU8NoOut(client_if, 63);
}
Result btdrvUnregisterAllGattClients(void) {
@ -791,42 +791,42 @@ Result btdrvUnregisterAllGattClients(void) {
return _btdrvCmdNoIO(64);
}
Result btdrvConnectGattServer(u8 unk, BtdrvAddress addr, bool flag, u64 AppletResourceUserId) {
Result btdrvConnectGattServer(u8 client_if, BtdrvAddress addr, bool is_direct, u64 AppletResourceUserId) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u8 unk;
u8 client_if;
BtdrvAddress addr;
u8 flag;
u8 is_direct;
u64 AppletResourceUserId;
} in = { unk, addr, flag!=0, AppletResourceUserId };
} in = { client_if, addr, is_direct!=0, AppletResourceUserId };
return serviceDispatchIn(&g_btdrvSrv, 65, in);
}
Result btdrvCancelConnectGattServer(u8 unk, BtdrvAddress addr, bool flag) {
Result btdrvCancelConnectGattServer(u8 client_if, BtdrvAddress addr, bool is_direct) {
if (hosversionBefore(5,1,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u8 unk;
u8 client_if;
BtdrvAddress addr;
u8 flag;
} in = { unk, addr, flag!=0 };
u8 is_direct;
} in = { client_if, addr, is_direct!=0 };
return serviceDispatchIn(&g_btdrvSrv, 66, in);
}
Result btdrvDisconnectGattServer(u32 unk) {
Result btdrvDisconnectGattServer(u32 conn_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 66 : 67;
return _btdrvCmdInU32NoOut(unk, cmd_id);
return _btdrvCmdInU32NoOut(conn_id, cmd_id);
}
Result btdrvGetGattAttribute(BtdrvAddress addr, u32 unk) {
Result btdrvGetGattAttribute(BtdrvAddress addr, u32 conn_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 67 : 68;
@ -834,28 +834,28 @@ Result btdrvGetGattAttribute(BtdrvAddress addr, u32 unk) {
if (hosversionBefore(9,0,0)) {
const struct {
BtdrvAddress addr;
u32 unk0;
} in = { addr, unk };
u32 conn_id;
} in = { addr, conn_id };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
return _btdrvCmdInU32NoOut(unk, cmd_id);
return _btdrvCmdInU32NoOut(conn_id, cmd_id);
}
Result btdrvGetGattService(u32 unk, const BtdrvGattAttributeUuid *uuid) {
Result btdrvGetGattService(u32 conn_id, const BtdrvGattAttributeUuid *uuid) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 68 : 69;
const struct {
u32 unk0;
u32 conn_id;
BtdrvGattAttributeUuid uuid;
} in = { unk, *uuid };
} in = { conn_id, *uuid };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
Result btdrvConfigureAttMtu(u32 unk, u16 mtu) {
Result btdrvConfigureAttMtu(u32 conn_id, u16 mtu) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 69 : 70;
@ -863,8 +863,8 @@ Result btdrvConfigureAttMtu(u32 unk, u16 mtu) {
const struct {
u16 mtu;
u16 pad;
u32 unk;
} in = { mtu, 0, unk };
u32 conn_id;
} in = { mtu, 0, conn_id };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
@ -877,100 +877,100 @@ Result btdrvRegisterGattServer(const BtdrvGattAttributeUuid *uuid) {
return _btdrvCmdInUuidNoOut(uuid, cmd_id);
}
Result btdrvUnregisterGattServer(u8 unk) {
Result btdrvUnregisterGattServer(u8 server_if) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 71 : 72;
return _btdrvCmdInU8NoOut(unk, cmd_id);
return _btdrvCmdInU8NoOut(server_if, cmd_id);
}
Result btdrvConnectGattClient(u8 unk, BtdrvAddress addr, bool flag) {
Result btdrvConnectGattClient(u8 server_if, BtdrvAddress addr, bool is_direct) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 72 : 73;
const struct {
u8 unk;
u8 server_if;
BtdrvAddress addr;
u8 flag;
} in = { unk, addr, flag!=0 };
u8 is_direct;
} in = { server_if, addr, is_direct!=0 };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
Result btdrvDisconnectGattClient(u8 unk, BtdrvAddress addr) {
Result btdrvDisconnectGattClient(u8 conn_id, BtdrvAddress addr) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 73 : 74;
if (hosversionBefore(9,0,0)) {
const struct {
u8 unk0;
u8 conn_id;
BtdrvAddress addr;
} in = { unk, addr };
} in = { conn_id, addr };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
return serviceDispatchIn(&g_btdrvSrv, cmd_id, unk);
return serviceDispatchIn(&g_btdrvSrv, cmd_id, conn_id);
}
Result btdrvAddGattService(u8 unk0, const BtdrvGattAttributeUuid *uuid, u8 unk1, bool flag) {
Result btdrvAddGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid, u8 num_handle, bool is_primary) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u8 unk0;
u8 unk1;
u8 flag;
u8 server_if;
u8 num_handle;
u8 is_primary;
u8 pad;
BtdrvGattAttributeUuid uuid;
} in = { unk0, unk1, flag!=0, 0, *uuid };
} in = { server_if, num_handle, is_primary!=0, 0, *uuid };
return serviceDispatchIn(&g_btdrvSrv, 75, in);
}
Result btdrvEnableGattService(u8 unk, const BtdrvGattAttributeUuid *uuid) {
Result btdrvEnableGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 74 : 76;
const struct {
u8 unk;
u8 server_if;
u8 pad[3];
BtdrvGattAttributeUuid uuid;
} in = { unk, {0}, *uuid };
} in = { server_if, {0}, *uuid };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
Result btdrvAddGattCharacteristic(u8 unk0, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, u8 unk1, u16 unk2) {
Result btdrvAddGattCharacteristic(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, u16 permissions, u8 property) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u8 unk0;
u8 unk1;
u16 unk2;
BtdrvGattAttributeUuid uuid0;
BtdrvGattAttributeUuid uuid1;
} in = { unk0, unk1, unk2, *uuid0, *uuid1 };
u8 server_if;
u8 property;
u16 permissions;
BtdrvGattAttributeUuid serv_uuid;
BtdrvGattAttributeUuid char_uuid;
} in = { server_if, property, permissions, *serv_uuid, *char_uuid };
return serviceDispatchIn(&g_btdrvSrv, 77, in);
}
Result btdrvAddGattDescriptor(u8 unk0, const BtdrvGattAttributeUuid *uuid0, const BtdrvGattAttributeUuid *uuid1, u16 unk1) {
Result btdrvAddGattDescriptor(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *desc_uuid, u16 permissions) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 76 : 78;
const struct {
u8 unk0;
u8 server_if;
u8 pad;
u16 unk1;
BtdrvGattAttributeUuid uuid0;
BtdrvGattAttributeUuid uuid1;
} in = { unk0, 0, unk1, *uuid0, *uuid1 };
u16 permissions;
BtdrvGattAttributeUuid serv_uuid;
BtdrvGattAttributeUuid desc_uuid;
} in = { server_if, 0, permissions, *serv_uuid, *desc_uuid };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
@ -983,18 +983,18 @@ Result btdrvGetBleManagedEventInfo(void* buffer, size_t size, BtdrvBleEventType
return _btdrvCmdOutU32OutBuf(buffer, size, type, cmd_id);
}
Result btdrvGetGattFirstCharacteristic(u32 unk, const BtdrvGattId *id, bool flag, const BtdrvGattAttributeUuid *uuid, u8 *out_property, BtdrvGattId *out_char_id) {
Result btdrvGetGattFirstCharacteristic(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattAttributeUuid *filter_uuid, u8 *out_property, BtdrvGattId *out_char_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 79 : 80;
const struct {
u8 flag;
u8 is_primary;
u8 pad[3];
u32 unk;
BtdrvGattId id;
BtdrvGattAttributeUuid uuid;
} in = { flag!=0, {0}, unk, *id, *uuid };
u32 conn_id;
BtdrvGattId serv_id;
BtdrvGattAttributeUuid filter_uuid;
} in = { is_primary!=0, {0}, conn_id, *serv_id, *filter_uuid };
struct {
u8 property;
@ -1010,19 +1010,19 @@ Result btdrvGetGattFirstCharacteristic(u32 unk, const BtdrvGattId *id, bool flag
return rc;
}
Result btdrvGetGattNextCharacteristic(u32 unk, const BtdrvGattId *id0, bool flag, const BtdrvGattId *id1, const BtdrvGattAttributeUuid *uuid, u8 *out_property, BtdrvGattId *out_char_id) {
Result btdrvGetGattNextCharacteristic(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattId *char_id, const BtdrvGattAttributeUuid *filter_uuid, u8 *out_property, BtdrvGattId *out_char_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 80 : 81;
const struct {
u8 flag;
u8 is_primary;
u8 pad[3];
u32 unk;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattAttributeUuid uuid;
} in = { flag!=0, {0}, unk, *id0, *id1, *uuid };
u32 conn_id;
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattAttributeUuid filter_uuid;
} in = { is_primary!=0, {0}, conn_id, *serv_id, *char_id, *filter_uuid };
struct {
u8 property;
@ -1038,37 +1038,37 @@ Result btdrvGetGattNextCharacteristic(u32 unk, const BtdrvGattId *id0, bool flag
return rc;
}
Result btdrvGetGattFirstDescriptor(u32 unk, const BtdrvGattId *id0, bool flag, const BtdrvGattId *id1, const BtdrvGattAttributeUuid *uuid, BtdrvGattId *out_desc_id) {
Result btdrvGetGattFirstDescriptor(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattId *char_id, const BtdrvGattAttributeUuid *filter_uuid, BtdrvGattId *out_desc_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 81 : 82;
const struct {
u8 flag;
u8 is_primary;
u8 pad[3];
u32 unk;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattAttributeUuid uuid;
} in = { flag!=0, {0}, unk, *id0, *id1, *uuid };
u32 conn_id;
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattAttributeUuid filter_uuid;
} in = { is_primary!=0, {0}, conn_id, *serv_id, *char_id, *filter_uuid };
return serviceDispatchInOut(&g_btdrvSrv, cmd_id, in, *out_desc_id);
}
Result btdrvGetGattNextDescriptor(u32 unk, const BtdrvGattId *id0, bool flag, const BtdrvGattId *id1, const BtdrvGattId *id2, const BtdrvGattAttributeUuid *uuid, BtdrvGattId *out_desc_id) {
Result btdrvGetGattNextDescriptor(u32 conn_id, const BtdrvGattId *serv_id, bool is_primary, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const BtdrvGattAttributeUuid *filter_uuid, BtdrvGattId *out_desc_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 82 : 83;
const struct {
u8 flag;
u8 is_primary;
u8 pad[3];
u32 unk;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId id2;
BtdrvGattAttributeUuid uuid;
} in = { flag!=0, {0}, unk, *id0, *id1, *id2, *uuid };
u32 conn_id;
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattId desc_id;
BtdrvGattAttributeUuid filter_uuid;
} in = { is_primary!=0, {0}, conn_id, *serv_id, *char_id, *desc_id, *filter_uuid };
return serviceDispatchInOut(&g_btdrvSrv, cmd_id, in, *out_desc_id);
}
@ -1116,55 +1116,55 @@ Result btdrvUnregisterGattDataPath(const BtdrvGattAttributeUuid *uuid) {
return _btdrvCmdInUuidNoOut(uuid, cmd_id);
}
Result btdrvReadGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, u8 unk) {
Result btdrvReadGattCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, u8 auth_req) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 89 : 90;
const struct {
u8 primary_service;
u8 unk;
u8 is_primary;
u8 auth_req;
u8 pad[2];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1};
BtdrvGattId serv_id;
BtdrvGattId char_id;
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id};
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
Result btdrvReadGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, u8 unk) {
Result btdrvReadGattDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, u8 auth_req) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 90 : 91;
const struct {
u8 primary_service;
u8 unk;
u8 is_primary;
u8 auth_req;
u8 pad[2];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId id2;
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2 };
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattId desc_id;
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, *desc_id };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
}
Result btdrvWriteGattCharacteristic(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const void* buffer, size_t size, u8 unk, bool flag) {
Result btdrvWriteGattCharacteristic(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const void* buffer, size_t size, u8 auth_req, bool with_response) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 91 : 92;
const struct {
u8 primary_service;
u8 unk;
u8 flag;
u8 is_primary;
u8 auth_req;
u8 with_response;
u8 pad;
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
} in = { primary_service!=0, unk, flag!=0, 0, connection_handle, *id0, *id1 };
BtdrvGattId serv_id;
BtdrvGattId char_id;
} in = { is_primary!=0, auth_req, with_response!=0, 0, connection_handle, *serv_id, *char_id };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
@ -1172,20 +1172,20 @@ Result btdrvWriteGattCharacteristic(u32 connection_handle, bool primary_service,
);
}
Result btdrvWriteGattDescriptor(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1, const BtdrvGattId *id2, const void* buffer, size_t size, u8 unk) {
Result btdrvWriteGattDescriptor(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id, const BtdrvGattId *desc_id, const void* buffer, size_t size, u8 auth_req) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 92 : 93;
const struct {
u8 primary_service;
u8 unk;
u8 is_primary;
u8 auth_req;
u8 pad[2];
u32 connection_handle;
BtdrvGattId id0;
BtdrvGattId id1;
BtdrvGattId id2;
} in = { primary_service!=0, unk, {0}, connection_handle, *id0, *id1, *id2 };
BtdrvGattId serv_id;
BtdrvGattId char_id;
BtdrvGattId desc_id;
} in = { is_primary!=0, auth_req, {0}, connection_handle, *serv_id, *char_id, *desc_id };
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
@ -1193,19 +1193,19 @@ Result btdrvWriteGattDescriptor(u32 connection_handle, bool primary_service, con
);
}
Result btdrvRegisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
Result btdrvRegisterGattNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btdrvGattNotification(connection_handle, primary_service, id0, id1, 94);
return _btdrvGattNotification(connection_handle, is_primary, serv_id, char_id, 94);
}
Result btdrvUnregisterGattNotification(u32 connection_handle, bool primary_service, const BtdrvGattId *id0, const BtdrvGattId *id1) {
Result btdrvUnregisterGattNotification(u32 connection_handle, bool is_primary, const BtdrvGattId *serv_id, const BtdrvGattId *char_id) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 cmd_id = hosversionBefore(5,1,0) ? 93 : 95;
return _btdrvGattNotification(connection_handle, primary_service, id0, id1, cmd_id);
return _btdrvGattNotification(connection_handle, is_primary, serv_id, char_id, cmd_id);
}
Result btdrvGetLeHidEventInfo(void* buffer, size_t size, BtdrvBleEventType *type) {
@ -1224,14 +1224,14 @@ Result btdrvRegisterBleHidEvent(Event* out_event) {
return _btdrvCmdGetEvent(out_event, true, cmd_id);
}
Result btdrvSetBleScanParameter(u16 unk0, u16 unk1) {
Result btdrvSetBleScanParameter(u16 scan_interval, u16 scan_window) {
if (hosversionBefore(5,1,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u16 unk0;
u16 unk1;
} in = { unk0, unk1 };
u16 scan_interval;
u16 scan_window;
} in = { scan_interval, scan_window };
return serviceDispatchIn(&g_btdrvSrv, 98, in);
}
@ -1493,7 +1493,7 @@ bool btdrvCircularBufferFree(BtdrvCircularBuffer *c) {
if (read_offset == write_offset) return false;
u8 *data_ptr = &c->data[read_offset];
if (read_offset >= sizeof(c->data)) false;
if (read_offset >= sizeof(c->data)) return false;
u64 tmpsize = read_offset + 0x18;
if (tmpsize < sizeof(c->data)) tmpsize += *((u64*)&data_ptr[0x10]);

View File

@ -2,6 +2,7 @@
#include <string.h>
#include "service_guard.h"
#include "runtime/hosversion.h"
#include "services/applet.h"
#include "services/btmsys.h"
static Service g_btmIBtmSystemCore;
@ -54,6 +55,18 @@ static Result _btmsysCmdNoInOutBool(bool *out, u32 cmd_id) {
return rc;
}
static Result _btmsysCmdGetEvent(Event* out_event, bool autoclear, u32 cmd_id) {
Handle tmp_handle = INVALID_HANDLE;
Result rc = 0;
rc = serviceDispatch(&g_btmIBtmSystemCore, cmd_id,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = &tmp_handle,
);
if (R_SUCCEEDED(rc)) eventLoadRemote(out_event, tmp_handle, autoclear);
return rc;
}
static Result _btmsysCmdGetEventOutFlag(Event* out_event, bool autoclear, u32 cmd_id) {
Handle tmp_handle = INVALID_HANDLE;
Result rc = 0;
@ -68,6 +81,24 @@ static Result _btmsysCmdGetEventOutFlag(Event* out_event, bool autoclear, u32 cm
return rc;
}
static Result _btmsysCmdOutBufPtr(void* buffer, size_t size, s32 *total_out, u32 cmd_id) {
return serviceDispatchOut(&g_btmIBtmSystemCore, cmd_id, *total_out,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { {buffer, size} },
);
}
static Result _btmsysCmdInAddrNoOut(BtdrvAddress addr, u32 cmd_id) {
return serviceDispatchIn(&g_btmIBtmSystemCore, cmd_id, addr);
}
static Result _btmsysCmdAruidNoOutput(u32 cmd_id) {
u64 AppletResourceUserId = appletGetAppletResourceUserId();
return serviceDispatchIn(&g_btmIBtmSystemCore, cmd_id, AppletResourceUserId,
.in_send_pid = true,
);
}
Result btmsysStartGamepadPairing(void) {
return _btmsysCmdNoIO(0);
}
@ -117,3 +148,100 @@ Result btmsysIsGamepadPairingStarted(bool *out) {
return _btmsysCmdNoInOutBool(out, 9);
}
Result btmsysStartAudioDeviceDiscovery(void) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdNoIO(10);
}
Result btmsysStopAudioDeviceDiscovery(void) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdNoIO(11);
}
Result btmsysIsDiscoveryingAudioDevice(bool *out) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdNoInOutBool(out, 12);
}
Result btmsysGetDiscoveredAudioDevice(BtmAudioDevice *out, s32 count, s32 *total_out) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdOutBufPtr(out, sizeof(BtmAudioDevice)*count, total_out, 13);
}
Result btmsysAcquireAudioDeviceConnectionEvent(Event* out_event) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdGetEvent(out_event, true, 14);
}
Result btmsysConnectAudioDevice(BtdrvAddress addr) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdInAddrNoOut(addr, 15);
}
Result btmsysIsConnectingAudioDevice(bool *out) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdNoInOutBool(out, 16);
}
Result btmsysGetConnectedAudioDevices(BtmAudioDevice *out, s32 count, s32 *total_out) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdOutBufPtr(out, sizeof(BtmAudioDevice)*count, total_out, 17);
}
Result btmsysDisconnectAudioDevice(BtdrvAddress addr) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdInAddrNoOut(addr, 18);
}
Result btmsysAcquirePairedAudioDeviceInfoChangedEvent(Event* out_event) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdGetEvent(out_event, true, 19);
}
Result btmsysGetPairedAudioDevices(BtmAudioDevice *out, s32 count, s32 *total_out) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdOutBufPtr(out, sizeof(BtmAudioDevice)*count, total_out, 20);
}
Result btmsysRemoveAudioDevicePairing(BtdrvAddress addr) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdInAddrNoOut(addr, 21);
}
Result btmsysRequestAudioDeviceConnectionRejection(void) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdAruidNoOutput(22);
}
Result btmsysCancelAudioDeviceConnectionRejection(void) {
if (hosversionBefore(13,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _btmsysCmdAruidNoOutput(23);
}

View File

@ -54,30 +54,54 @@ Result capscNotifyAlbumStorageIsUnAvailable(CapsAlbumStorage storage) {
return _capscCmdInU8NoOut(&g_capscSrv, 2002, storage);
}
Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id) {
Result capscRegisterAppletResourceUserId(u64 appletResourceUserId, const CapsApplicationId *application_id) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u64 appletResourceUserId;
u64 applicationId;
} in = { appletResourceUserId, application_id };
return serviceDispatchIn(&g_capscSrv, 2011, in);
if (hosversionAtLeast(19,0,0)) {
const struct {
u64 appletResourceUserId;
CapsApplicationId applicationId;
} in = { appletResourceUserId, *application_id };
return serviceDispatchIn(&g_capscSrv, 2011, in);
}
else {
const struct {
u64 appletResourceUserId;
u64 applicationId;
} in = { appletResourceUserId, application_id->application_id };
return serviceDispatchIn(&g_capscSrv, 2011, in);
}
}
Result capscUnregisterAppletResourceUserId(u64 appletResourceUserId, u64 application_id) {
Result capscUnregisterAppletResourceUserId(u64 appletResourceUserId, const CapsApplicationId *application_id) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u64 appletResourceUserId;
u64 applicationId;
} in = { appletResourceUserId, application_id };
return serviceDispatchIn(&g_capscSrv, 2012, in);
if (hosversionAtLeast(19,0,0)) {
const struct {
u64 appletResourceUserId;
CapsApplicationId applicationId;
} in = { appletResourceUserId, *application_id };
return serviceDispatchIn(&g_capscSrv, 2012, in);
}
else {
const struct {
u64 appletResourceUserId;
u64 applicationId;
} in = { appletResourceUserId, application_id->application_id };
return serviceDispatchIn(&g_capscSrv, 2012, in);
}
}
Result capscGetApplicationIdFromAruid(u64 *application_id, u64 aruid) {
Result capscGetApplicationIdFromAruid(CapsApplicationId *application_id, u64 aruid) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&g_capscSrv, 2013, aruid, *application_id);
if (hosversionAtLeast(19,0,0))
return serviceDispatchInOut(&g_capscSrv, 2013, aruid, *application_id);
else
return serviceDispatchInOut(&g_capscSrv, 2013, aruid, application_id->application_id);
}
Result capscCheckApplicationIdRegistered(u64 application_id) {
@ -86,14 +110,24 @@ Result capscCheckApplicationIdRegistered(u64 application_id) {
return serviceDispatchIn(&g_capscSrv, 2014, application_id);
}
Result capscGenerateCurrentAlbumFileId(u64 application_id, CapsAlbumFileContents contents, CapsAlbumFileId *file_id) {
Result capscGenerateCurrentAlbumFileId(const CapsApplicationId *application_id, CapsAlbumFileContents contents, CapsAlbumFileId *file_id) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u8 type;
u64 applicationId;
} in = { contents, application_id };
return serviceDispatchInOut(&g_capscSrv, 2101, in, *file_id);
if (hosversionAtLeast(19,0,0)) {
const struct {
u8 type;
CapsApplicationId applicationId;
} in = { contents, *application_id };
return serviceDispatchInOut(&g_capscSrv, 2101, in, *file_id);
}
else {
const struct {
u8 type;
u64 applicationId;
} in = { contents, application_id->application_id };
return serviceDispatchInOut(&g_capscSrv, 2101, in, *file_id);
}
}
Result capscGenerateApplicationAlbumEntry(CapsApplicationAlbumEntry *appEntry, const CapsAlbumEntry *entry, u64 application_id) {
@ -109,7 +143,7 @@ Result capscGenerateApplicationAlbumEntry(CapsApplicationAlbumEntry *appEntry, c
Result capscSaveAlbumScreenShotFile(const CapsAlbumFileId *file_id, const void* buffer, u64 buffer_size) {
if (hosversionBefore(2,0,0) || hosversionAtLeast(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchIn(&g_capscSrv, 2201, file_id,
return serviceDispatchIn(&g_capscSrv, 2201, *file_id,
.buffer_attrs = { SfBufferAttr_HipcMapTransferAllowsNonSecure | SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { buffer, buffer_size }, },
);

View File

@ -39,3 +39,47 @@ Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption
}
);
}
Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size) {
if (hosversionBefore(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u32 width;
u32 height;
CapsScreenShotDecodeOption opts;
} in = { width, height, *opts };
return serviceDispatchInOut(&g_capsdcSrv, 4001, in, *out_result_size,
.buffer_attrs = {
SfBufferAttr_In | SfBufferAttr_HipcMapAlias,
SfBufferAttr_Out | SfBufferAttr_HipcMapAlias | SfBufferAttr_HipcMapTransferAllowsNonSecure,
},
.buffers = {
{ jpeg, jpeg_size },
{ out_jpeg, out_jpeg_size },
}
);
}
Result capsdcShrinkJpegEx(u32 scaled_width, u32 scaled_height, u32 jpeg_quality, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size) {
if (hosversionBefore(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u32 scaled_width;
u32 scaled_height;
u32 jpeg_quality;
u8 pad[4];
CapsScreenShotDecodeOption opts;
} in = { scaled_width, scaled_height, jpeg_quality, {}, *opts };
return serviceDispatchInOut(&g_capsdcSrv, 4002, in, *out_result_size,
.buffer_attrs = {
SfBufferAttr_In | SfBufferAttr_HipcMapAlias,
SfBufferAttr_Out | SfBufferAttr_HipcMapAlias | SfBufferAttr_HipcMapTransferAllowsNonSecure,
},
.buffers = {
{ jpeg, jpeg_size },
{ out_jpeg, out_jpeg_size },
}
);
}

View File

@ -44,3 +44,20 @@ Result clkrstSetClockRate(ClkrstSession* session, u32 hz) {
Result clkrstGetClockRate(ClkrstSession* session, u32 *out_hz) {
return serviceDispatchOut(&session->s, 8, *out_hz);
}
Result clkrstGetPossibleClockRates(ClkrstSession *session, u32 *rates, s32 max_count, PcvClockRatesListType *out_type, s32 *out_count) {
struct {
s32 type;
s32 count;
} out;
Result rc = serviceDispatchInOut(&session->s, 10, max_count, out,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcAutoSelect, },
.buffers = { { rates, max_count * sizeof(u32) }, }
);
if (R_SUCCEEDED(rc) && out_type) *out_type = out.type;
if (R_SUCCEEDED(rc) && out_count) *out_count = out.count;
return rc;
}

View File

@ -53,7 +53,7 @@ static void _fatalCmd(Result err, FatalPolicy type, FatalCpuContext *ctx, u32 cm
}
}
void NORETURN fatalThrow(Result err) {
void NX_NORETURN fatalThrow(Result err) {
// By default, do not generate an error report.
fatalThrowWithPolicy(err, FatalPolicy_ErrorScreen);
svcExitProcess();

View File

@ -60,13 +60,17 @@ NX_INLINE Result _fsObjectDispatchImpl(
_fsObjectDispatchImpl((_s),(_rid),NULL,0,NULL,0,(SfDispatchParams){ __VA_ARGS__ })
#define _fsObjectDispatchIn(_s,_rid,_in,...) \
_fsObjectDispatchImpl((_s),(_rid),&(_in),sizeof(_in),NULL,0,(SfDispatchParams){ __VA_ARGS__ })
({ _Static_assert(!(serviceMacroDetectIsPointer(_in))); \
_fsObjectDispatchImpl((_s),(_rid),&(_in),sizeof(_in),NULL,0,(SfDispatchParams){ __VA_ARGS__ }); })
#define _fsObjectDispatchOut(_s,_rid,_out,...) \
_fsObjectDispatchImpl((_s),(_rid),NULL,0,&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ })
({ _Static_assert(!(serviceMacroDetectIsPointer(_out))); \
_fsObjectDispatchImpl((_s),(_rid),NULL,0,&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ }); })
#define _fsObjectDispatchInOut(_s,_rid,_in,_out,...) \
_fsObjectDispatchImpl((_s),(_rid),&(_in),sizeof(_in),&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ })
({ _Static_assert(!(serviceMacroDetectIsPointer(_in))); \
_Static_assert(!(serviceMacroDetectIsPointer(_out))); \
_fsObjectDispatchImpl((_s),(_rid),&(_in),sizeof(_in),&(_out),sizeof(_out),(SfDispatchParams){ __VA_ARGS__ }); })
NX_GENERATE_SERVICE_GUARD(fs);
@ -121,6 +125,14 @@ static Result _fsCmdNoInOutU8(Service* srv, u8 *out, u32 cmd_id) {
return _fsObjectDispatchOut(srv, cmd_id, *out);
}
static Result _fsCmdNoInOutU32(Service* srv, u32 *out, u32 cmd_id) {
return _fsObjectDispatchOut(srv, cmd_id, *out);
}
static Result _fsCmdNoInOutS64(Service* srv, s64 *out, u32 cmd_id) {
return _fsObjectDispatchOut(srv, cmd_id, *out);
}
static Result _fsCmdNoInOutBool(Service* srv, bool *out, u32 cmd_id) {
u8 tmp=0;
Result rc = _fsCmdNoInOutU8(srv, &tmp, cmd_id);
@ -128,6 +140,13 @@ static Result _fsCmdNoInOutBool(Service* srv, bool *out, u32 cmd_id) {
return rc;
}
static Result _fsCmdInSizeOutBuffer(Service* srv, void *dst, size_t dst_size, s64 size, u32 cmd_id) {
return _fsObjectDispatchIn(srv, cmd_id, size,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { dst, dst_size } },
);
}
//-----------------------------------------------------------------------------
// IFileSystemProxy
//-----------------------------------------------------------------------------
@ -534,6 +553,20 @@ Result fsIsSignedSystemPartitionOnSdCardValid(bool *out) {
return _fsCmdNoInOutBool(&g_fsSrv, out, 640);
}
Result fsGetProgramId(u64* out, const char *path, FsContentAttributes attr) {
if (hosversionBefore(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
char send_path[FS_MAX_PATH] = {0};
strncpy(send_path, path, FS_MAX_PATH-1);
const u8 in = attr;
return _fsObjectDispatchInOut(&g_fsSrv, 618, in, *out,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
.buffers = { { send_path, sizeof(send_path) } },
);
}
Result fsGetRightsIdByPath(const char* path, FsRightsId* out_rights_id) {
if (!hosversionBetween(2, 16))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -583,6 +616,20 @@ Result fsGetRightsIdAndKeyGenerationByPath(const char* path, FsContentAttributes
return rc;
}
Result fsGetAndClearErrorInfo(FsFileSystemProxyErrorInfo *out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsObjectDispatchOut(&g_fsSrv, 800, *out);
}
Result fsGetContentStorageInfoIndex(s32 *out) {
if (hosversionBefore(19,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdNoInOutU32(&g_fsSrv, (u32 *)out, 820);
}
Result fsDisableAutoSaveDataCreation(void) {
return _fsCmdNoIO(&g_fsSrv, 1003);
}
@ -619,6 +666,12 @@ Result fsGetProgramIndexForAccessLog(u32 *out_program_index, u32 *out_program_co
return rc;
}
Result fsGetAndClearMemoryReportInfo(FsMemoryReportInfo* out) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsObjectDispatchOut(&g_fsSrv, 1009, *out);
}
// Wrapper(s) for fsCreateSaveDataFileSystem.
Result fsCreate_TemporaryStorage(u64 application_id, u64 owner_id, s64 size, u32 flags) {
FsSaveDataAttribute attr = {
@ -891,6 +944,13 @@ Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *
);
}
Result fsFsGetFileSystemAttribute(FsFileSystem* fs, FsFileSystemAttribute *out) {
if (hosversionBefore(15,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsObjectDispatchOut(&fs->s, 16, *out);
}
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path) {
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute);
}
@ -1087,10 +1147,83 @@ void fsEventNotifierClose(FsEventNotifier* e) {
// IDeviceOperator
//-----------------------------------------------------------------------------
static Result _fsCmdGetAndClearStorageErrorInfo(Service *srv, FsStorageErrorInfo* out_sei, s64 *out_log_size, void *dst, size_t dst_size, s64 size, u32 cmd_id) {
struct {
FsStorageErrorInfo error_info;
s64 log_size;
} out;
Result rc = _fsObjectDispatchInOut(srv, cmd_id, size, out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { dst, dst_size } },
);
if (R_SUCCEEDED(rc)) {
*out_sei = out.error_info;
*out_log_size = out.log_size;
}
return rc;
}
Result fsDeviceOperatorIsSdCardInserted(FsDeviceOperator* d, bool* out) {
return _fsCmdNoInOutBool(&d->s, out, 0);
}
Result fsDeviceOperatorGetSdCardSpeedMode(FsDeviceOperator* d, s64* out) {
return _fsCmdNoInOutS64(&d->s, out, 1);
}
Result fsDeviceOperatorGetSdCardCid(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdInSizeOutBuffer(&d->s, dst, dst_size, size, 2);
}
Result fsDeviceOperatorGetSdCardUserAreaSize(FsDeviceOperator* d, s64* out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdNoInOutS64(&d->s, out, 3);
}
Result fsDeviceOperatorGetSdCardProtectedAreaSize(FsDeviceOperator* d, s64* out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdNoInOutS64(&d->s, out, 4);
}
Result fsDeviceOperatorGetAndClearSdCardErrorInfo(FsDeviceOperator* d, FsStorageErrorInfo* out, s64 *out_log_size, void *dst, size_t dst_size, s64 size) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdGetAndClearStorageErrorInfo(&d->s, out, out_log_size, dst, dst_size, size, 5);
}
Result fsDeviceOperatorGetMmcCid(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size) {
return _fsCmdInSizeOutBuffer(&d->s, dst, dst_size, size, 100);
}
Result fsDeviceOperatorGetMmcSpeedMode(FsDeviceOperator* d, s64* out) {
return _fsCmdNoInOutS64(&d->s, out, 101);
}
Result fsDeviceOperatorGetMmcPatrolCount(FsDeviceOperator* d, u32* out) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdNoInOutU32(&d->s, out, 112);
}
Result fsDeviceOperatorGetAndClearMmcErrorInfo(FsDeviceOperator* d, FsStorageErrorInfo* out, s64 *out_log_size, void *dst, size_t dst_size, s64 size) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdGetAndClearStorageErrorInfo(&d->s, out, out_log_size, dst, dst_size, size, 113);
}
Result fsDeviceOperatorGetMmcExtendedCsd(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdInSizeOutBuffer(&d->s, dst, dst_size, size, 114);
}
Result fsDeviceOperatorIsGameCardInserted(FsDeviceOperator* d, bool* out) {
return _fsCmdNoInOutBool(&d->s, out, 200);
}
@ -1099,10 +1232,74 @@ Result fsDeviceOperatorGetGameCardHandle(FsDeviceOperator* d, FsGameCardHandle*
return _fsObjectDispatchOut(&d->s, 202, *out);
}
Result fsDeviceOperatorGetGameCardUpdatePartitionInfo(FsDeviceOperator* d, const FsGameCardHandle* handle, FsGameCardUpdatePartitionInfo* out) {
return _fsObjectDispatchInOut(&d->s, 203, *handle, *out);
}
Result fsDeviceOperatorGetGameCardAttribute(FsDeviceOperator* d, const FsGameCardHandle* handle, u8 *out) {
return _fsObjectDispatchInOut(&d->s, 205, *handle, *out);
}
Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator* d, const FsGameCardHandle* handle, void* dst, size_t dst_size, s64* out_size, s64 size) {
const struct {
FsGameCardHandle handle;
s64 buffer_size;
} in = { *handle, size };
// Assume old gamecard certificate size on pre-19.0.0
s64 os = 0x200;
Result rc;
if (hosversionAtLeast(19,0,0)) {
rc = _fsObjectDispatchInOut(&d->s, 206, in, os,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { dst, dst_size } });
} else {
rc = _fsObjectDispatchIn(&d->s, 206, in,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { dst, dst_size } });
}
if (R_SUCCEEDED(rc))
*out_size = os;
return rc;
}
Result fsDeviceOperatorGetGameCardIdSet(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size) {
return _fsCmdInSizeOutBuffer(&d->s, dst, dst_size, size, 208);
}
Result fsDeviceOperatorGetGameCardErrorReportInfo(FsDeviceOperator* d, FsGameCardErrorReportInfo* out) {
if (hosversionBefore(2,1,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsObjectDispatchOut(&d->s, 217, *out);
}
Result fsDeviceOperatorGetGameCardDeviceId(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsCmdInSizeOutBuffer(&d->s, dst, dst_size, size, 218);
}
Result fsDeviceOperatorChallengeCardExistence(FsDeviceOperator* d, const FsGameCardHandle* handle, void* dst, size_t dst_size, void* seed, size_t seed_size, void* value, size_t value_size) {
if (hosversionBefore(8,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsObjectDispatchIn(&d->s, 219, *handle,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ dst, dst_size },
{ seed, seed_size },
{ value, value_size },
},
);
}
void fsDeviceOperatorClose(FsDeviceOperator* d) {
_fsObjectClose(&d->s);
}

View File

@ -32,13 +32,51 @@ Service* fsldrGetServiceSession(void) {
return &g_fsldrSrv;
}
Result fsldrOpenCodeFileSystem(FsCodeInfo* out_code_info, u64 tid, const char *path, FsContentAttributes attr, FsFileSystem* out) {
Result fsldrOpenCodeFileSystem(FsCodeInfo* out_code_info, u64 tid, NcmStorageId storage_id, const char *path, FsContentAttributes attr, FsFileSystem* out) {
memset(out_code_info, 0, sizeof(*out_code_info));
char send_path[FS_MAX_PATH]={0};
strncpy(send_path, path, FS_MAX_PATH-1);
if (hosversionBefore(20,0,0))
strncpy(send_path, path, FS_MAX_PATH-1);
if (hosversionAtLeast(16,0,0)) {
if (hosversionAtLeast(20,0,0)) {
const struct {
u8 attr;
u8 storage_id;
u64 tid;
} in = { attr, storage_id, tid };
serviceAssumeDomain(&g_fsldrSrv);
return serviceDispatchIn(&g_fsldrSrv, 0, in,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
},
.buffers = {
{ out_code_info, sizeof(*out_code_info) },
},
.out_num_objects = 1,
.out_objects = &out->s,
);
} else if (hosversionAtLeast(17,0,0)) {
const struct {
u8 attr;
u64 tid;
} in = { attr, tid };
serviceAssumeDomain(&g_fsldrSrv);
return serviceDispatchIn(&g_fsldrSrv, 0, in,
.buffer_attrs = {
SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_In,
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
},
.buffers = {
{ send_path, FS_MAX_PATH },
{ out_code_info, sizeof(*out_code_info) },
},
.out_num_objects = 1,
.out_objects = &out->s,
);
} else if (hosversionAtLeast(16,0,0)) {
const struct {
u8 attr;
u64 tid;

View File

@ -32,7 +32,7 @@ Service* fsprGetServiceSession(void) {
static const uint32_t g_fspr_default_fah[] = {0x1, 0xFFFFFFFF, 0xFFFFFFFF, 0x1C, 0, 0x1C, 0};
static const uint32_t g_fspr_default_fac[] = {0x1, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF};
Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size) {
Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size, u8 fs_access_control_restriction_mode) {
if (fs_access_header == NULL) {
fs_access_header = g_fspr_default_fah;
fah_size = sizeof(g_fspr_default_fah);
@ -44,12 +44,13 @@ Result fsprRegisterProgram(u64 pid, u64 tid, NcmStorageId sid, const void *fs_ac
const struct {
u8 sid;
u8 pad[7];
u8 fs_access_control_restriction_mode;
u8 pad[6];
u64 pid;
u64 tid;
u64 fah_size;
u64 fac_size;
} in = { sid, {0}, pid, tid, fah_size, fac_size };
} in = { sid, fs_access_control_restriction_mode, {0}, pid, tid, fah_size, fac_size };
serviceAssumeDomain(&g_fsprSrv);
return serviceDispatchIn(&g_fsprSrv, 0, in,
.buffer_attrs = {

View File

@ -123,10 +123,16 @@ Result gpioPadGetInterruptEnable(GpioPadSession *p, bool *out) {
Result gpioPadGetInterruptStatus(GpioPadSession *p, GpioInterruptStatus *out) {
_Static_assert(sizeof(*out) == sizeof(u32), "GpioInterruptStatus size");
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _gpioCmdNoInOutU32(&p->s, (u32 *)out, 6);
}
Result gpioPadClearInterruptStatus(GpioPadSession *p) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _gpioCmdNoInNoOut(&p->s, 7);
}

View File

@ -275,6 +275,33 @@ size_t hidGetKeyboardStates(HidKeyboardState *states, size_t count) {
return total;
}
size_t hidGetHomeButtonStates(HidHomeButtonState *states, size_t count) {
HidSharedMemory *sharedmem = (HidSharedMemory*)hidGetSharedmemAddr();
if (sharedmem == NULL)
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_NotInitialized));
size_t total = _hidGetStates(&sharedmem->home_button.lifo.header, sharedmem->home_button.lifo.storage, 17, offsetof(HidHomeButtonStateAtomicStorage,state), offsetof(HidHomeButtonState,sampling_number), states, sizeof(HidHomeButtonState), count);
return total;
}
size_t hidGetSleepButtonStates(HidSleepButtonState *states, size_t count) {
HidSharedMemory *sharedmem = (HidSharedMemory*)hidGetSharedmemAddr();
if (sharedmem == NULL)
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_NotInitialized));
size_t total = _hidGetStates(&sharedmem->sleep_button.lifo.header, sharedmem->sleep_button.lifo.storage, 17, offsetof(HidSleepButtonStateAtomicStorage,state), offsetof(HidSleepButtonState,sampling_number), states, sizeof(HidSleepButtonState), count);
return total;
}
size_t hidGetCaptureButtonStates(HidCaptureButtonState *states, size_t count) {
HidSharedMemory *sharedmem = (HidSharedMemory*)hidGetSharedmemAddr();
if (sharedmem == NULL)
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_NotInitialized));
size_t total = _hidGetStates(&sharedmem->capture_button.lifo.header, sharedmem->capture_button.lifo.storage, 17, offsetof(HidCaptureButtonStateAtomicStorage,state), offsetof(HidCaptureButtonState,sampling_number), states, sizeof(HidCaptureButtonState), count);
return total;
}
void hidInitializeNpad(void) {
Result rc = _hidActivateNpad();
if (R_FAILED(rc)) diagAbortWithResult(rc);
@ -948,6 +975,8 @@ static Result _hidActivateNpad(void) {
revision = 0x2; // [6.0.0+]
if (hosversionAtLeast(8,0,0))
revision = 0x3; // [8.0.0+]
if (hosversionAtLeast(18,0,0))
revision = 0x5; // [18.0.0+]
return _hidCmdInU32AruidNoOut(revision, 109); // ActivateNpadWithRevision
}

View File

@ -9,6 +9,7 @@ static Service g_hiddbgSrv;
static bool g_hiddbgHdlsInitialized;
static TransferMemory g_hiddbgHdlsTmem;
static void* g_hiddbgHdlsWorkmem;
static const u32 g_hiddbgDeviceTypeInternalTable[] = {
BIT(20), // DeviceType 0 Invalid
@ -483,7 +484,10 @@ Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id, void *buffer,
rc = _hiddbgAttachHdlsWorkBuffer(session_id, &g_hiddbgHdlsTmem);
if (R_FAILED(rc)) tmemClose(&g_hiddbgHdlsTmem);
if (R_SUCCEEDED(rc)) g_hiddbgHdlsInitialized = true;
if (R_SUCCEEDED(rc)) {
g_hiddbgHdlsInitialized = true;
g_hiddbgHdlsWorkmem = buffer;
}
return rc;
}
@ -504,6 +508,7 @@ Result hiddbgReleaseHdlsWorkBuffer(HiddbgHdlsSessionId session_id) {
rc = _hiddbgCmdInU64NoOut(session_id.id, 325);
tmemClose(&g_hiddbgHdlsTmem);
g_hiddbgHdlsWorkmem = NULL;
return rc;
}
@ -525,7 +530,7 @@ Result hiddbgIsHdlsVirtualDeviceAttached(HiddbgHdlsSessionId session_id, HiddbgH
if (out) {
*out = false;
if (hosversionBefore(9,0,0)) {
HiddbgHdlsStateListV7 *stateList = (HiddbgHdlsStateListV7*)(g_hiddbgHdlsTmem.src_addr);
HiddbgHdlsStateListV7 *stateList = (HiddbgHdlsStateListV7*)g_hiddbgHdlsWorkmem;
for (s32 i=0; i<stateList->total_entries; i++) {
if (stateList->entries[i].handle.handle == handle.handle) {
*out = true;
@ -534,7 +539,7 @@ Result hiddbgIsHdlsVirtualDeviceAttached(HiddbgHdlsSessionId session_id, HiddbgH
}
}
else if (hosversionBefore(12,0,0)) {
HiddbgHdlsStateListV9 *stateList = (HiddbgHdlsStateListV9*)(g_hiddbgHdlsTmem.src_addr);
HiddbgHdlsStateListV9 *stateList = (HiddbgHdlsStateListV9*)g_hiddbgHdlsWorkmem;
for (s32 i=0; i<stateList->total_entries; i++) {
if (stateList->entries[i].handle.handle == handle.handle) {
*out = true;
@ -543,7 +548,7 @@ Result hiddbgIsHdlsVirtualDeviceAttached(HiddbgHdlsSessionId session_id, HiddbgH
}
}
else {
HiddbgHdlsStateList *stateList = (HiddbgHdlsStateList*)(g_hiddbgHdlsTmem.src_addr);
HiddbgHdlsStateList *stateList = (HiddbgHdlsStateList*)g_hiddbgHdlsWorkmem;
for (s32 i=0; i<stateList->total_entries; i++) {
if (stateList->entries[i].handle.handle == handle.handle) {
*out = true;
@ -570,7 +575,7 @@ Result hiddbgDumpHdlsNpadAssignmentState(HiddbgHdlsSessionId session_id, HiddbgH
rc = _hiddbgCmdInU64NoOut(session_id.id, 326);
if (R_FAILED(rc)) return rc;
if (state) memcpy(state, g_hiddbgHdlsTmem.src_addr, sizeof(*state));
if (state) memcpy(state, g_hiddbgHdlsWorkmem, sizeof(*state));
return rc;
}
@ -592,16 +597,16 @@ Result hiddbgDumpHdlsStates(HiddbgHdlsSessionId session_id, HiddbgHdlsStateList
if (state) {
if (hosversionBefore(9,0,0)) {
HiddbgHdlsStateListV7 statev7;
memcpy(&statev7, g_hiddbgHdlsTmem.src_addr, sizeof(statev7));
memcpy(&statev7, g_hiddbgHdlsWorkmem, sizeof(statev7));
_hiddbgConvertHdlsStateListFromV7(state, &statev7);
}
else if (hosversionBefore(12,0,0)) {
HiddbgHdlsStateListV9 statev9;
memcpy(&statev9, g_hiddbgHdlsTmem.src_addr, sizeof(statev9));
memcpy(&statev9, g_hiddbgHdlsWorkmem, sizeof(statev9));
_hiddbgConvertHdlsStateListFromV9(state, &statev9);
}
else
memcpy(state, g_hiddbgHdlsTmem.src_addr, sizeof(*state));
memcpy(state, g_hiddbgHdlsWorkmem, sizeof(*state));
}
return rc;
}
@ -616,7 +621,7 @@ Result hiddbgApplyHdlsNpadAssignmentState(HiddbgHdlsSessionId session_id, const
if (state==NULL)
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
memcpy(g_hiddbgHdlsTmem.src_addr, state, sizeof(*state));
memcpy(g_hiddbgHdlsWorkmem, state, sizeof(*state));
if (hosversionBefore(13,0,0))
return _hiddbgCmdInBoolNoOut(flag, 328);
@ -644,15 +649,15 @@ Result hiddbgApplyHdlsStateList(HiddbgHdlsSessionId session_id, const HiddbgHdls
if (hosversionBefore(9,0,0)) {
HiddbgHdlsStateListV7 statev7;
_hiddbgConvertHdlsStateListToV7(&statev7, state);
memcpy(g_hiddbgHdlsTmem.src_addr, &statev7, sizeof(statev7));
memcpy(g_hiddbgHdlsWorkmem, &statev7, sizeof(statev7));
}
else if (hosversionBefore(12,0,0)) {
HiddbgHdlsStateListV9 statev9;
_hiddbgConvertHdlsStateListToV9(&statev9, state);
memcpy(g_hiddbgHdlsTmem.src_addr, &statev9, sizeof(statev9));
memcpy(g_hiddbgHdlsWorkmem, &statev9, sizeof(statev9));
}
else
memcpy(g_hiddbgHdlsTmem.src_addr, state, sizeof(*state));
memcpy(g_hiddbgHdlsWorkmem, state, sizeof(*state));
if (hosversionBefore(13,0,0))
return _hiddbgCmdNoIO(329);

View File

@ -81,6 +81,10 @@ static Result _hidsysCmdNoInOutU8(u8 *out, u32 cmd_id) {
return serviceDispatchOut(&g_hidsysSrv, cmd_id, *out);
}
static Result _hidsysCmdNoInOutU32(u32 *out, u32 cmd_id) {
return serviceDispatchOut(&g_hidsysSrv, cmd_id, *out);
}
static Result _hidsysCmdNoInOutBool(bool *out, u32 cmd_id) {
u8 tmp=0;
Result rc = _hidsysCmdNoInOutU8(&tmp, cmd_id);
@ -251,6 +255,14 @@ Result hidsysActivateCaptureButton(void) {
return _hidsysCmdWithResIdAndPid(151);
}
Result hidsysApplyNpadSystemCommonPolicy(void) {
return _hidsysCmdNoIO(303);
}
Result hidsysGetLastActiveNpad(u32 *out) {
return _hidsysCmdNoInOutU32(out, 306);
}
static Result _hidsysGetMaskedSupportedNpadStyleSet(u64 AppletResourceUserId, u32 *out) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -328,6 +340,49 @@ Result hidsysEnableAppletToGetInput(bool enable) {
return serviceDispatchIn(&g_hidsysSrv, 503, in);
}
Result hidsysEnableHandheldHids(void) {
return _hidsysCmdNoIO(520);
}
Result hidsysDisableHandheldHids(void) {
return _hidsysCmdNoIO(521);
}
Result hidsysSetJoyConRailEnabled(bool enable) {
if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInBoolNoOut(enable, 522);
}
Result hidsysIsJoyConRailEnabled(bool *out) {
if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoInOutBool(out, 523);
}
Result hidsysIsHandheldHidsEnabled(bool *out) {
if (hosversionBefore(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoInOutBool(out, 524);
}
Result hidsysIsJoyConAttachedOnAllRail(bool *out) {
if (hosversionBefore(11,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoInOutBool(out, 525);
}
Result hidsysIsInvertedControllerConnectedOnRail(bool *out) {
if (hosversionBefore(19,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoInOutBool(out, 526);
}
Result hidsysAcquireUniquePadConnectionEventHandle(Event *out_event) {
Handle tmp_handle = INVALID_HANDLE;
@ -350,6 +405,10 @@ Result hidsysGetUniquePadIds(HidsysUniquePadId *unique_pad_ids, s32 count, s32 *
return rc;
}
Result hidsysAcquireJoyDetachOnBluetoothOffEventHandle(Event *out_event, bool autoclear) {
return _hidsysCmdInPidAruidOutEvent(out_event, autoclear, 751);
}
Result hidsysGetUniquePadBluetoothAddress(HidsysUniquePadId unique_pad_id, BtdrvAddress *address) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -445,6 +504,13 @@ Result hidsysIsUsbConnected(HidsysUniquePadId unique_pad_id, bool *out) {
return _hidsysCmdInU64OutBool(unique_pad_id.id, out, 852);
}
Result hidsysGetTouchScreenDefaultConfiguration(HidTouchScreenConfigurationForNx *touch_screen_configuration) {
if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchOut(&g_hidsysSrv, 1153, *touch_screen_configuration);
}
Result hidsysIsFirmwareUpdateNeededForNotification(HidsysUniquePadId unique_pad_id, bool *out) {
if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -474,14 +540,14 @@ Result hidsysLegacyIsButtonConfigSupported(HidsysUniquePadId unique_pad_id, bool
}
Result hidsysIsButtonConfigSupported(BtdrvAddress addr, bool *out) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrOutBool(addr, out, 1200);
}
Result hidsysIsButtonConfigEmbeddedSupported(bool *out) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoInOutBool(out, 1201);
@ -495,14 +561,14 @@ Result hidsysLegacyDeleteButtonConfig(HidsysUniquePadId unique_pad_id) {
}
Result hidsysDeleteButtonConfig(BtdrvAddress addr) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrNoOut(addr, 1202);
}
Result hidsysDeleteButtonConfigEmbedded(void) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoIO(1203);
@ -516,14 +582,14 @@ Result hidsysLegacySetButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool
}
Result hidsysSetButtonConfigEnabled(BtdrvAddress addr, bool flag) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrInBoolNoOut(addr, flag, 1204);
}
Result hidsysSetButtonConfigEmbeddedEnabled(bool flag) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInBoolNoOut(flag, 1205);
@ -537,14 +603,14 @@ Result hidsysLegacyIsButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool *
}
Result hidsysIsButtonConfigEnabled(BtdrvAddress addr, bool *out) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrInBoolNoOut(addr, out, 1206);
}
Result hidsysIsButtonConfigEmbeddedEnabled(bool *out) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdNoInOutBool(out, 1207);
@ -558,7 +624,7 @@ Result hidsysLegacySetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, cons
}
Result hidsysSetButtonConfigEmbedded(const HidsysButtonConfigEmbedded *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatch(&g_hidsysSrv, 1208,
@ -575,7 +641,7 @@ Result hidsysLegacySetButtonConfigFull(HidsysUniquePadId unique_pad_id, const Hi
}
Result hidsysSetButtonConfigFull(BtdrvAddress addr, const HidsysButtonConfigFull *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrInBufFixedNoOut(addr, config, sizeof(*config), 1209);
@ -589,7 +655,7 @@ Result hidsysLegacySetButtonConfigLeft(HidsysUniquePadId unique_pad_id, const Hi
}
Result hidsysSetButtonConfigLeft(BtdrvAddress addr, const HidsysButtonConfigLeft *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrInBufFixedNoOut(addr, config, sizeof(*config), 12010);
@ -603,7 +669,7 @@ Result hidsysLegacySetButtonConfigRight(HidsysUniquePadId unique_pad_id, const H
}
Result hidsysSetButtonConfigRight(BtdrvAddress addr, const HidsysButtonConfigRight *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrInBufFixedNoOut(addr, config, sizeof(*config), 1211);
@ -617,7 +683,7 @@ Result hidsysLegacyGetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, Hids
}
Result hidsysGetButtonConfigEmbedded(HidsysButtonConfigEmbedded *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatch(&g_hidsysSrv, 1212,
@ -634,7 +700,7 @@ Result hidsysLegacyGetButtonConfigFull(HidsysUniquePadId unique_pad_id, HidsysBu
}
Result hidsysGetButtonConfigFull(BtdrvAddress addr, HidsysButtonConfigFull *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrOutBufFixedNoOut(addr, config, sizeof(*config), 1213);
@ -648,7 +714,7 @@ Result hidsysLegacyGetButtonConfigLeft(HidsysUniquePadId unique_pad_id, HidsysBu
}
Result hidsysGetButtonConfigLeft(BtdrvAddress addr, HidsysButtonConfigLeft *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrOutBufFixedNoOut(addr, config, sizeof(*config), 1214);
@ -662,7 +728,7 @@ Result hidsysLegacyGetButtonConfigRight(HidsysUniquePadId unique_pad_id, HidsysB
}
Result hidsysGetButtonConfigRight(BtdrvAddress addr, HidsysButtonConfigRight *config) {
if (hosversionBefore(11,0,0))
if (!hosversionBetween(11,18))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _hidsysCmdInAddrOutBufFixedNoOut(addr, config, sizeof(*config), 1215);

View File

@ -289,6 +289,13 @@ Result ldnSetWirelessControllerRestriction(LdnWirelessControllerRestriction rest
return _ldnCmdInU32NoOut(&g_ldnSrv, restriction, 104);
}
Result ldnSetProtocol(LdnProtocol protocol) {
if (hosversionBefore(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _ldnCmdInU32NoOut(&g_ldnSrv, protocol, 106);
}
Result ldnOpenAccessPoint(void) {
return _ldnCmdNoIO(&g_ldnSrv, 200);
}

View File

@ -79,21 +79,63 @@ Result ldrDmntGetProcessModuleInfo(u64 pid, LoaderModuleInfo *out_module_infos,
);
}
Result ldrPmCreateProcess(u64 pin_id, u32 flags, Handle reslimit_h, Handle *out_process_h) {
const struct {
u32 flags;
u32 pad;
u64 pin_id;
} in = { flags, 0, pin_id };
return serviceDispatchIn(&g_ldrPmSrv, 0, in,
.in_num_handles = 1,
.in_handles = { reslimit_h },
.out_handle_attrs = { SfOutHandleAttr_HipcMove },
.out_handles = out_process_h,
);
Result ldrPmCreateProcess(u64 pin_id, u32 flags, Handle reslimit_h, const LoaderProgramAttributes *attrs, Handle *out_process_h) {
if (hosversionIsAtmosphere() || hosversionAtLeast(20,0,0)) {
const struct {
LoaderProgramAttributes attr;
u16 pad;
u32 flags;
u64 pin_id;
} in = { *attrs, 0, flags, pin_id };
return serviceDispatchIn(&g_ldrPmSrv, 0, in,
.in_num_handles = 1,
.in_handles = { reslimit_h },
.out_handle_attrs = { SfOutHandleAttr_HipcMove },
.out_handles = out_process_h,
);
} else {
const struct {
u32 flags;
u32 pad;
u64 pin_id;
} in = { flags, 0, pin_id };
return serviceDispatchIn(&g_ldrPmSrv, 0, in,
.in_num_handles = 1,
.in_handles = { reslimit_h },
.out_handle_attrs = { SfOutHandleAttr_HipcMove },
.out_handles = out_process_h,
);
}
}
Result ldrPmGetProgramInfo(const NcmProgramLocation *loc, LoaderProgramInfo *out_program_info) {
Result ldrPmGetProgramInfo(const NcmProgramLocation *loc, const LoaderProgramAttributes *attrs, LoaderProgramInfo *out_program_info) {
if (!hosversionIsAtmosphere() && hosversionBefore(19, 0, 0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
if (hosversionIsAtmosphere() || hosversionAtLeast(20,0,0)) {
const struct {
LoaderProgramAttributes attr;
u16 pad1;
u32 pad2;
NcmProgramLocation loc;
} in = { *attrs, 0, 0, *loc };
_Static_assert(sizeof(in) == 0x18);
return serviceDispatchIn(&g_ldrPmSrv, 1, in,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcPointer | SfBufferAttr_FixedSize },
.buffers = { { out_program_info, sizeof(*out_program_info) } },
);
} else {
return serviceDispatchIn(&g_ldrPmSrv, 1, *loc,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcPointer | SfBufferAttr_FixedSize },
.buffers = { { out_program_info, sizeof(*out_program_info) } },
);
}
}
Result ldrPmGetProgramInfoV1(const NcmProgramLocation *loc, LoaderProgramInfoV1 *out_program_info) {
if (hosversionIsAtmosphere() || hosversionAtLeast(19,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchIn(&g_ldrPmSrv, 1, *loc,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcPointer | SfBufferAttr_FixedSize },
.buffers = { { out_program_info, sizeof(*out_program_info) } },

View File

@ -407,6 +407,16 @@ Result ncmContentStorageClearRegisteredPath(NcmContentStorage* cs) {
return _ncmCmdNoIO(&cs->s, 29);
}
Result ncmContentStorageGetProgramId(NcmContentStorage* cs, u64* out, const NcmContentId* content_id, FsContentAttributes attr) {
if (hosversionBefore(17,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
NcmContentId content_id;
u8 attr;
} in = { *content_id, attr };
return serviceDispatchInOut(&cs->s, 30, in, *out);
}
void ncmContentMetaDatabaseClose(NcmContentMetaDatabase* db) {
serviceClose(&db->s);
}
@ -586,3 +596,9 @@ Result ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(NcmContentMetaDatabas
} in = { type, id_offset, {0}, *key };
return serviceDispatchInOut(&db->s, 20, in, *out_content_id);
}
Result ncmContentMetaDatabaseGetPlatform(NcmContentMetaDatabase* db, u8* out, const NcmContentMetaKey* key) {
if (hosversionBefore(17,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&db->s, 26, *key, *out);
}

View File

@ -10,6 +10,8 @@ static Service g_nfpSrv;
static Service g_nfpInterface;
static Service g_nfcSrv;
static Service g_nfcInterface;
static Service g_nfcMfSrv;
static Service g_nfcMfInterface;
static const NfcRequiredMcuVersionData g_nfcVersionData[2] = {
{
@ -29,6 +31,7 @@ static Result _nfcCmdNoIO(Service* srv, u32 cmd_id);
static Result _nfcCmdInDevhandleNoOut(Service* srv, const NfcDeviceHandle *handle, u32 cmd_id);
static Result _nfcCmdInDevhandleOutEvent(Service* srv, const NfcDeviceHandle *handle, Event *out_event, u32 cmd_id);
static Result _nfcCmdInDevhandleOutBuffer(Service* srv, const NfcDeviceHandle *handle, void* buf, size_t buf_size, u32 cmd_id);
static Result _nfcCmdInDevhandleInBufferNoOut(Service* srv, const NfcDeviceHandle *handle, const void* buf, size_t buf_size, u32 cmd_id);
NX_GENERATE_SERVICE_GUARD_PARAMS(nfp, (NfpServiceType service_type), (service_type));
@ -99,6 +102,31 @@ void _nfcCleanup(void) {
serviceClose(&g_nfcSrv);
}
NX_GENERATE_SERVICE_GUARD(nfcMf);
Result _nfcMfInitialize() {
Result rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
rc = smGetService(&g_nfcMfSrv, "nfc:mf:u");
if (R_SUCCEEDED(rc))
rc = serviceConvertToDomain(&g_nfcMfSrv);
if (R_SUCCEEDED(rc))
rc = _nfcCreateInterface(&g_nfcMfSrv, &g_nfcMfInterface);
if (R_SUCCEEDED(rc))
rc = _nfcInterfaceInitialize(&g_nfcMfInterface, g_nfcVersionData, 2, 0);
return rc;
}
void _nfcMfCleanup(void) {
_nfcCmdNoIO(&g_nfcMfInterface, 1); // Finalize
serviceClose(&g_nfcMfInterface);
serviceClose(&g_nfcMfSrv);
}
Service* nfpGetServiceSession(void) {
return &g_nfpSrv;
}
@ -108,11 +136,19 @@ Service* nfpGetServiceSession_Interface(void) {
}
Service* nfcGetServiceSession(void) {
return &g_nfpSrv;
return &g_nfcSrv;
}
Service* nfcGetServiceSession_Interface(void) {
return &g_nfpInterface;
return &g_nfcInterface;
}
Service* nfcMfGetServiceSession(void) {
return &g_nfcMfSrv;
}
Service* nfcMfGetServiceSession_Interface(void) {
return &g_nfcMfInterface;
}
static Result _nfcCreateInterface(Service* srv, Service* srv_out) {
@ -191,6 +227,14 @@ static Result _nfcCmdInDevhandleOutBuffer(Service* srv, const NfcDeviceHandle *h
);
}
static Result _nfcCmdInDevhandleInBufferNoOut(Service* srv, const NfcDeviceHandle *handle, const void* buf, size_t buf_size, u32 cmd_id) {
serviceAssumeDomain(srv);
return serviceDispatchIn(srv, cmd_id, *handle,
.buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_In },
.buffers = { { buf, buf_size } },
);
}
static Result _nfcInterfaceInitialize(Service* srv, const NfcRequiredMcuVersionData *version, s32 count, u32 cmd_id) {
const struct {
u64 aruid;
@ -213,14 +257,61 @@ Result nfpListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count) {
);
}
Result nfcListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
serviceAssumeDomain(&g_nfcInterface);
return serviceDispatchOut(&g_nfcInterface, 404, *total_out,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { { out, count*sizeof(NfcDeviceHandle) } },
);
}
Result nfcMfListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count) {
serviceAssumeDomain(&g_nfcMfInterface);
return serviceDispatchOut(&g_nfcMfInterface, 2, *total_out,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { { out, count*sizeof(NfcDeviceHandle) } },
);
}
Result nfpStartDetection(const NfcDeviceHandle *handle) {
return _nfcCmdInDevhandleNoOut(&g_nfpInterface, handle, 3);
}
Result nfcStartDetection(const NfcDeviceHandle *handle, NfcProtocol protocol) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
NfcDeviceHandle handle;
NfcProtocol protocol;
} in = { *handle, protocol };
serviceAssumeDomain(&g_nfcInterface);
return serviceDispatchIn(&g_nfcInterface, 408, in);
}
Result nfcMfStartDetection(const NfcDeviceHandle *handle) {
return _nfcCmdInDevhandleNoOut(&g_nfcMfInterface, handle, 3);
}
Result nfpStopDetection(const NfcDeviceHandle *handle) {
return _nfcCmdInDevhandleNoOut(&g_nfpInterface, handle, 4);
}
Result nfcStopDetection(const NfcDeviceHandle *handle) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nfcCmdInDevhandleNoOut(&g_nfcInterface, handle, 409);
}
Result nfcMfStopDetection(const NfcDeviceHandle *handle) {
return _nfcCmdInDevhandleNoOut(&g_nfcMfInterface, handle, 4);
}
Result nfpMount(const NfcDeviceHandle *handle, NfpDeviceType device_type, NfpMountTarget mount_target) {
const struct {
NfcDeviceHandle handle;
@ -249,12 +340,12 @@ Result nfpOpenApplicationArea(const NfcDeviceHandle *handle, u32 app_id) {
return serviceDispatchIn(&g_nfpInterface, 7, in);
}
Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void* buf, size_t buf_size) {
Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void* buf, size_t buf_size, u32 *out_size) {
if (g_nfpServiceType == NfpServiceType_System)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
serviceAssumeDomain(&g_nfpInterface);
return serviceDispatchIn(&g_nfpInterface, 8, *handle,
return serviceDispatchInOut(&g_nfpInterface, 8, *handle, *out_size,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { buf, buf_size } },
);
@ -295,10 +386,64 @@ Result nfpCreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const
);
}
Result nfpRecreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void* buf, size_t buf_size) {
if (g_nfpServiceType == NfpServiceType_System)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
NfcDeviceHandle handle;
u32 app_id;
} in = { *handle, app_id };
serviceAssumeDomain(&g_nfpInterface);
return serviceDispatchIn(&g_nfpInterface, 24, in,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { buf, buf_size } },
);
}
Result nfpGetApplicationAreaSize(const NfcDeviceHandle *handle, u32 *out_app_area_size) {
if (g_nfpServiceType == NfpServiceType_System)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleOutU32(&g_nfpInterface, handle, out_app_area_size, 22);
}
Result nfpDeleteApplicationArea(const NfcDeviceHandle *handle) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleNoOut(&g_nfpInterface, handle, 105);
}
Result nfpExistsApplicationArea(const NfcDeviceHandle *handle, bool *out) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
u32 tmp=0;
Result rc = _nfcCmdInDevhandleOutU32(&g_nfpInterface, handle, &tmp, 106);
if (R_SUCCEEDED(rc) && out) *out = tmp;
return rc;
}
Result nfpGetTagInfo(const NfcDeviceHandle *handle, NfpTagInfo *out) {
return _nfcCmdInDevhandleOutBuffer(&g_nfpInterface, handle, out, sizeof(NfpTagInfo), 13);
}
Result nfcGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nfcCmdInDevhandleOutBuffer(&g_nfcInterface, handle, out, sizeof(NfcTagInfo), 410);
}
Result nfcMfGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out) {
return _nfcCmdInDevhandleOutBuffer(&g_nfcMfInterface, handle, out, sizeof(NfcTagInfo), 7);
}
Result nfpGetRegisterInfo(const NfcDeviceHandle *handle, NfpRegisterInfo *out) {
return _nfcCmdInDevhandleOutBuffer(&g_nfpInterface, handle, out, sizeof(NfpRegisterInfo), 14);
}
@ -311,21 +456,64 @@ Result nfpGetModelInfo(const NfcDeviceHandle *handle, NfpModelInfo *out) {
return _nfcCmdInDevhandleOutBuffer(&g_nfpInterface, handle, out, sizeof(NfpModelInfo), 16);
}
Result nfpGetAdminInfo(const NfcDeviceHandle *handle, NfpAdminInfo *out) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleOutBuffer(&g_nfpInterface, handle, out, sizeof(NfpAdminInfo), 101);
}
Result nfpAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event) {
return _nfcCmdInDevhandleOutEvent(&g_nfpInterface, handle, out_event, 17);
}
Result nfcAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nfcCmdInDevhandleOutEvent(&g_nfcInterface, handle, out_event, 411);
}
Result nfcMfAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event) {
return _nfcCmdInDevhandleOutEvent(&g_nfcMfInterface, handle, out_event, 8);
}
Result nfpAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event) {
return _nfcCmdInDevhandleOutEvent(&g_nfpInterface, handle, out_event, 18);
}
Result nfpGetState(NfpState *out) {
Result nfcAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nfcCmdInDevhandleOutEvent(&g_nfcInterface, handle, out_event, 412);
}
Result nfcMfAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event) {
return _nfcCmdInDevhandleOutEvent(&g_nfcMfInterface, handle, out_event, 9);
}
Result nfpGetState(NfcState *out) {
u32 tmp=0;
Result rc = _nfcCmdNoInOutU32(&g_nfpInterface, &tmp, 19);
if (R_SUCCEEDED(rc) && out) *out = tmp;
return rc;
}
Result nfcGetState(NfcState *out) {
u32 tmp=0;
Result rc = _nfcCmdNoInOutU32(&g_nfcInterface, &tmp, hosversionBefore(4,0,0) ? 2 : 402);
if (R_SUCCEEDED(rc) && out) *out = tmp;
return rc;
}
Result nfcMfGetState(NfcState *out) {
u32 tmp=0;
Result rc = _nfcCmdNoInOutU32(&g_nfcMfInterface, &tmp, 10);
if (R_SUCCEEDED(rc) && out) *out = tmp;
return rc;
}
Result nfpGetDeviceState(const NfcDeviceHandle *handle, NfpDeviceState *out) {
u32 tmp=0;
Result rc = _nfcCmdInDevhandleOutU32(&g_nfpInterface, handle, &tmp, 20);
@ -333,10 +521,38 @@ Result nfpGetDeviceState(const NfcDeviceHandle *handle, NfpDeviceState *out) {
return rc;
}
Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u32 tmp=0;
Result rc = _nfcCmdInDevhandleOutU32(&g_nfcInterface, handle, &tmp, 405);
if (R_SUCCEEDED(rc) && out) *out = tmp;
return rc;
}
Result nfcMfGetDeviceState(const NfcDeviceHandle *handle, NfcMifareDeviceState *out) {
u32 tmp=0;
Result rc = _nfcCmdInDevhandleOutU32(&g_nfcMfInterface, handle, &tmp, 11);
if (R_SUCCEEDED(rc) && out) *out = tmp;
return rc;
}
Result nfpGetNpadId(const NfcDeviceHandle *handle, u32 *out) {
return _nfcCmdInDevhandleOutU32(&g_nfpInterface, handle, out, 21);
}
Result nfcGetNpadId(const NfcDeviceHandle *handle, u32 *out) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nfcCmdInDevhandleOutU32(&g_nfcInterface, handle, out, 406);
}
Result nfcMfGetNpadId(const NfcDeviceHandle *handle, u32 *out) {
return _nfcCmdInDevhandleOutU32(&g_nfcMfInterface, handle, out, 12);
}
Result nfpAttachAvailabilityChangeEvent(Event *out_event) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -344,10 +560,185 @@ Result nfpAttachAvailabilityChangeEvent(Event *out_event) {
return _nfcCmdGetEvent(&g_nfpInterface, out_event, true, 23);
}
Result nfcAttachAvailabilityChangeEvent(Event *out_event) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nfcCmdGetEvent(&g_nfcInterface, out_event, true, 407);
}
Result nfcMfAttachAvailabilityChangeEvent(Event *out_event) {
return _nfcCmdGetEvent(&g_nfcMfInterface, out_event, true, 13);
}
Result nfcFormat(const NfcDeviceHandle *handle) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleNoOut(&g_nfcInterface, handle, 100);
}
Result nfpGetRegisterInfoPrivate(const NfcDeviceHandle *handle, NfpRegisterInfoPrivate *out) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleOutBuffer(&g_nfpInterface, handle, out, sizeof(NfpRegisterInfoPrivate), 102);
}
Result nfpSetRegisterInfoPrivate(const NfcDeviceHandle *handle, const NfpRegisterInfoPrivate *register_info_private) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleInBufferNoOut(&g_nfcInterface, handle, register_info_private, sizeof(NfpRegisterInfoPrivate) , 103);
}
Result nfpDeleteRegisterInfo(const NfcDeviceHandle *handle) {
if (g_nfpServiceType == NfpServiceType_User)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleNoOut(&g_nfcInterface, handle, 104);
}
Result nfpGetAll(const NfcDeviceHandle *handle, NfpData *out) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleOutBuffer(&g_nfpInterface, handle, out, sizeof(NfpData), 200);
}
Result nfpSetAll(const NfcDeviceHandle *handle, const NfpData *nfp_data) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleInBufferNoOut(&g_nfcInterface, handle, nfp_data, sizeof(NfpData) , 201);
}
Result nfpFlushDebug(const NfcDeviceHandle *handle) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _nfcCmdInDevhandleNoOut(&g_nfcInterface, handle, 202);
}
Result nfpBreakTag(const NfcDeviceHandle *handle, NfpBreakType break_type) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
const struct {
NfcDeviceHandle handle;
u32 break_type;
} in = { *handle, break_type };
serviceAssumeDomain(&g_nfpInterface);
return serviceDispatchIn(&g_nfpInterface, 203, in);
}
Result nfpReadBackupData(const NfcDeviceHandle *handle, void* out_buf, size_t buf_size, u32 *out_size) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
serviceAssumeDomain(&g_nfpInterface);
return serviceDispatchInOut(&g_nfpInterface, 204, *handle, *out_size,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { out_buf, buf_size } },
);
}
Result nfpWriteBackupData(const NfcDeviceHandle *handle, const void* buf, size_t buf_size) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
serviceAssumeDomain(&g_nfpInterface);
return serviceDispatchIn(&g_nfpInterface, 205, *handle,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { buf, buf_size } },
);
}
/// Only available with ::NfpServiceType_Debug.
Result nfpWriteNtf(const NfcDeviceHandle *handle, u32 write_type, const void* buf, size_t buf_size) {
if (g_nfpServiceType != NfpServiceType_Debug)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
const struct {
NfcDeviceHandle handle;
u32 write_type;
} in = { *handle, write_type };
serviceAssumeDomain(&g_nfpInterface);
return serviceDispatchIn(&g_nfpInterface, 206, in,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { buf, buf_size } },
);
}
Result nfcIsNfcEnabled(bool *out) {
return _nfcCmdNoInOutBool(&g_nfcInterface, out, hosversionBefore(4,0,0) ? 3 : 403);
}
Result nfcReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
serviceAssumeDomain(&g_nfcInterface);
Result rc = serviceDispatchIn(&g_nfcInterface, 1000, *handle,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ out_block_data, count*sizeof(NfcMifareReadBlockData) },
{ read_block_parameter, count*sizeof(NfcMifareReadBlockParameter) },
},
);
return rc;
}
Result nfcMfReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count) {
serviceAssumeDomain(&g_nfcMfInterface);
Result rc = serviceDispatchIn(&g_nfcMfInterface, 5, *handle,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ out_block_data, count*sizeof(NfcMifareReadBlockData) },
{ read_block_parameter, count*sizeof(NfcMifareReadBlockParameter) },
},
);
return rc;
}
Result nfcWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
serviceAssumeDomain(&g_nfcInterface);
Result rc = serviceDispatchIn(&g_nfcInterface, 1001, *handle,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ write_block_parameter, count*sizeof(NfcMifareWriteBlockParameter) },
},
);
return rc;
}
Result nfcMfWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count) {
serviceAssumeDomain(&g_nfcMfInterface);
Result rc = serviceDispatchIn(&g_nfcMfInterface, 6, *handle,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
},
.buffers = {
{ write_block_parameter, count*sizeof(NfcMifareWriteBlockParameter) },
},
);
return rc;
}
Result nfcSendCommandByPassThrough(const NfcDeviceHandle *handle, u64 timeout, const void* cmd_buf, size_t cmd_buf_size, void* reply_buf, size_t reply_buf_size, u64 *out_size) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -386,4 +777,3 @@ Result nfcReleasePassThroughSession(const NfcDeviceHandle *handle) {
return _nfcCmdInDevhandleNoOut(&g_nfcInterface, handle, 1302);
}

View File

@ -1309,6 +1309,29 @@ Result nsCleanupUnavailableAddOnContents(u64 application_id, AccountUid uid) {
return rc;
}
Result nsEstimateSizeToMove(u8 *storage_ids, s32 count, NcmStorageId storage_id, u32 flags, u64 application_id, s64 *out) {
if (hosversionBefore(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Service srv={0};
Result rc = nsGetApplicationManagerInterface(&srv);
const struct {
u8 storage_id;
u8 pad[3];
u32 flags;
u64 application_id;
} in = { storage_id, {0}, flags, application_id };
if (R_SUCCEEDED(rc)) rc = serviceDispatchInOut(&srv, 1311, in, *out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { storage_ids, count*sizeof(u8) } },
);
serviceClose(&srv);
return rc;
}
Result nsFormatSdCard(void) {
if (hosversionBefore(2,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -1503,7 +1526,7 @@ Result nsCompareApplicationDeliveryInfo(const NsApplicationDeliveryInfo *info0,
Service srv={0};
Result rc = nsGetApplicationManagerInterface(&srv);
if (R_SUCCEEDED(rc)) rc = serviceDispatchOut(&srv, 2005, out,
if (R_SUCCEEDED(rc)) rc = serviceDispatchOut(&srv, 2005, *out,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
@ -1710,7 +1733,7 @@ Result nsCompareSystemDeliveryInfo(const NsSystemDeliveryInfo *info0, const NsSy
Service srv={0};
Result rc = nsGetApplicationManagerInterface(&srv);
if (R_SUCCEEDED(rc)) rc = serviceDispatchOut(&srv, 2015, out,
if (R_SUCCEEDED(rc)) rc = serviceDispatchOut(&srv, 2015, *out,
.buffer_attrs = {
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
SfBufferAttr_HipcMapAlias | SfBufferAttr_In,
@ -2344,7 +2367,7 @@ Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 fl
}
Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags) {
if (hosversionBefore(10,0,0))
if (hosversionBefore(10,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&g_nsdevSrv, 8, flags, *out_pid,
@ -2354,6 +2377,9 @@ Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t pat
}
Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id) {
if (hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
u8 app_storage_id;
u8 patch_storage_id;

View File

@ -7,6 +7,7 @@
#include "services/nv.h"
#include "nvidia/ioctl.h"
__attribute__((weak)) NvServiceType __nx_nv_service_type = NvServiceType_Auto;
__attribute__((weak)) u32 __nx_nv_transfermem_size = 0x800000;
static Service g_nvSrv;
@ -27,23 +28,46 @@ NX_GENERATE_SERVICE_GUARD(nv);
Result _nvInitialize(void) {
Result rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
switch (appletGetAppletType()) {
case AppletType_None:
rc = smGetService(&g_nvSrv, "nvdrv:s");
break;
if (__nx_nv_service_type == NvServiceType_Auto) {
switch (appletGetAppletType()) {
case AppletType_None:
__nx_nv_service_type = NvServiceType_System;
break;
case AppletType_Default:
case AppletType_Application:
case AppletType_SystemApplication:
default:
rc = smGetService(&g_nvSrv, "nvdrv");
break;
case AppletType_Default:
case AppletType_Application:
case AppletType_SystemApplication:
default:
__nx_nv_service_type = NvServiceType_Application;
break;
case AppletType_SystemApplet:
case AppletType_LibraryApplet:
case AppletType_OverlayApplet:
rc = smGetService(&g_nvSrv, "nvdrv:a");
break;
case AppletType_SystemApplet:
case AppletType_LibraryApplet:
case AppletType_OverlayApplet:
__nx_nv_service_type = NvServiceType_Applet;
break;
}
}
switch (__nx_nv_service_type) {
case NvServiceType_Application:
rc = smGetService(&g_nvSrv, "nvdrv");
break;
case NvServiceType_Applet:
rc = smGetService(&g_nvSrv, "nvdrv:a");
break;
case NvServiceType_System:
rc = smGetService(&g_nvSrv, "nvdrv:s");
break;
case NvServiceType_Factory:
rc = smGetService(&g_nvSrv, "nvdrv:t");
break;
default:
break; // Leave rc at the error set above.
}
if (R_SUCCEEDED(rc)) {

View File

@ -11,7 +11,7 @@ static Result _pctlCmdNoIO(u32 cmd_id);
NX_GENERATE_SERVICE_GUARD(pctl);
Result _pctlInitialize(void) {
Result rc=0;
Result rc = 0;
bool sysverflag = hosversionBefore(4,0,0);
rc = smGetService(&g_pctlSrv, "pctl:a");
@ -42,7 +42,7 @@ Service* pctlGetServiceSession_Service(void) {
}
static Result _pctlCreateService(Service* srv_out, u32 cmd_id) {
u64 pid_reserved=0;
u64 pid_reserved = 0;
serviceAssumeDomain(&g_pctlSrv);
return serviceDispatchIn(&g_pctlSrv, cmd_id, pid_reserved,
.in_send_pid = true,
@ -61,13 +61,35 @@ static Result _pctlCmdNoInOutU8(u8 *out, u32 cmd_id) {
return serviceDispatchOut(&g_pctlSession, cmd_id, *out);
}
static Result _pctlCmdNoInOutU32(u32 *out, u32 cmd_id) {
serviceAssumeDomain(&g_pctlSession);
return serviceDispatchOut(&g_pctlSession, cmd_id, *out);
}
static Result _pctlCmdNoInOutBool(bool *out, u32 cmd_id) {
u8 tmp=0;
u8 tmp = 0;
Result rc = _pctlCmdNoInOutU8(&tmp, cmd_id);
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
return rc;
}
static Result _pctlCmdGetEvent(Event* out_event, u32 cmd_id) {
Result rc;
Handle tmp_handle = INVALID_HANDLE;
serviceAssumeDomain(&g_pctlSession);
rc = serviceDispatch(&g_pctlSession, cmd_id,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = &tmp_handle,
);
if (R_SUCCEEDED(rc)) eventLoadRemote(out_event, tmp_handle, true);
return rc;
}
Result pctlIsRestrictionTemporaryUnlocked(bool *flag) {
return _pctlCmdNoInOutBool(flag, 1006);
}
Result pctlConfirmStereoVisionPermission(void) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -79,6 +101,19 @@ Result pctlIsRestrictionEnabled(bool *flag) {
return _pctlCmdNoInOutBool(flag, 1031);
}
Result pctlGetSafetyLevel(u32 *safety_level) {
return _pctlCmdNoInOutU32(safety_level, 1032);
}
Result pctlGetCurrentSettings(PctlRestrictionSettings *settings) {
serviceAssumeDomain(&g_pctlSession);
return serviceDispatchOut(&g_pctlSession, 1035, *settings);
}
Result pctlGetFreeCommunicationApplicationListCount(u32 *count) {
return _pctlCmdNoInOutU32(count, 1039);
}
Result pctlResetConfirmedStereoVisionPermission(void) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -93,3 +128,25 @@ Result pctlIsStereoVisionPermitted(bool *flag) {
return _pctlCmdNoInOutBool(flag, 1065);
}
Result pctlIsPairingActive(bool *flag) {
return _pctlCmdNoInOutBool(flag, 1403);
}
Result pctlGetSynchronizationEvent(Event* out_event) {
return _pctlCmdGetEvent(out_event, 1432);
}
Result pctlGetPlayTimerEventToRequestSuspension(Event* out_event) {
return _pctlCmdGetEvent(out_event, 1457);
}
Result pctlIsPlayTimerAlarmDisabled(bool *flag) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _pctlCmdNoInOutBool(flag, 1458);
}
Result pctlGetUnlinkedEvent(Event* out_event) {
return _pctlCmdGetEvent(out_event, 1473);
}

View File

@ -94,3 +94,28 @@ Result pcvGetVoltageEnabled(bool *isEnabled, u32 power_domain) {
return rc;
}
Result pcvGetPossibleClockRates(PcvModule module, u32 *rates, s32 max_count, PcvClockRatesListType *out_type, s32 *out_count) {
if(hosversionAtLeast(8,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct {
PcvModule module;
s32 max_count;
} in = { module, max_count };
struct {
s32 type;
s32 count;
} out;
Result rc = serviceDispatchInOut(&g_pcvSrv, 5, in, out,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcPointer, },
.buffers = { { rates, max_count * sizeof(u32) }, }
);
if (R_SUCCEEDED(rc) && out_type) *out_type = out.type;
if (R_SUCCEEDED(rc) && out_count) *out_count = out.count;
return rc;
}

View File

@ -135,6 +135,15 @@ static Result _sslCmdInU8U32NoOut(Service* srv, u8 val0, u32 val1, u32 cmd_id) {
return _sslObjectDispatchIn(srv, cmd_id, in);
}
static Result _sslCmdInTwoU32sNoOut(Service* srv, u32 val0, u32 val1, u32 cmd_id) {
const struct {
u32 val0;
u32 val1;
} in = { val0, val1 };
return _sslObjectDispatchIn(srv, cmd_id, in);
}
static Result _sslCmdNoInOutU32(Service* srv, u32 *out, u32 cmd_id) {
return _sslObjectDispatchOut(srv, cmd_id, *out);
}
@ -897,14 +906,17 @@ Result sslConnectionGetDtlsHandshakeTimeout(SslConnection *c, u64 *out) {
);
}
Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, bool flag) {
Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, u32 value) {
if (!serviceIsActive(&c->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(16,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _sslCmdInU8U32NoOut(&c->s, flag!=0, option, 30);
if (hosversionBefore(17,0,0))
return _sslCmdInU8U32NoOut(&c->s, value!=0, option, 30);
else
return _sslCmdInTwoU32sNoOut(&c->s, option, value, 30);
}
Result sslConnectionSetSrtpCiphers(SslConnection *c, const u16 *ciphers, u32 count) {

View File

@ -25,6 +25,9 @@ static Result _tsCmdInU8Out32(u8 inval, u32 *out, u64 cmd_id) {
}
Result tsGetTemperatureRange(TsLocation location, s32 *min_temperature, s32 *max_temperature) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
u8 tmp_location = location;
struct {
@ -39,6 +42,8 @@ Result tsGetTemperatureRange(TsLocation location, s32 *min_temperature, s32 *max
}
Result tsGetTemperature(TsLocation location, s32 *temperature) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _tsCmdInU8Out32(location, (u32*)temperature, 1);
}
@ -48,3 +53,23 @@ Result tsGetTemperatureMilliC(TsLocation location, s32 *temperature) {
return _tsCmdInU8Out32(location, (u32*)temperature, 3);
}
Result tsOpenSession(TsSession *s, u32 device_code) {
if (hosversionBefore(8,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchIn(&g_tsSrv, 4, device_code,
.out_num_objects = 1,
.out_objects = &s->s,
);
}
Result tsSessionGetTemperature(TsSession *s, float *temperature) {
if (hosversionBefore(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchOut(&s->s, 4, *temperature);
}
void tsSessionClose(TsSession *s) {
serviceClose(&s->s);
}

View File

@ -45,26 +45,44 @@ static Result _uartCmdInTwoU32sOutBool(Service* srv, u32 inval0, u32 inval1, boo
}
Result uartHasPort(UartPort port, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInU32OutBool(&g_uartSrv, port, out, 0);
}
Result uartHasPortForDev(UartPortForDev port, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInU32OutBool(&g_uartSrv, port, out, 1);
}
Result uartIsSupportedBaudRate(UartPort port, u32 baud_rate, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, baud_rate, out, 2);
}
Result uartIsSupportedBaudRateForDev(UartPortForDev port, u32 baud_rate, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, baud_rate, out, 3);
}
Result uartIsSupportedFlowControlMode(UartPort port, UartFlowControlMode flow_control_mode, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, flow_control_mode, out, 4);
}
Result uartIsSupportedFlowControlModeForDev(UartPortForDev port, UartFlowControlMode flow_control_mode, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, flow_control_mode, out, 5);
}
@ -76,22 +94,28 @@ Result uartCreatePortSession(UartPortSession *s) {
}
Result uartIsSupportedPortEvent(UartPort port, UartPortEventType port_event_type, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, port_event_type, out, 7);
}
Result uartIsSupportedPortEventForDev(UartPortForDev port, UartPortEventType port_event_type, bool *out) {
if (hosversionAtLeast(17,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, port_event_type, out, 8);
}
Result uartIsSupportedDeviceVariation(UartPort port, u32 device_variation, bool *out) {
if (hosversionBefore(7,0,0))
if (!hosversionBetween(7,17))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, device_variation, out, 9);
}
Result uartIsSupportedDeviceVariationForDev(UartPortForDev port, u32 device_variation, bool *out) {
if (hosversionBefore(7,0,0))
if (!hosversionBetween(7,17))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _uartCmdInTwoU32sOutBool(&g_uartSrv, port, device_variation, out, 10);

View File

@ -11,10 +11,11 @@ PHDRS
SECTIONS
{
PROVIDE_HIDDEN( __start__ = 0x0 );
/* =========== CODE section =========== */
PROVIDE(__start__ = 0x0);
. = __start__;
__code_start = . ;
PROVIDE_HIDDEN( __code_start = . );
.text :
{
@ -48,111 +49,143 @@ SECTIONS
/* =========== RODATA section =========== */
. = ALIGN(0x1000);
__rodata_start = . ;
PROVIDE_HIDDEN( __rodata_start = . );
.nx-module-name : { KEEP (*(.nx-module-name)) } :rodata
.rela.dyn : { *(.rela.*) } :rodata
.relr.dyn : { *(.relr.*) } :rodata
.hash : { *(.hash) } :rodata
.gnu.hash : { *(.gnu.hash) } :rodata
.dynsym : { *(.dynsym) } :rodata
.dynstr : { *(.dynstr) } :rodata
.rodata :
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(8);
} :rodata
.eh_frame_hdr : { __eh_frame_hdr_start = .; *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) __eh_frame_hdr_end = .; } :rodata
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } :rodata
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } :rodata
.gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } : rodata
.tls.align :
{
QUAD( MAX( ALIGNOF(.tdata), ALIGNOF(.tbss) ) )
} :rodata
PROVIDE_HIDDEN( __tls_align = ADDR(.tls.align) );
.gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } :rodata
.eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } :rodata
.eh_frame : { KEEP (*(.eh_frame)) *(.eh_frame.*) } :rodata
.gnu_extab : { *(.gnu_extab*) } : rodata
.exception_ranges : { *(.exception_ranges .exception_ranges*) } :rodata
PROVIDE_HIDDEN( __eh_frame_hdr_start = ADDR(.eh_frame_hdr) );
PROVIDE_HIDDEN( __eh_frame_hdr_end = ADDR(.eh_frame_hdr) + SIZEOF(.eh_frame_hdr) );
.dynamic : { *(.dynamic) } :rodata :dyn
.dynsym : { *(.dynsym) } :rodata
.dynstr : { *(.dynstr) } :rodata
.rela.dyn : { *(.rela.*) } :rodata
.interp : { *(.interp) } :rodata
.hash : { *(.hash) } :rodata
.gnu.hash : { *(.gnu.hash) } :rodata
.gnu.version : { *(.gnu.version) } :rodata
.gnu.version_d : { *(.gnu.version_d) } :rodata
.gnu.version_r : { *(.gnu.version_r) } :rodata
.note.gnu.build-id : { *(.note.gnu.build-id) } :rodata
/* =========== RELRO section =========== */
. = ALIGN(0x1000);
PROVIDE_HIDDEN( __relro_start = . );
.preinit_array :
{
PROVIDE_HIDDEN( __preinit_array_start = . );
KEEP (*(.preinit_array))
PROVIDE_HIDDEN( __preinit_array_end = . );
} :data
.init_array :
{
PROVIDE_HIDDEN( __init_array_start = . );
KEEP( *(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)) )
KEEP( *(.init_array .ctors) )
PROVIDE_HIDDEN( __init_array_end = . );
} :data
.fini_array :
{
PROVIDE_HIDDEN( __fini_array_start = . );
KEEP( *(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)) )
KEEP( *(.fini_array .dtors) )
PROVIDE_HIDDEN( __fini_array_end = . );
} :data
.data.rel.ro :
{
*(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
*(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
. = ALIGN(8);
} :data
.dynamic : { *(.dynamic) } :data :dyn
.got : { *(.got) *(.igot) } :data
.got.plt : { *(.got.plt) *(.igot.plt) } :data
PROVIDE_HIDDEN( __got_start__ = ADDR(.got) );
PROVIDE_HIDDEN( __got_end__ = ADDR(.got.plt) + SIZEOF(.got.plt) );
/* =========== DATA section =========== */
. = ALIGN(0x1000);
__data_start = . ;
PROVIDE_HIDDEN( __data_start = . );
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } :data
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } :data
.gnu_extab : ONLY_IF_RW { *(.gnu_extab*) } : data
.exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } :data
.tdata ALIGN(8) :
{
__tdata_lma = .;
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(8);
__tdata_lma_end = .;
} :data
.tbss ALIGN(8) :
{
*(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
. = ALIGN(8);
} :data
.preinit_array ALIGN(8) :
{
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
} :data
.init_array ALIGN(8) :
{
PROVIDE (__init_array_start = .);
KEEP( *(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)) )
KEEP( *(.init_array .ctors) )
PROVIDE (__init_array_end = .);
} :data
.fini_array ALIGN(8) :
{
PROVIDE (__fini_array_start = .);
KEEP( *(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)) )
KEEP( *(.fini_array .dtors) )
PROVIDE (__fini_array_end = .);
} :data
__got_start__ = .;
.got : { *(.got) *(.igot) } :data
.got.plt : { *(.got.plt) *(.igot.plt) } :data
__got_end__ = .;
.data ALIGN(8) :
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
. = ALIGN(8);
} :data
.bss ALIGN(8) :
.tdata :
{
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(8);
} :data
PROVIDE_HIDDEN( __tdata_lma = ADDR(.tdata) );
PROVIDE_HIDDEN( __tdata_lma_end = ADDR(.tdata) + SIZEOF(.tdata) );
.tbss :
{
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
. = ALIGN(8);
} :data
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(8);
} :data
/* Reserve space for the TLS segment of the main thread */
__tls_start = .;
. += + SIZEOF(.tdata) + SIZEOF(.tbss);
__tls_end = .;
} : data
__bss_start__ = ADDR(.bss);
__bss_end__ = ADDR(.bss) + SIZEOF(.bss);
/* Reserve space for the TLS segment of the main thread */
.main.tls ALIGN(MAX(ALIGNOF(.tdata),ALIGNOF(.tbss))) :
{
. += SIZEOF(.tdata);
. = ALIGN(ALIGNOF(.tbss));
. += SIZEOF(.tbss);
} :data
__end__ = ABSOLUTE(.) ;
PROVIDE_HIDDEN( __tls_start = ADDR(.main.tls) );
PROVIDE_HIDDEN( __tls_end = ADDR(.main.tls) + SIZEOF(.main.tls) );
PROVIDE_HIDDEN( __bss_start__ = ADDR(.bss) );
PROVIDE_HIDDEN( __bss_end__ = __tls_end );
PROVIDE_HIDDEN( __end__ = . );
/* =========== Argument buffer =========== */
. = ALIGN(0x1000);
__argdata__ = ABSOLUTE(.) ;
PROVIDE_HIDDEN( __argdata__ = . );
/* ==================
==== Metadata ====

View File

@ -1,8 +1,5 @@
%rename link old_link
*link:
%(old_link) -T %:getenv(DEVKITPRO /libnx/switch.ld) -pie --no-dynamic-linker --spare-dynamic-tags=0 --gc-sections -z text -z nodynamic-undefined-weak --build-id=sha1 --nx-module-name
+ -T %:getenv(DEVKITPRO /libnx/switch.ld) -pie --no-dynamic-linker --spare-dynamic-tags=0 --gc-sections -z text -z now -z nodynamic-undefined-weak -z pack-relative-relocs --build-id=sha1 --nx-module-name
*startfile:
crti%O%s crtbegin%O%s --require-defined=main