From 5363a04d9b7c5eee4586af9b73bb14caaca65e10 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sun, 13 Oct 2019 13:42:18 -0400 Subject: [PATCH] Updated nfc example for latest libnx, and minor other changes. --- nfc/source/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nfc/source/main.c b/nfc/source/main.c index 17079e4..47907f3 100644 --- a/nfc/source/main.c +++ b/nfc/source/main.c @@ -37,7 +37,7 @@ Result process_amiibo(u32 app_id) { // Get the handle of the first controller with NFC capabilities. HidControllerID controller = 0; if (R_SUCCEEDED(rc)) { - u32 device_count; + s32 device_count; rc = nfpuListDevices(&device_count, &controller, 1); 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. + if (app_area_size > sizeof(app_area)) app_area_size = sizeof(app_area); if (R_SUCCEEDED(rc)) { rc = nfpuGetApplicationArea(controller, app_area, app_area_size); @@ -194,7 +195,7 @@ int main(int argc, char* argv[]) rc = nfpuIsNfcEnabled(&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}; rc = nfpuAttachAvailabilityChangeEvent(&availability_change_event);