mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-21 05:12:40 +02:00
Updated nfc example for latest libnx, and minor other changes.
This commit is contained in:
parent
da994a8a69
commit
5363a04d9b
@ -37,7 +37,7 @@ Result process_amiibo(u32 app_id) {
|
|||||||
// Get the handle of the first controller with NFC capabilities.
|
// Get the handle of the first controller with NFC capabilities.
|
||||||
HidControllerID controller = 0;
|
HidControllerID controller = 0;
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
u32 device_count;
|
s32 device_count;
|
||||||
rc = nfpuListDevices(&device_count, &controller, 1);
|
rc = nfpuListDevices(&device_count, &controller, 1);
|
||||||
|
|
||||||
if (R_FAILED(rc))
|
if (R_FAILED(rc))
|
||||||
@ -133,6 +133,7 @@ Result process_amiibo(u32 app_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u8 app_area[0xd8] = {0}; // Maximum size of the application area.
|
u8 app_area[0xd8] = {0}; // Maximum size of the application area.
|
||||||
|
if (app_area_size > sizeof(app_area)) app_area_size = sizeof(app_area);
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
rc = nfpuGetApplicationArea(controller, app_area, app_area_size);
|
rc = nfpuGetApplicationArea(controller, app_area, app_area_size);
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ int main(int argc, char* argv[])
|
|||||||
rc = nfpuIsNfcEnabled(&nfc_enabled);
|
rc = nfpuIsNfcEnabled(&nfc_enabled);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc) && !nfc_enabled) {
|
if (R_SUCCEEDED(rc) && !nfc_enabled) {
|
||||||
// Get the availability change event. This is signaled when a change in NFC availability happens.
|
// Get the availability change event. This is signaled when a change in NFC availability happens. See libnx nfc.h for the required sysver.
|
||||||
Event availability_change_event = {0};
|
Event availability_change_event = {0};
|
||||||
rc = nfpuAttachAvailabilityChangeEvent(&availability_change_event);
|
rc = nfpuAttachAvailabilityChangeEvent(&availability_change_event);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user