// Include the most common headers from the C standard library #include #include #include #include // Include the main libnx system header, for Switch development #include // See also libnx nfc.h. // Indefinitely wait for an event to be signaled // Break when + is pressed, or if the application should quit (in this case, return value will be non-zero) Result eventWaitLoop(Event *event) { Result rc = 1; while (appletMainLoop()) { rc = eventWait(event, 0); hidScanInput(); if (R_SUCCEEDED(rc) || (hidKeysDown(CONTROLLER_P1_AUTO) & KEY_PLUS)) break; } return rc; } // Print raw data as hexadecimal numbers. void print_hex(void *buf, size_t size) { u8 *data = (u8 *)buf; for (size_t i=0; i