mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dfee0c8ba2 | ||
|
0a4ac1b87c | ||
|
638624cf02 | ||
|
2f471a1c26 | ||
|
d1dbd8db51 | ||
|
de7cfeb3d9 | ||
|
2fc81d8f35 | ||
|
29f6f4fa7a | ||
|
b88afc509c | ||
|
ceb7ee1cbf | ||
|
0ba4f96bfe | ||
|
17bcd07095 | ||
|
ce6bc0c3e8 | ||
|
8f1cce6946 | ||
|
60bf943ec1 | ||
|
0ae0792770 | ||
|
953c1b7a8a | ||
|
5da574f852 | ||
|
b2d7022e1b | ||
|
29a6691b66 | ||
|
88de3cbea7 | ||
|
218e3f3a04 | ||
|
a063ceb19c | ||
|
e79dd7ac52 |
22
nx/Makefile
22
nx/Makefile
@ -8,13 +8,6 @@ endif
|
||||
|
||||
include $(DEVKITPRO)/devkitA64/base_rules
|
||||
|
||||
export LIBNX_MAJOR := 4
|
||||
export LIBNX_MINOR := 7
|
||||
export LIBNX_PATCH := 0
|
||||
|
||||
|
||||
VERSION := $(LIBNX_MAJOR).$(LIBNX_MINOR).$(LIBNX_PATCH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
@ -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
|
||||
|
@ -10,6 +10,7 @@ typedef struct {
|
||||
|
||||
Result nvFenceInit(void);
|
||||
void nvFenceExit(void);
|
||||
u32 nvFenceGetFd(void);
|
||||
|
||||
Result nvFenceWait(NvFence* f, s32 timeout_us);
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
@ -372,8 +372,8 @@ typedef struct {
|
||||
struct {
|
||||
u32 result; ///< 0 for success, non-zero for error.
|
||||
u8 status; ///< Connection status. 0 = Connected, 2 = Disconnected
|
||||
u16 server_if; ///< Server interface handle
|
||||
u8 pad; ///< Padding
|
||||
u8 server_if; ///< Server interface handle
|
||||
u8 pad[2]; ///< Padding
|
||||
u32 conn_id; ///< Connection ID
|
||||
BtdrvAddress address; ///< Device address
|
||||
u16 reason; ///< Disconnection reason
|
||||
@ -439,21 +439,21 @@ typedef struct {
|
||||
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_characteristic; ///< ::BtdrvBleEventType_ServerAddCharacteristic
|
||||
} server_add_attribute; ///< ::BtdrvBleEventType_ServerAddAttribute
|
||||
|
||||
struct {
|
||||
u32 result; ///< 0 for success, non-zero for error.
|
||||
u16 conn_id; ///< Connection ID
|
||||
u8 unk_x6; ///< Unknown. Always 1
|
||||
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
|
||||
u8 data[0x200]; ///< Data written during write operation
|
||||
u16 size; ///< Size of the above data
|
||||
u16 offset; ///< Offset
|
||||
u8 pad2[2]; ///< Padding
|
||||
} server_write; ///< ::BtdrvBleEventType_ServerWrite
|
||||
} server_attribute_operation; ///< ::BtdrvBleEventType_ServerAttributeOperation
|
||||
};
|
||||
} BtdrvBleEventInfo;
|
||||
|
||||
@ -670,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
|
||||
@ -1058,6 +1058,7 @@ 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);
|
||||
@ -1089,6 +1090,7 @@ Result btdrvDisconnectGattClient(u8 conn_id, BtdrvAddress addr);
|
||||
/**
|
||||
* @brief AddGattService
|
||||
* @note Only available on [5.0.0+].
|
||||
* @note Broken behaviour due to internal bugs.
|
||||
* @param[in] server_if Server interface ID
|
||||
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||
* @param[in] num_handle Number of handles
|
||||
@ -1099,31 +1101,34 @@ Result btdrvAddGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid, u8
|
||||
/**
|
||||
* @brief EnableGattService
|
||||
* @note Only available on [5.0.0+].
|
||||
* @param[in] service_id Service ID
|
||||
* @note Broken behaviour due to internal bugs.
|
||||
* @param[in] server_if Server interface ID
|
||||
* @param[in] uuid \ref BtdrvGattAttributeUuid
|
||||
*/
|
||||
Result btdrvEnableGattService(u8 service_id, const BtdrvGattAttributeUuid *uuid);
|
||||
Result btdrvEnableGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid);
|
||||
|
||||
/**
|
||||
* @brief AddGattCharacteristic
|
||||
* @note Only available on [5.0.0+].
|
||||
* @param[in] service_id Service ID
|
||||
* @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 service_id, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, u8 permissions, u16 property);
|
||||
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] service_id Service ID
|
||||
* @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 service_id, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *desc_uuid, u16 permissions);
|
||||
Result btdrvAddGattDescriptor(u8 server_if, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *desc_uuid, u16 permissions);
|
||||
|
||||
/**
|
||||
* @brief GetBleManagedEventInfo
|
||||
|
@ -137,8 +137,8 @@ typedef enum {
|
||||
BtdrvBleEventType_ClientCacheSave = 9, ///< GATT client cache save.
|
||||
BtdrvBleEventType_ClientCacheLoad = 10, ///< GATT client cache load.
|
||||
BtdrvBleEventType_ClientConfigureMtu = 11, ///< GATT client configure MTU.
|
||||
BtdrvBleEventType_ServerAddCharacteristic = 12, ///< GATT server add characteristic.
|
||||
BtdrvBleEventType_ServerWrite = 13, ///< GATT server write.
|
||||
BtdrvBleEventType_ServerAddAttribute = 12, ///< GATT server add attribute.
|
||||
BtdrvBleEventType_ServerAttributeOperation = 13, ///< GATT server attribute operation.
|
||||
} BtdrvBleEventType;
|
||||
|
||||
/// GattAttributeType
|
||||
@ -193,6 +193,37 @@ typedef enum {
|
||||
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
|
||||
@ -280,6 +311,29 @@ typedef struct {
|
||||
u8 unk_x0[0x88]; ///< Unknown
|
||||
} BtdrvChannelMapList;
|
||||
|
||||
/// GattAttributeUuid
|
||||
typedef struct {
|
||||
u32 size; ///< UUID size, must be 0x2, 0x4, or 0x10.
|
||||
u8 uuid[0x10]; ///< UUID with the above size.
|
||||
} BtdrvGattAttributeUuid;
|
||||
|
||||
/// GattId
|
||||
typedef struct {
|
||||
u8 instance_id; ///< InstanceId
|
||||
u8 pad[3]; ///< Padding
|
||||
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
|
||||
@ -303,30 +357,24 @@ typedef struct {
|
||||
u16 supervision_tout; ///< Connection supervision timeout multiplier
|
||||
} BtdrvBleConnectionParameter;
|
||||
|
||||
/// BtdrvBleAdvertisePacketDataEntry
|
||||
/// BtdrvBleAdvertisePacketData
|
||||
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
|
||||
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
|
||||
@ -366,29 +414,6 @@ typedef struct {
|
||||
u8 pad[2]; ///< Padding
|
||||
} BtdrvBleConnectionInfo;
|
||||
|
||||
/// GattAttributeUuid
|
||||
typedef struct {
|
||||
u32 size; ///< UUID size, must be 0x2, 0x4, or 0x10.
|
||||
u8 uuid[0x10]; ///< UUID with the above size.
|
||||
} BtdrvGattAttributeUuid;
|
||||
|
||||
/// GattId
|
||||
typedef struct {
|
||||
u8 instance_id; ///< InstanceId
|
||||
u8 pad[3]; ///< Padding
|
||||
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;
|
||||
|
||||
/// LeEventInfo
|
||||
typedef struct {
|
||||
u32 unk_x0; ///< Unknown
|
||||
|
@ -298,3 +298,8 @@ typedef struct {
|
||||
BtdrvGattAttributeUuid uuid; ///< \ref BtdrvGattAttributeUuid
|
||||
} BtmBleDataPath;
|
||||
|
||||
/// AudioDevice
|
||||
typedef struct {
|
||||
BtdrvAddress addr; ///< Device address
|
||||
char name[0xF9]; ///< Device name
|
||||
} BtmAudioDevice;
|
||||
|
@ -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);
|
||||
|
@ -33,5 +33,31 @@ Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -323,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.
|
||||
|
@ -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.
|
||||
|
@ -42,6 +42,11 @@ typedef struct {
|
||||
u64 size;
|
||||
} LoaderModuleInfo;
|
||||
|
||||
typedef struct {
|
||||
u8 platform; ///< NcmContentMetaPlatform
|
||||
u8 content_attributes; ///< FsContentAttributes
|
||||
} LoaderProgramAttributes;
|
||||
|
||||
/// Initialize ldr:shel.
|
||||
Result ldrShellInitialize(void);
|
||||
|
||||
@ -76,8 +81,8 @@ 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); ///< [19.0.0+/Atmosphere]
|
||||
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);
|
||||
|
@ -113,6 +113,15 @@ 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;
|
||||
|
@ -23,11 +23,6 @@ typedef enum {
|
||||
NfcServiceType_System = 1, ///< Initializes nfc:sys.
|
||||
} NfcServiceType;
|
||||
|
||||
typedef enum {
|
||||
NfpState_NonInitialized = 0,
|
||||
NfpState_Initialized = 1,
|
||||
} NfpState;
|
||||
|
||||
typedef enum {
|
||||
NfcState_NonInitialized = 0,
|
||||
NfcState_Initialized = 1,
|
||||
@ -40,7 +35,6 @@ typedef enum {
|
||||
NfpDeviceState_TagRemoved = 3,
|
||||
NfpDeviceState_TagMounted = 4,
|
||||
NfpDeviceState_Unavailable = 5,
|
||||
NfpDeviceState_Finalized = 6,
|
||||
} NfpDeviceState;
|
||||
|
||||
typedef enum {
|
||||
@ -49,16 +43,23 @@ typedef enum {
|
||||
NfcDeviceState_TagFound = 2,
|
||||
NfcDeviceState_TagRemoved = 3,
|
||||
NfcDeviceState_TagMounted = 4,
|
||||
NfcDeviceState_Unavailable = 5,
|
||||
NfcDeviceState_Finalized = 6,
|
||||
} NfcDeviceState;
|
||||
|
||||
typedef enum {
|
||||
NfpApplicationAreaVersion_3DS = 0,
|
||||
NfpApplicationAreaVersion_WiiU = 1,
|
||||
NfpApplicationAreaVersion_3DSv2 = 2,
|
||||
NfpApplicationAreaVersion_Switch = 3,
|
||||
NfpApplicationAreaVersion_NotSet = 0xFF,
|
||||
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 {
|
||||
@ -66,9 +67,9 @@ typedef enum {
|
||||
} 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 enum {
|
||||
@ -102,104 +103,123 @@ typedef enum {
|
||||
NfcMifareCommand_Store = 0xC2,
|
||||
} NfcMifareCommand;
|
||||
|
||||
typedef struct {
|
||||
u8 uuid[10];
|
||||
u8 uuid_length;
|
||||
u8 reserved1[0x15];
|
||||
u32 protocol;
|
||||
u32 tag_type;
|
||||
u8 reserved2[0x30];
|
||||
} NX_PACKED NfpTagInfo;
|
||||
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 {
|
||||
u8 uuid[10];
|
||||
u8 uuid_length;
|
||||
u8 reserved1[0x15];
|
||||
u32 protocol;
|
||||
u32 tag_type;
|
||||
u8 reserved2[0x30];
|
||||
} NX_PACKED NfcTagInfo;
|
||||
u16 year;
|
||||
u8 month;
|
||||
u8 day;
|
||||
} NfpDate;
|
||||
|
||||
typedef struct {
|
||||
u16 last_write_year;
|
||||
u8 last_write_month;
|
||||
u8 last_write_day;
|
||||
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];
|
||||
} NX_PACKED NfpCommonInfo;
|
||||
u8 reserved[0x34];
|
||||
} NfpCommonInfo;
|
||||
|
||||
typedef struct {
|
||||
u8 amiibo_id[0x8];
|
||||
u8 reserved[0x38];
|
||||
} NX_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*4)+1]; ///< utf-8, null-terminated
|
||||
NfpDate first_write_date;
|
||||
char amiibo_name[(10*4)+1]; ///< Amiibo name (utf-8, null-terminated).
|
||||
u8 font_region;
|
||||
u8 reserved[0x7A];
|
||||
} NX_PACKED NfpRegisterInfo;
|
||||
} NfpRegisterInfo;
|
||||
|
||||
typedef struct {
|
||||
u8 mii_store_data[0x44];
|
||||
u16 first_write_year;
|
||||
u8 first_write_month;
|
||||
u8 first_write_day;
|
||||
char amiibo_name[(10*4)+1]; ///< utf-8, null-terminated
|
||||
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];
|
||||
} NX_PACKED NfpRegisterInfoPrivate;
|
||||
} NfpRegisterInfoPrivate;
|
||||
|
||||
typedef struct {
|
||||
u64 application_id;
|
||||
u32 application_area_id;
|
||||
u16 crc_change_counter;
|
||||
u32 access_id;
|
||||
u16 crc32_change_counter;
|
||||
u8 flags;
|
||||
u8 tag_type;
|
||||
u8 application_area_version;
|
||||
u8 reserved[0x2F];
|
||||
} NX_PACKED NfpAdminInfo;
|
||||
} NfpAdminInfo;
|
||||
|
||||
typedef struct {
|
||||
u8 magic;
|
||||
u8 tag_magic; ///< Tag magic (always 0xA5: https://www.3dbrew.org/wiki/Amiibo#Page_layout).
|
||||
u8 reserved1[0x1];
|
||||
u8 write_counter;
|
||||
u8 reserved2[0x1];
|
||||
u32 settings_crc;
|
||||
u8 reserved3[0x38];
|
||||
u16 last_write_year;
|
||||
u8 last_write_month;
|
||||
u8 last_write_day;
|
||||
u16 application_write_counter;
|
||||
u16 version;
|
||||
u32 application_area_size;
|
||||
u8 reserved4[0x34];
|
||||
MiiCharInfo mii;
|
||||
MiiNfpStoreDataExtension mii_store_data_extension;
|
||||
u16 first_write_year;
|
||||
u8 first_write_month;
|
||||
u8 first_write_day;
|
||||
u16 amiibo_name[10+1]; ///< utf-16, null-terminated
|
||||
u8 settings_flag; ///< bit4 = amiibo was initialized in console settings, bit5 = has application area
|
||||
u8 unknown1; ///< Normally zero
|
||||
u32 register_info_crc;
|
||||
u32 unknown2[0x5]; ///< Normally zero
|
||||
u8 reserved5[0x64];
|
||||
u64 application_id;
|
||||
u32 access_id;
|
||||
u16 settings_crc_counter;
|
||||
u8 font_region;
|
||||
u8 tag_type;
|
||||
u8 console_type;
|
||||
u8 application_id_byte; ///< (Original Program ID >> 0x24) & 0xF byte (Program ID has this byte swapped with console type)
|
||||
u8 reserved6[0x2E];
|
||||
u8 application_area[0xD8];
|
||||
} NX_PACKED NfpData;
|
||||
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;
|
||||
@ -292,21 +312,29 @@ 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.
|
||||
/// 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.
|
||||
@ -319,10 +347,18 @@ Result nfpDeleteApplicationArea(const NfcDeviceHandle *handle);
|
||||
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+].
|
||||
@ -347,7 +383,7 @@ Result nfcMfAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
|
||||
/// Returned event will have autoclear off.
|
||||
Result nfcMfAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event);
|
||||
|
||||
Result nfpGetState(NfpState *out);
|
||||
Result nfpGetState(NfcState *out);
|
||||
Result nfpGetDeviceState(const NfcDeviceHandle *handle, NfpDeviceState *out);
|
||||
Result nfpGetNpadId(const NfcDeviceHandle *handle, u32 *out);
|
||||
|
||||
@ -359,7 +395,7 @@ Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out);
|
||||
Result nfcGetNpadId(const NfcDeviceHandle *handle, u32 *out);
|
||||
|
||||
Result nfcMfGetState(NfcState *out);
|
||||
Result nfcMfGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out);
|
||||
Result nfcMfGetDeviceState(const NfcDeviceHandle *handle, NfcMifareDeviceState *out);
|
||||
Result nfcMfGetNpadId(const NfcDeviceHandle *handle, u32 *out);
|
||||
|
||||
/// Returned event will have autoclear on.
|
||||
@ -375,25 +411,39 @@ Result nfcMfAttachAvailabilityChangeEvent(Event *out_event);
|
||||
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.
|
||||
Result nfpBreakTag(const NfcDeviceHandle *handle, u32 break_type);
|
||||
/// 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);
|
||||
|
||||
|
@ -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;
|
||||
@ -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
|
||||
|
@ -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)
|
||||
:
|
||||
);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -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);
|
||||
}
|
||||
@ -930,47 +930,47 @@ Result btdrvAddGattService(u8 server_if, const BtdrvGattAttributeUuid *uuid, u8
|
||||
return serviceDispatchIn(&g_btdrvSrv, 75, in);
|
||||
}
|
||||
|
||||
Result btdrvEnableGattService(u8 service_id, 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 service_id;
|
||||
u8 server_if;
|
||||
u8 pad[3];
|
||||
BtdrvGattAttributeUuid uuid;
|
||||
} in = { service_id, {0}, *uuid };
|
||||
} in = { server_if, {0}, *uuid };
|
||||
|
||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, in);
|
||||
}
|
||||
|
||||
Result btdrvAddGattCharacteristic(u8 service_id, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *char_uuid, u8 permissions, u16 property) {
|
||||
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 service_id;
|
||||
u8 permissions;
|
||||
u16 property;
|
||||
u8 server_if;
|
||||
u8 property;
|
||||
u16 permissions;
|
||||
BtdrvGattAttributeUuid serv_uuid;
|
||||
BtdrvGattAttributeUuid char_uuid;
|
||||
} in = { service_id, permissions, property, *serv_uuid, *char_uuid };
|
||||
} in = { server_if, property, permissions, *serv_uuid, *char_uuid };
|
||||
|
||||
return serviceDispatchIn(&g_btdrvSrv, 77, in);
|
||||
}
|
||||
|
||||
Result btdrvAddGattDescriptor(u8 service_id, const BtdrvGattAttributeUuid *serv_uuid, const BtdrvGattAttributeUuid *desc_uuid, u16 permissions) {
|
||||
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 service_id;
|
||||
u8 server_if;
|
||||
u8 pad;
|
||||
u16 permissions;
|
||||
BtdrvGattAttributeUuid serv_uuid;
|
||||
BtdrvGattAttributeUuid desc_uuid;
|
||||
} in = { service_id, 0, permissions, *serv_uuid, *desc_uuid };
|
||||
} in = { server_if, 0, permissions, *serv_uuid, *desc_uuid };
|
||||
|
||||
return serviceDispatchIn(&g_btdrvSrv, cmd_id, 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]);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ 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;
|
||||
@ -57,3 +60,26 @@ Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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 },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -32,13 +32,32 @@ 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(17,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;
|
||||
|
@ -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 = {
|
||||
|
@ -340,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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -79,28 +79,57 @@ 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);
|
||||
|
||||
return serviceDispatchIn(&g_ldrPmSrv, 1, *loc,
|
||||
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcPointer | SfBufferAttr_FixedSize },
|
||||
.buffers = { { out_program_info, sizeof(*out_program_info) } },
|
||||
);
|
||||
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) {
|
||||
|
@ -493,7 +493,7 @@ Result nfcMfAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_even
|
||||
return _nfcCmdInDevhandleOutEvent(&g_nfcMfInterface, handle, out_event, 9);
|
||||
}
|
||||
|
||||
Result nfpGetState(NfpState *out) {
|
||||
Result nfpGetState(NfcState *out) {
|
||||
u32 tmp=0;
|
||||
Result rc = _nfcCmdNoInOutU32(&g_nfpInterface, &tmp, 19);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp;
|
||||
@ -531,7 +531,7 @@ Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result nfcMfGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out) {
|
||||
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;
|
||||
@ -620,7 +620,7 @@ Result nfpFlushDebug(const NfcDeviceHandle *handle) {
|
||||
return _nfcCmdInDevhandleNoOut(&g_nfcInterface, handle, 202);
|
||||
}
|
||||
|
||||
Result nfpBreakTag(const NfcDeviceHandle *handle, u32 break_type) {
|
||||
Result nfpBreakTag(const NfcDeviceHandle *handle, NfpBreakType break_type) {
|
||||
if (g_nfpServiceType != NfpServiceType_Debug)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user