diff --git a/include/services/nfc.hpp b/include/services/nfc.hpp index cc13f826..361688b2 100644 --- a/include/services/nfc.hpp +++ b/include/services/nfc.hpp @@ -42,6 +42,7 @@ class NFCService { void getTagInRangeEvent(u32 messagePointer); void getTagOutOfRangeEvent(u32 messagePointer); void getTagState(u32 messagePointer); + void startCommunication(u32 messagePointer); void stopCommunication(u32 messagePointer); public: diff --git a/src/core/services/nfc.cpp b/src/core/services/nfc.cpp index 4281c0e4..65b7e425 100644 --- a/src/core/services/nfc.cpp +++ b/src/core/services/nfc.cpp @@ -5,6 +5,7 @@ namespace NFCCommands { enum : u32 { Initialize = 0x00010040, + StartCommunication = 0x00030000, StopCommunication = 0x00040000, GetTagInRangeEvent = 0x000B0000, GetTagOutOfRangeEvent = 0x000C0000, @@ -29,6 +30,7 @@ void NFCService::handleSyncRequest(u32 messagePointer) { case NFCCommands::GetTagInRangeEvent: getTagInRangeEvent(messagePointer); break; case NFCCommands::GetTagOutOfRangeEvent: getTagOutOfRangeEvent(messagePointer); break; case NFCCommands::GetTagState: getTagState(messagePointer); break; + case NFCCommands::StartCommunication: startCommunication(messagePointer); break; case NFCCommands::StopCommunication: stopCommunication(messagePointer); break; default: Helpers::panic("NFC service requested. Command: %08X\n", command); } @@ -100,6 +102,14 @@ void NFCService::communicationGetStatus(u32 messagePointer) { mem.write8(messagePointer + 8, static_cast(adapterStatus)); } +void NFCService::startCommunication(u32 messagePointer) { + log("NFC::StartCommunication\n"); + // TODO: Actually start communication when we emulate amiibo + + mem.write32(messagePointer, IPC::responseHeader(0x4, 1, 0)); + mem.write32(messagePointer + 4, Result::Success); +} + void NFCService::stopCommunication(u32 messagePointer) { log("NFC::StopCommunication\n"); // TODO: Actually stop communication when we emulate amiibo