NFC stuffs
This commit is contained in:
@@ -35,8 +35,10 @@ class NFCService {
|
|||||||
|
|
||||||
Old3DSAdapterStatus adapterStatus;
|
Old3DSAdapterStatus adapterStatus;
|
||||||
TagStatus tagStatus;
|
TagStatus tagStatus;
|
||||||
|
bool initialized = false;
|
||||||
|
|
||||||
// Service commands
|
// Service commands
|
||||||
|
void communicationGetResult(u32 messagePointer);
|
||||||
void communicationGetStatus(u32 messagePointer);
|
void communicationGetStatus(u32 messagePointer);
|
||||||
void initialize(u32 messagePointer);
|
void initialize(u32 messagePointer);
|
||||||
void getTagInRangeEvent(u32 messagePointer);
|
void getTagInRangeEvent(u32 messagePointer);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace NFCCommands {
|
|||||||
GetTagOutOfRangeEvent = 0x000C0000,
|
GetTagOutOfRangeEvent = 0x000C0000,
|
||||||
GetTagState = 0x000D0000,
|
GetTagState = 0x000D0000,
|
||||||
CommunicationGetStatus = 0x000F0000,
|
CommunicationGetStatus = 0x000F0000,
|
||||||
|
CommunicationGetResult = 0x00120000,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ void NFCService::reset() {
|
|||||||
|
|
||||||
adapterStatus = Old3DSAdapterStatus::Idle;
|
adapterStatus = Old3DSAdapterStatus::Idle;
|
||||||
tagStatus = TagStatus::NotInitialized;
|
tagStatus = TagStatus::NotInitialized;
|
||||||
|
initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFCService::handleSyncRequest(u32 messagePointer) {
|
void NFCService::handleSyncRequest(u32 messagePointer) {
|
||||||
@@ -42,6 +44,7 @@ void NFCService::initialize(u32 messagePointer) {
|
|||||||
|
|
||||||
adapterStatus = Old3DSAdapterStatus::InitializationComplete;
|
adapterStatus = Old3DSAdapterStatus::InitializationComplete;
|
||||||
tagStatus = TagStatus::Initialized;
|
tagStatus = TagStatus::Initialized;
|
||||||
|
initialized = true;
|
||||||
// TODO: This should error if already initialized. Also sanitize type.
|
// TODO: This should error if already initialized. Also sanitize type.
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x1, 1, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x1, 1, 0));
|
||||||
mem.write32(messagePointer + 4, Result::Success);
|
mem.write32(messagePointer + 4, Result::Success);
|
||||||
@@ -93,7 +96,7 @@ void NFCService::getTagState(u32 messagePointer) {
|
|||||||
void NFCService::communicationGetStatus(u32 messagePointer) {
|
void NFCService::communicationGetStatus(u32 messagePointer) {
|
||||||
log("NFC::CommunicationGetStatus");
|
log("NFC::CommunicationGetStatus");
|
||||||
|
|
||||||
if (adapterStatus != Old3DSAdapterStatus::InitializationComplete) {
|
if (!initialized) {
|
||||||
Helpers::warn("NFC::CommunicationGetStatus: Old 3DS NFC Adapter not initialized\n");
|
Helpers::warn("NFC::CommunicationGetStatus: Old 3DS NFC Adapter not initialized\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +107,7 @@ void NFCService::communicationGetStatus(u32 messagePointer) {
|
|||||||
|
|
||||||
void NFCService::startCommunication(u32 messagePointer) {
|
void NFCService::startCommunication(u32 messagePointer) {
|
||||||
log("NFC::StartCommunication\n");
|
log("NFC::StartCommunication\n");
|
||||||
|
// adapterStatus = Old3DSAdapterStatus::Active;
|
||||||
// TODO: Actually start communication when we emulate amiibo
|
// TODO: Actually start communication when we emulate amiibo
|
||||||
|
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x3, 1, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x3, 1, 0));
|
||||||
@@ -112,6 +116,7 @@ void NFCService::startCommunication(u32 messagePointer) {
|
|||||||
|
|
||||||
void NFCService::stopCommunication(u32 messagePointer) {
|
void NFCService::stopCommunication(u32 messagePointer) {
|
||||||
log("NFC::StopCommunication\n");
|
log("NFC::StopCommunication\n");
|
||||||
|
adapterStatus = Old3DSAdapterStatus::InitializationComplete;
|
||||||
// TODO: Actually stop communication when we emulate amiibo
|
// TODO: Actually stop communication when we emulate amiibo
|
||||||
|
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x4, 1, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x4, 1, 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user