From 0475b59e122fbaaf410be46e844c7fd84861ea22 Mon Sep 17 00:00:00 2001 From: fincs Date: Thu, 29 Jun 2017 18:42:08 +0200 Subject: [PATCH] nfcInit(): wait for NFC sysmodule to initialize --- libctru/source/services/nfc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libctru/source/services/nfc.c b/libctru/source/services/nfc.c index 99b229e..00140a2 100644 --- a/libctru/source/services/nfc.c +++ b/libctru/source/services/nfc.c @@ -37,7 +37,13 @@ Result nfcInit(NFC_OpType type) if (R_SUCCEEDED(ret)) { nfc_optype = type; - ret = NFC_Initialize(type); + for (;;) + { + ret = NFC_Initialize(type); + if (ret != 0xd0a17480) + break; + svcSleepThread(500000); + } if (R_FAILED(ret)) svcCloseHandle(nfcHandle); } if (R_FAILED(ret)) AtomicDecrement(&nfcRefCount);