From 710fc585054aeb56b2b86852cb26c03c06a8a24e Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Fri, 8 Sep 2023 17:03:22 +0300 Subject: [PATCH] Add NFC::CommunicationGetResult --- src/core/services/nfc.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/core/services/nfc.cpp b/src/core/services/nfc.cpp index b1e04ab2..e0fe410b 100644 --- a/src/core/services/nfc.cpp +++ b/src/core/services/nfc.cpp @@ -29,6 +29,7 @@ void NFCService::reset() { void NFCService::handleSyncRequest(u32 messagePointer) { const u32 command = mem.read32(messagePointer); switch (command) { + case NFCCommands::CommunicationGetResult: communicationGetResult(messagePointer); break; case NFCCommands::CommunicationGetStatus: communicationGetStatus(messagePointer); break; case NFCCommands::Initialize: initialize(messagePointer); break; case NFCCommands::GetTagInRangeEvent: getTagInRangeEvent(messagePointer); break; @@ -119,6 +120,21 @@ void NFCService::communicationGetStatus(u32 messagePointer) { mem.write8(messagePointer + 8, static_cast(adapterStatus)); } + +void NFCService::communicationGetResult(u32 messagePointer) { + log("NFC::CommunicationGetResult"); + + if (!initialized) { + Helpers::warn("NFC::CommunicationGetResult: Old 3DS NFC Adapter not initialized\n"); + } + + mem.write32(messagePointer, IPC::responseHeader(0x12, 2, 0)); + mem.write32(messagePointer + 4, Result::Success); + // On N3DS: This always writes 0 here + // On O3DS with the NFC adapter: Returns a result code for NFC communication + mem.write32(messagePointer + 8, 0); +} + void NFCService::startCommunication(u32 messagePointer) { log("NFC::StartCommunication\n"); // adapterStatus = Old3DSAdapterStatus::Active;