service: nfc: Use official names (#6672)
This commit is contained in:
parent
9d4609e29a
commit
dc5ca96c0f
|
@ -32,7 +32,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::NotInitialized) {
|
if (nfc->nfc_mode != CommunicationMode::NotInitialized) {
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::Shutdown(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Finalize(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x02, 1, 0);
|
IPC::RequestParser rp(ctx, 0x02, 1, 0);
|
||||||
const auto communication_mode = rp.PopEnum<CommunicationMode>();
|
const auto communication_mode = rp.PopEnum<CommunicationMode>();
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ void Module::Interface::Shutdown(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
|
||||||
if (nfc->nfc_mode != communication_mode) {
|
if (nfc->nfc_mode != communication_mode) {
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void Module::Interface::Shutdown(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StartCommunication(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Connect(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x03, 0, 0);
|
IPC::RequestParser rp(ctx, 0x03, 0, 0);
|
||||||
|
|
||||||
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
||||||
|
@ -108,7 +108,7 @@ void Module::Interface::StartCommunication(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StopCommunication(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Disconnect(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x04, 0, 0);
|
IPC::RequestParser rp(ctx, 0x04, 0, 0);
|
||||||
|
|
||||||
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
||||||
|
@ -125,7 +125,7 @@ void Module::Interface::StopCommunication(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StartTagScanning(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::StartDetection(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x05, 1, 0);
|
IPC::RequestParser rp(ctx, 0x05, 1, 0);
|
||||||
u16 in_val = rp.Pop<u16>();
|
u16 in_val = rp.Pop<u16>();
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void Module::Interface::StartTagScanning(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::StopTagScanning(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::StopDetection(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x06, 0, 0);
|
IPC::RequestParser rp(ctx, 0x06, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -162,7 +162,7 @@ void Module::Interface::StopTagScanning(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = ResultCommandInvalidForState;
|
result = ResultInvalidOperation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ void Module::Interface::StopTagScanning(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::LoadAmiiboData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Mount(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x07, 0, 0);
|
IPC::RequestParser rp(ctx, 0x07, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -184,7 +184,7 @@ void Module::Interface::LoadAmiiboData(Kernel::HLERequestContext& ctx) {
|
||||||
result = nfc->device->MountAmiibo();
|
result = nfc->device->MountAmiibo();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = ResultCommandInvalidForState;
|
result = ResultInvalidOperation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ void Module::Interface::LoadAmiiboData(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::ResetTagScanState(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Unmount(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x08, 0, 0);
|
IPC::RequestParser rp(ctx, 0x08, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -204,7 +204,7 @@ void Module::Interface::ResetTagScanState(Kernel::HLERequestContext& ctx) {
|
||||||
result = nfc->device->ResetTagScanState();
|
result = nfc->device->ResetTagScanState();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = ResultCommandInvalidForState;
|
result = ResultInvalidOperation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ void Module::Interface::ResetTagScanState(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::UpdateStoredAmiiboData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::Flush(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x09, 0, 0);
|
IPC::RequestParser rp(ctx, 0x09, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -226,7 +226,7 @@ void Module::Interface::UpdateStoredAmiiboData(Kernel::HLERequestContext& ctx) {
|
||||||
result = nfc->device->Flush();
|
result = nfc->device->Flush();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = ResultCommandInvalidForState;
|
result = ResultInvalidOperation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ void Module::Interface::UpdateStoredAmiiboData(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetTagInRangeEvent(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetActivateEvent(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x0B, 0, 0);
|
IPC::RequestParser rp(ctx, 0x0B, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -242,7 +242,7 @@ void Module::Interface::GetTagInRangeEvent(Kernel::HLERequestContext& ctx) {
|
||||||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ void Module::Interface::GetTagInRangeEvent(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushCopyObjects(nfc->device->GetActivateEvent());
|
rb.PushCopyObjects(nfc->device->GetActivateEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetTagOutOfRangeEvent(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetDeactivateEvent(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x0C, 0, 0);
|
IPC::RequestParser rp(ctx, 0x0C, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -259,7 +259,7 @@ void Module::Interface::GetTagOutOfRangeEvent(Kernel::HLERequestContext& ctx) {
|
||||||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ void Module::Interface::GetTagOutOfRangeEvent(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushCopyObjects(nfc->device->GetDeactivateEvent());
|
rb.PushCopyObjects(nfc->device->GetDeactivateEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetTagState(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetStatus(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x0D, 0, 0);
|
IPC::RequestParser rp(ctx, 0x0D, 0, 0);
|
||||||
DeviceState state = DeviceState::NotInitialized;
|
DeviceState state = DeviceState::NotInitialized;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ void Module::Interface::GetTagState(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushEnum(state);
|
rb.PushEnum(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::CommunicationGetStatus(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetTargetConnectionStatus(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x0F, 0, 0);
|
IPC::RequestParser rp(ctx, 0x0F, 0, 0);
|
||||||
|
|
||||||
LOG_DEBUG(Service_NFC, "called");
|
LOG_DEBUG(Service_NFC, "called");
|
||||||
|
@ -345,7 +345,7 @@ void Module::Interface::GetTagInfo(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushRaw<TagInfo>(tag_info);
|
rb.PushRaw<TagInfo>(tag_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::CommunicationGetResult(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x12, 0, 0);
|
IPC::RequestParser rp(ctx, 0x12, 0, 0);
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
|
@ -354,7 +354,7 @@ void Module::Interface::CommunicationGetResult(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::OpenAppData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::OpenApplicationArea(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x13, 1, 0);
|
IPC::RequestParser rp(ctx, 0x13, 1, 0);
|
||||||
u32 access_id = rp.Pop<u32>();
|
u32 access_id = rp.Pop<u32>();
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ void Module::Interface::OpenAppData(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ void Module::Interface::OpenAppData(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::InitializeWriteAppData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CreateApplicationArea(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x14, 18, 2);
|
IPC::RequestParser rp(ctx, 0x14, 18, 2);
|
||||||
u32 access_id = rp.Pop<u32>();
|
u32 access_id = rp.Pop<u32>();
|
||||||
[[maybe_unused]] u32 size = rp.Pop<u32>();
|
[[maybe_unused]] u32 size = rp.Pop<u32>();
|
||||||
|
@ -382,7 +382,7 @@ void Module::Interface::InitializeWriteAppData(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,14 +392,14 @@ void Module::Interface::InitializeWriteAppData(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::ReadAppData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::ReadApplicationArea(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x15, 0, 0);
|
IPC::RequestParser rp(ctx, 0x15, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ void Module::Interface::ReadAppData(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushStaticBuffer(buffer, 0);
|
rb.PushStaticBuffer(buffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::WriteAppData(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::WriteApplicationArea(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x16, 12, 2);
|
IPC::RequestParser rp(ctx, 0x16, 12, 2);
|
||||||
[[maybe_unused]] u32 size = rp.Pop<u32>();
|
[[maybe_unused]] u32 size = rp.Pop<u32>();
|
||||||
std::vector<u8> tag_uuid_info = rp.PopStaticBuffer();
|
std::vector<u8> tag_uuid_info = rp.PopStaticBuffer();
|
||||||
|
@ -421,7 +421,7 @@ void Module::Interface::WriteAppData(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,14 +431,14 @@ void Module::Interface::WriteAppData(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetRegisterInfo(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetNfpRegisterInfo(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x17, 0, 0);
|
IPC::RequestParser rp(ctx, 0x17, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,14 +450,14 @@ void Module::Interface::GetRegisterInfo(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushRaw<RegisterInfo>(settings_info);
|
rb.PushRaw<RegisterInfo>(settings_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetCommonInfo(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::GetNfpCommonInfo(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x18, 0, 0);
|
IPC::RequestParser rp(ctx, 0x18, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,14 +469,14 @@ void Module::Interface::GetCommonInfo(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushRaw<CommonInfo>(amiibo_config);
|
rb.PushRaw<CommonInfo>(amiibo_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::GetAppDataInitStruct(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::InitializeCreateInfo(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x19, 0, 0);
|
IPC::RequestParser rp(ctx, 0x19, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ void Module::Interface::GetAppDataInitStruct(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushRaw<InitialStruct>(empty);
|
rb.PushRaw<InitialStruct>(empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::LoadAmiiboPartially(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::MountRom(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x1A, 0, 0);
|
IPC::RequestParser rp(ctx, 0x1A, 0, 0);
|
||||||
|
|
||||||
LOG_INFO(Service_NFC, "called");
|
LOG_INFO(Service_NFC, "called");
|
||||||
|
@ -502,7 +502,7 @@ void Module::Interface::LoadAmiiboPartially(Kernel::HLERequestContext& ctx) {
|
||||||
result = nfc->device->PartiallyMountAmiibo();
|
result = nfc->device->PartiallyMountAmiibo();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = ResultCommandInvalidForState;
|
result = ResultInvalidOperation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ void Module::Interface::GetIdentificationBlock(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ void Module::Interface::GetAdminInfo(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ void Module::Interface::GetEmptyRegisterInfo(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ void Module::Interface::SetRegisterInfo(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ void Module::Interface::DeleteRegisterInfo(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ void Module::Interface::DeleteApplicationArea(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ void Module::Interface::ExistsApplicationArea(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
if (nfc->nfc_mode != CommunicationMode::Amiibo) {
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
rb.Push(ResultCommandInvalidForState);
|
rb.Push(ResultInvalidOperation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,81 +61,81 @@ public:
|
||||||
void Initialize(Kernel::HLERequestContext& ctx);
|
void Initialize(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::Shutdown service function
|
* NFC::Finalize service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00020040]
|
* 0 : Header code [0x00020040]
|
||||||
* 1 : (u8) CommunicationMode.
|
* 1 : (u8) CommunicationMode.
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void Shutdown(Kernel::HLERequestContext& ctx);
|
void Finalize(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::StartCommunication service function
|
* NFC::Connect service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00030000]
|
* 0 : Header code [0x00030000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void StartCommunication(Kernel::HLERequestContext& ctx);
|
void Connect(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::StopCommunication service function
|
* NFC::Disconnect service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00040000]
|
* 0 : Header code [0x00040000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void StopCommunication(Kernel::HLERequestContext& ctx);
|
void Disconnect(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::StartTagScanning service function
|
* NFC::StartDetection service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00050040]
|
* 0 : Header code [0x00050040]
|
||||||
* 1 : (u16) unknown. This is normally 0x0
|
* 1 : (u16) unknown. This is normally 0x0
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void StartTagScanning(Kernel::HLERequestContext& ctx);
|
void StartDetection(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::StopTagScanning service function
|
* NFC::StopDetection service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00060000]
|
* 0 : Header code [0x00060000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void StopTagScanning(Kernel::HLERequestContext& ctx);
|
void StopDetection(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::LoadAmiiboData service function
|
* NFC::Mount service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00070000]
|
* 0 : Header code [0x00070000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void LoadAmiiboData(Kernel::HLERequestContext& ctx);
|
void Mount(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::ResetTagScanState service function
|
* NFC::Unmount service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00080000]
|
* 0 : Header code [0x00080000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void ResetTagScanState(Kernel::HLERequestContext& ctx);
|
void Unmount(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::UpdateStoredAmiiboData service function
|
* NFC::Flush service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00090002]
|
* 0 : Header code [0x00090002]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void UpdateStoredAmiiboData(Kernel::HLERequestContext& ctx);
|
void Flush(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetTagInRangeEvent service function
|
* NFC::GetActivateEvent service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x000B0000]
|
* 0 : Header code [0x000B0000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
|
@ -143,10 +143,10 @@ public:
|
||||||
* 2 : Copy handle descriptor
|
* 2 : Copy handle descriptor
|
||||||
* 3 : Event Handle
|
* 3 : Event Handle
|
||||||
*/
|
*/
|
||||||
void GetTagInRangeEvent(Kernel::HLERequestContext& ctx);
|
void GetActivateEvent(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetTagOutOfRangeEvent service function
|
* NFC::GetDeactivateEvent service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x000C0000]
|
* 0 : Header code [0x000C0000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
|
@ -154,27 +154,27 @@ public:
|
||||||
* 2 : Copy handle descriptor
|
* 2 : Copy handle descriptor
|
||||||
* 3 : Event Handle
|
* 3 : Event Handle
|
||||||
*/
|
*/
|
||||||
void GetTagOutOfRangeEvent(Kernel::HLERequestContext& ctx);
|
void GetDeactivateEvent(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetTagState service function
|
* NFC::GetStatus service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x000D0000]
|
* 0 : Header code [0x000D0000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : (u8) Tag state
|
* 2 : (u8) Tag state
|
||||||
*/
|
*/
|
||||||
void GetTagState(Kernel::HLERequestContext& ctx);
|
void GetStatus(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::CommunicationGetStatus service function
|
* NFC::GetTargetConnectionStatus service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x000F0000]
|
* 0 : Header code [0x000F0000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : (u8) Communication state
|
* 2 : (u8) Communication state
|
||||||
*/
|
*/
|
||||||
void CommunicationGetStatus(Kernel::HLERequestContext& ctx);
|
void GetTargetConnectionStatus(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetTagInfo2 service function
|
* NFC::GetTagInfo2 service function
|
||||||
|
@ -197,27 +197,27 @@ public:
|
||||||
void GetTagInfo(Kernel::HLERequestContext& ctx);
|
void GetTagInfo(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetTagInfo service function
|
* NFC::GetConnectResult service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00120000]
|
* 0 : Header code [0x00120000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : Output NFC-adapter result-code
|
* 2 : Output NFC-adapter result-code
|
||||||
*/
|
*/
|
||||||
void CommunicationGetResult(Kernel::HLERequestContext& ctx);
|
void GetConnectResult(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::OpenAppData service function
|
* NFC::OpenApplicationArea service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00130040]
|
* 0 : Header code [0x00130040]
|
||||||
* 1 : (u32) App ID
|
* 1 : (u32) App ID
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void OpenAppData(Kernel::HLERequestContext& ctx);
|
void OpenApplicationArea(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::InitializeWriteAppData service function
|
* NFC::CreateApplicationArea service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00140384]
|
* 0 : Header code [0x00140384]
|
||||||
* 1 : (u32) App ID
|
* 1 : (u32) App ID
|
||||||
|
@ -230,20 +230,20 @@ public:
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void InitializeWriteAppData(Kernel::HLERequestContext& ctx);
|
void CreateApplicationArea(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::ReadAppData service function
|
* NFC::ReadApplicationArea service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00150040]
|
* 0 : Header code [0x00150040]
|
||||||
* 1 : Size (unused? Hard-coded to be 0xD8)
|
* 1 : Size (unused? Hard-coded to be 0xD8)
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void ReadAppData(Kernel::HLERequestContext& ctx);
|
void ReadApplicationArea(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::WriteAppData service function
|
* NFC::WriteApplicationArea service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00160242]
|
* 0 : Header code [0x00160242]
|
||||||
* 1 : Size
|
* 1 : Size
|
||||||
|
@ -253,37 +253,37 @@ public:
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void WriteAppData(Kernel::HLERequestContext& ctx);
|
void WriteApplicationArea(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetRegisterInfo service function
|
* NFC::GetNfpRegisterInfo service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00170000]
|
* 0 : Header code [0x00170000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2-43 : AmiiboSettings struct (see above)
|
* 2-43 : AmiiboSettings struct (see above)
|
||||||
*/
|
*/
|
||||||
void GetRegisterInfo(Kernel::HLERequestContext& ctx);
|
void GetNfpRegisterInfo(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetCommonInfo service function
|
* NFC::GetNfpCommonInfo service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00180000]
|
* 0 : Header code [0x00180000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2-17 : 0x40-byte config struct
|
* 2-17 : 0x40-byte config struct
|
||||||
*/
|
*/
|
||||||
void GetCommonInfo(Kernel::HLERequestContext& ctx);
|
void GetNfpCommonInfo(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetAppDataInitStruct service function
|
* NFC::InitializeCreateInfo service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* 0 : Header code [0x00180000]
|
* 0 : Header code [0x00180000]
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2-16 : 0x3C-byte config struct
|
* 2-16 : 0x3C-byte config struct
|
||||||
*/
|
*/
|
||||||
void GetAppDataInitStruct(Kernel::HLERequestContext& ctx);
|
void InitializeCreateInfo(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::LoadAmiiboPartially service function
|
* NFC::LoadAmiiboPartially service function
|
||||||
|
@ -292,7 +292,7 @@ public:
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void LoadAmiiboPartially(Kernel::HLERequestContext& ctx);
|
void MountRom(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NFC::GetIdentificationBlock service function
|
* NFC::GetIdentificationBlock service function
|
||||||
|
|
|
@ -176,7 +176,7 @@ ResultCode NfcDevice::StartCommunication() {
|
||||||
|
|
||||||
if (device_state != DeviceState::Initialized ||
|
if (device_state != DeviceState::Initialized ||
|
||||||
communication_state != CommunicationState::Idle) {
|
communication_state != CommunicationState::Idle) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
communication_state = CommunicationState::SearchingForAdapter;
|
communication_state = CommunicationState::SearchingForAdapter;
|
||||||
|
@ -193,7 +193,7 @@ ResultCode NfcDevice::StopCommunication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (communication_state == CommunicationState::Idle) {
|
if (communication_state == CommunicationState::Idle) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_state == DeviceState::TagMounted ||
|
if (device_state == DeviceState::TagMounted ||
|
||||||
|
@ -214,7 +214,7 @@ ResultCode NfcDevice::StartDetection(TagProtocol allowed_protocol) {
|
||||||
|
|
||||||
if (device_state != DeviceState::Initialized && device_state != DeviceState::TagRemoved &&
|
if (device_state != DeviceState::Initialized && device_state != DeviceState::TagRemoved &&
|
||||||
communication_state != CommunicationState::Initialized) {
|
communication_state != CommunicationState::Initialized) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Set console in search mode here
|
// TODO: Set console in search mode here
|
||||||
|
@ -253,7 +253,7 @@ ResultCode NfcDevice::StopDetection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NfcDevice::Flush() {
|
ResultCode NfcDevice::Flush() {
|
||||||
|
@ -261,7 +261,7 @@ ResultCode NfcDevice::Flush() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -284,12 +284,12 @@ ResultCode NfcDevice::Flush() {
|
||||||
if (!is_plain_amiibo) {
|
if (!is_plain_amiibo) {
|
||||||
if (!AmiiboCrypto::EncodeAmiibo(tag.file, encrypted_tag.file)) {
|
if (!AmiiboCrypto::EncodeAmiibo(tag.file, encrypted_tag.file)) {
|
||||||
LOG_ERROR(Service_NFC, "Failed to encode data");
|
LOG_ERROR(Service_NFC, "Failed to encode data");
|
||||||
return ResultWriteAmiiboFailed;
|
return ResultOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amiibo_filename.empty()) {
|
if (amiibo_filename.empty()) {
|
||||||
LOG_ERROR(Service_NFC, "Tried to use UpdateStoredAmiiboData on a nonexistant file.");
|
LOG_ERROR(Service_NFC, "Tried to use UpdateStoredAmiiboData on a nonexistant file.");
|
||||||
return ResultWriteAmiiboFailed;
|
return ResultOperationFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ ResultCode NfcDevice::Flush() {
|
||||||
amiibo_file.Close();
|
amiibo_file.Close();
|
||||||
|
|
||||||
if (write_failed) {
|
if (write_failed) {
|
||||||
return ResultWriteAmiiboFailed;
|
return ResultOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_data_moddified = false;
|
is_data_moddified = false;
|
||||||
|
@ -328,14 +328,14 @@ ResultCode NfcDevice::Mount() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AmiiboCrypto::IsAmiiboValid(encrypted_tag.file)) {
|
if (!AmiiboCrypto::IsAmiiboValid(encrypted_tag.file)) {
|
||||||
LOG_ERROR(Service_NFC, "Not an amiibo");
|
LOG_ERROR(Service_NFC, "Not an amiibo");
|
||||||
return ResultNotAnAmiibo;
|
return ResultNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The loaded amiibo is not encrypted
|
// The loaded amiibo is not encrypted
|
||||||
|
@ -346,7 +346,7 @@ ResultCode NfcDevice::Mount() {
|
||||||
|
|
||||||
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
|
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
|
||||||
LOG_ERROR(Service_NFC, "Can't decode amiibo {}", device_state);
|
LOG_ERROR(Service_NFC, "Can't decode amiibo {}", device_state);
|
||||||
return ResultCorruptedData;
|
return ResultNeedFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_state = DeviceState::TagMounted;
|
device_state = DeviceState::TagMounted;
|
||||||
|
@ -362,7 +362,7 @@ ResultCode NfcDevice::MountAmiibo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag_info.tag_type != PackedTagType::Type2) {
|
if (tag_info.tag_type != PackedTagType::Type2) {
|
||||||
return ResultNotAnAmiibo;
|
return ResultNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Mount();
|
return Mount();
|
||||||
|
@ -373,14 +373,14 @@ ResultCode NfcDevice::PartiallyMount() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AmiiboCrypto::IsAmiiboValid(encrypted_tag.file)) {
|
if (!AmiiboCrypto::IsAmiiboValid(encrypted_tag.file)) {
|
||||||
LOG_ERROR(Service_NFC, "Not an amiibo");
|
LOG_ERROR(Service_NFC, "Not an amiibo");
|
||||||
return ResultNotAnAmiibo;
|
return ResultNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The loaded amiibo is not encrypted
|
// The loaded amiibo is not encrypted
|
||||||
|
@ -391,7 +391,7 @@ ResultCode NfcDevice::PartiallyMount() {
|
||||||
|
|
||||||
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
|
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
|
||||||
LOG_ERROR(Service_NFC, "Can't decode amiibo {}", device_state);
|
LOG_ERROR(Service_NFC, "Can't decode amiibo {}", device_state);
|
||||||
return ResultCorruptedData;
|
return ResultNeedFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_state = DeviceState::TagPartiallyMounted;
|
device_state = DeviceState::TagPartiallyMounted;
|
||||||
|
@ -407,7 +407,7 @@ ResultCode NfcDevice::PartiallyMountAmiibo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag_info.tag_type != PackedTagType::Type2) {
|
if (tag_info.tag_type != PackedTagType::Type2) {
|
||||||
return ResultNotAnAmiibo;
|
return ResultNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PartiallyMount();
|
return PartiallyMount();
|
||||||
|
@ -418,7 +418,7 @@ ResultCode NfcDevice::ResetTagScanState() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ ResultCode NfcDevice::GetTagInfo(TagInfo& tag_info) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,7 @@ ResultCode NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ ResultCode NfcDevice::GetModelInfo(ModelInfo& model_info) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -521,13 +521,13 @@ ResultCode NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.amiibo_initialized == 0) {
|
if (tag.file.settings.settings.amiibo_initialized == 0) {
|
||||||
return ResultRegistrationIsNotInitialized;
|
return ResultNeedRegister;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = tag.file.settings;
|
const auto& settings = tag.file.settings;
|
||||||
|
@ -550,7 +550,7 @@ ResultCode NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -614,13 +614,13 @@ ResultCode NfcDevice::DeleteRegisterInfo() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.amiibo_initialized == 0) {
|
if (tag.file.settings.settings.amiibo_initialized == 0) {
|
||||||
return ResultRegistrationIsNotInitialized;
|
return ResultNeedRegister;
|
||||||
}
|
}
|
||||||
|
|
||||||
CryptoPP::AutoSeededRandomPool rng;
|
CryptoPP::AutoSeededRandomPool rng;
|
||||||
|
@ -648,7 +648,7 @@ ResultCode NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -683,7 +683,7 @@ ResultCode NfcDevice::RestoreAmiibo() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -713,19 +713,19 @@ ResultCode NfcDevice::OpenApplicationArea(u32 access_id) {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
||||||
LOG_WARNING(Service_NFC, "Application area is not initialized");
|
LOG_WARNING(Service_NFC, "Application area is not initialized");
|
||||||
return ResultApplicationAreaIsNotInitialized;
|
return ResultNeedCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.application_area_id != access_id) {
|
if (tag.file.application_area_id != access_id) {
|
||||||
LOG_WARNING(Service_NFC, "Wrong application area id");
|
LOG_WARNING(Service_NFC, "Wrong application area id");
|
||||||
return ResultWrongApplicationAreaId;
|
return ResultAccessIdMisMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_app_area_open = true;
|
is_app_area_open = true;
|
||||||
|
@ -740,14 +740,14 @@ ResultCode NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
||||||
LOG_WARNING(Service_NFC, "Application area is not initialized");
|
LOG_WARNING(Service_NFC, "Application area is not initialized");
|
||||||
return ResultApplicationAreaIsNotInitialized;
|
return ResultNeedCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
application_area_id = tag.file.application_area_id;
|
application_area_id = tag.file.application_area_id;
|
||||||
|
@ -760,19 +760,19 @@ ResultCode NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_app_area_open) {
|
if (!is_app_area_open) {
|
||||||
LOG_ERROR(Service_NFC, "Application area is not open");
|
LOG_ERROR(Service_NFC, "Application area is not open");
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
||||||
LOG_ERROR(Service_NFC, "Application area is not initialized");
|
LOG_ERROR(Service_NFC, "Application area is not initialized");
|
||||||
return ResultApplicationAreaIsNotInitialized;
|
return ResultNeedCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.size() > sizeof(ApplicationArea)) {
|
if (data.size() > sizeof(ApplicationArea)) {
|
||||||
|
@ -789,7 +789,7 @@ ResultCode NfcDevice::SetApplicationArea(std::span<const u8> data) {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -806,12 +806,12 @@ ResultCode NfcDevice::SetApplicationArea(std::span<const u8> data) {
|
||||||
|
|
||||||
if (!is_app_area_open) {
|
if (!is_app_area_open) {
|
||||||
LOG_ERROR(Service_NFC, "Application area is not open");
|
LOG_ERROR(Service_NFC, "Application area is not open");
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
if (tag.file.settings.settings.appdata_initialized.Value() == 0) {
|
||||||
LOG_ERROR(Service_NFC, "Application area is not initialized");
|
LOG_ERROR(Service_NFC, "Application area is not initialized");
|
||||||
return ResultApplicationAreaIsNotInitialized;
|
return ResultNeedCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memcpy(tag.file.application_area.data(), data.data(), data.size());
|
std::memcpy(tag.file.application_area.data(), data.data(), data.size());
|
||||||
|
@ -837,14 +837,14 @@ ResultCode NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> d
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.appdata_initialized.Value() != 0) {
|
if (tag.file.settings.settings.appdata_initialized.Value() != 0) {
|
||||||
LOG_ERROR(Service_NFC, "Application area already exist");
|
LOG_ERROR(Service_NFC, "Application area already exist");
|
||||||
return ResultApplicationAreaExist;
|
return ResultAlreadyCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RecreateApplicationArea(access_id, data);
|
return RecreateApplicationArea(access_id, data);
|
||||||
|
@ -855,7 +855,7 @@ ResultCode NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8>
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -867,7 +867,7 @@ ResultCode NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8>
|
||||||
|
|
||||||
if (is_app_area_open) {
|
if (is_app_area_open) {
|
||||||
LOG_ERROR(Service_NFC, "Application area is open");
|
LOG_ERROR(Service_NFC, "Application area is open");
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memcpy(tag.file.application_area.data(), data.data(), data.size());
|
std::memcpy(tag.file.application_area.data(), data.data(), data.size());
|
||||||
|
@ -912,13 +912,13 @@ ResultCode NfcDevice::DeleteApplicationArea() {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.file.settings.settings.appdata_initialized == 0) {
|
if (tag.file.settings.settings.appdata_initialized == 0) {
|
||||||
return ResultApplicationAreaIsNotInitialized;
|
return ResultNeedCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
CryptoPP::AutoSeededRandomPool rng;
|
CryptoPP::AutoSeededRandomPool rng;
|
||||||
|
@ -950,7 +950,7 @@ ResultCode NfcDevice::ApplicationAreaExist(bool& has_application_area) {
|
||||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||||
const auto connection_result = CheckConnectionState();
|
const auto connection_result = CheckConnectionState();
|
||||||
if (connection_result.IsSuccess()) {
|
if (connection_result.IsSuccess()) {
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
return connection_result;
|
return connection_result;
|
||||||
}
|
}
|
||||||
|
@ -981,16 +981,16 @@ ResultCode NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultCommandInvalidForState;
|
return ResultInvalidOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode NfcDevice::CheckConnectionState() const {
|
ResultCode NfcDevice::CheckConnectionState() const {
|
||||||
if (connection_state == ConnectionState::Lost) {
|
if (connection_state == ConnectionState::Lost) {
|
||||||
return ResultCommunicationLost;
|
return ResultSleep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection_state == ConnectionState::NoAdapter) {
|
if (connection_state == ConnectionState::NoAdapter) {
|
||||||
return ResultNoAdapterDetected;
|
return ResultWifiOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
|
|
@ -14,31 +14,31 @@ NFC_M::NFC_M(std::shared_ptr<Module> nfc) : Module::Interface(std::move(nfc), "n
|
||||||
// nfc:u shared commands
|
// nfc:u shared commands
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{IPC::MakeHeader(0x0001, 1, 0), &NFC_M::Initialize, "Initialize"},
|
{IPC::MakeHeader(0x0001, 1, 0), &NFC_M::Initialize, "Initialize"},
|
||||||
{IPC::MakeHeader(0x0002, 1, 0), &NFC_M::Shutdown, "Shutdown"},
|
{IPC::MakeHeader(0x0002, 1, 0), &NFC_M::Finalize, "Finalize"},
|
||||||
{IPC::MakeHeader(0x0003, 0, 0), &NFC_M::StartCommunication, "StartCommunication"},
|
{IPC::MakeHeader(0x0003, 0, 0), &NFC_M::Connect, "Connect"},
|
||||||
{IPC::MakeHeader(0x0004, 0, 0), &NFC_M::StopCommunication, "StopCommunication"},
|
{IPC::MakeHeader(0x0004, 0, 0), &NFC_M::Disconnect, "Disconnect"},
|
||||||
{IPC::MakeHeader(0x0005, 1, 0), &NFC_M::StartTagScanning, "StartTagScanning"},
|
{IPC::MakeHeader(0x0005, 1, 0), &NFC_M::StartDetection, "StartDetection"},
|
||||||
{IPC::MakeHeader(0x0006, 0, 0), &NFC_M::StopTagScanning, "StopTagScanning"},
|
{IPC::MakeHeader(0x0006, 0, 0), &NFC_M::StopDetection, "StopDetection"},
|
||||||
{IPC::MakeHeader(0x0007, 0, 0), &NFC_M::LoadAmiiboData, "LoadAmiiboData"},
|
{IPC::MakeHeader(0x0007, 0, 0), &NFC_M::Mount, "Mount"},
|
||||||
{IPC::MakeHeader(0x0008, 0, 0), &NFC_M::ResetTagScanState, "ResetTagScanState"},
|
{IPC::MakeHeader(0x0008, 0, 0), &NFC_M::Unmount, "Unmount"},
|
||||||
{IPC::MakeHeader(0x0009, 0, 2), &NFC_M::UpdateStoredAmiiboData, "UpdateStoredAmiiboData"},
|
{IPC::MakeHeader(0x0009, 0, 2), &NFC_M::Flush, "Flush"},
|
||||||
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "Unknown0x0A"},
|
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "Restore"},
|
||||||
{IPC::MakeHeader(0x000B, 0, 0), &NFC_M::GetTagInRangeEvent, "GetTagInRangeEvent"},
|
{IPC::MakeHeader(0x000B, 0, 0), &NFC_M::GetActivateEvent, "GetActivateEvent"},
|
||||||
{IPC::MakeHeader(0x000C, 0, 0), &NFC_M::GetTagOutOfRangeEvent, "GetTagOutOfRangeEvent"},
|
{IPC::MakeHeader(0x000C, 0, 0), &NFC_M::GetDeactivateEvent, "GetDeactivateEvent"},
|
||||||
{IPC::MakeHeader(0x000D, 0, 0), &NFC_M::GetTagState, "GetTagState"},
|
{IPC::MakeHeader(0x000D, 0, 0), &NFC_M::GetStatus, "GetStatus"},
|
||||||
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "Unknown0x0E"},
|
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "Unknown0x0E"},
|
||||||
{IPC::MakeHeader(0x000F, 0, 0), &NFC_M::CommunicationGetStatus, "CommunicationGetStatus"},
|
{IPC::MakeHeader(0x000F, 0, 0), &NFC_M::GetTargetConnectionStatus, "GetTargetConnectionStatus"},
|
||||||
{IPC::MakeHeader(0x0010, 0, 0), &NFC_M::GetTagInfo2, "GetTagInfo2"},
|
{IPC::MakeHeader(0x0010, 0, 0), &NFC_M::GetTagInfo2, "GetTagInfo2"},
|
||||||
{IPC::MakeHeader(0x0011, 0, 0), &NFC_M::GetTagInfo, "GetTagInfo"},
|
{IPC::MakeHeader(0x0011, 0, 0), &NFC_M::GetTagInfo, "GetTagInfo"},
|
||||||
{IPC::MakeHeader(0x0012, 0, 0), &NFC_M::CommunicationGetResult, "CommunicationGetResult"},
|
{IPC::MakeHeader(0x0012, 0, 0), &NFC_M::GetConnectResult, "GetConnectResult"},
|
||||||
{IPC::MakeHeader(0x0013, 1, 0), &NFC_M::OpenAppData, "OpenAppData"},
|
{IPC::MakeHeader(0x0013, 1, 0), &NFC_M::OpenApplicationArea, "OpenApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0014, 14, 4), &NFC_M::InitializeWriteAppData, "InitializeWriteAppData"},
|
{IPC::MakeHeader(0x0014, 14, 4), &NFC_M::CreateApplicationArea, "CreateApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0015, 1, 0), &NFC_M::ReadAppData, "ReadAppData"},
|
{IPC::MakeHeader(0x0015, 1, 0), &NFC_M::ReadApplicationArea, "ReadApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0016, 9, 2), &NFC_M::WriteAppData, "WriteAppData"},
|
{IPC::MakeHeader(0x0016, 9, 2), &NFC_M::WriteApplicationArea, "WriteApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0017, 0, 0), &NFC_M::GetRegisterInfo, "GetRegisterInfo"},
|
{IPC::MakeHeader(0x0017, 0, 0), &NFC_M::GetNfpRegisterInfo, "GetNfpRegisterInfo"},
|
||||||
{IPC::MakeHeader(0x0018, 0, 0), &NFC_M::GetCommonInfo, "GetCommonInfo"},
|
{IPC::MakeHeader(0x0018, 0, 0), &NFC_M::GetNfpCommonInfo, "GetNfpCommonInfo"},
|
||||||
{IPC::MakeHeader(0x0019, 0, 0), &NFC_M::GetAppDataInitStruct, "GetAppDataInitStruct"},
|
{IPC::MakeHeader(0x0019, 0, 0), &NFC_M::InitializeCreateInfo, "InitializeCreateInfo"},
|
||||||
{IPC::MakeHeader(0x001A, 0, 0), &NFC_M::LoadAmiiboPartially, "LoadAmiiboPartially"},
|
{IPC::MakeHeader(0x001A, 0, 0), &NFC_M::MountRom, "MountRom"},
|
||||||
{IPC::MakeHeader(0x001B, 0, 0), &NFC_M::GetIdentificationBlock, "GetIdentificationBlock"},
|
{IPC::MakeHeader(0x001B, 0, 0), &NFC_M::GetIdentificationBlock, "GetIdentificationBlock"},
|
||||||
// nfc:m
|
// nfc:m
|
||||||
{IPC::MakeHeader(0x0401, 3, 2), &NFC_M::Format, "Format"},
|
{IPC::MakeHeader(0x0401, 3, 2), &NFC_M::Format, "Format"},
|
||||||
|
|
|
@ -14,18 +14,32 @@ enum {
|
||||||
InvalidArgument = 81,
|
InvalidArgument = 81,
|
||||||
|
|
||||||
InvalidChecksum = 200,
|
InvalidChecksum = 200,
|
||||||
WriteFailed = 328,
|
|
||||||
|
|
||||||
CommandInvalidForState = 512,
|
Failed = 320,
|
||||||
NotAnAmiibo = 522,
|
OperationFailed = 328,
|
||||||
CorruptedData = 536,
|
DataAccessFailed = 336,
|
||||||
AppDataUninitialized = 544,
|
FatalError = 384,
|
||||||
RegistrationUnitialized = 552,
|
Unexpected = 392,
|
||||||
ApplicationAreaExist = 560,
|
|
||||||
AppIdMismatch = 568,
|
|
||||||
|
|
||||||
CommunicationLost = 608,
|
InvalidOperation = 512,
|
||||||
NoAdapterDetected = 616,
|
NotSupported = 522,
|
||||||
|
NeedRestore = 528,
|
||||||
|
NeedFormat = 536,
|
||||||
|
NeedCreate = 544,
|
||||||
|
NeedRegister = 552,
|
||||||
|
AlreadyCreated = 560,
|
||||||
|
AccessIdMisMatch = 568,
|
||||||
|
NotBroken = 576,
|
||||||
|
UidMisMatch = 584,
|
||||||
|
InvalidFormatVersion = 592,
|
||||||
|
|
||||||
|
NotImplemented = 600,
|
||||||
|
Sleep = 608,
|
||||||
|
WifiOff = 616,
|
||||||
|
UpdateRequired = 624,
|
||||||
|
IrFunctionError = 640,
|
||||||
|
NfcTargetError = 648,
|
||||||
|
ConnectCanceled = 656,
|
||||||
};
|
};
|
||||||
} // namespace ErrCodes
|
} // namespace ErrCodes
|
||||||
|
|
||||||
|
@ -33,30 +47,25 @@ constexpr ResultCode ResultInvalidArgumentValue(ErrCodes::InvalidArgumentValue,
|
||||||
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
||||||
constexpr ResultCode ResultInvalidArgument(ErrCodes::InvalidArgument, ErrorModule::NFC,
|
constexpr ResultCode ResultInvalidArgument(ErrCodes::InvalidArgument, ErrorModule::NFC,
|
||||||
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
||||||
constexpr ResultCode ResultCommandInvalidForState(ErrCodes::CommandInvalidForState,
|
constexpr ResultCode ResultInvalidOperation(ErrCodes::InvalidOperation, ErrorModule::NFC,
|
||||||
ErrorModule::NFC, ErrorSummary::InvalidState,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorLevel::Status);
|
constexpr ResultCode ResultNotSupported(ErrCodes::NotSupported, ErrorModule::NFC,
|
||||||
constexpr ResultCode ResultNotAnAmiibo(ErrCodes::NotAnAmiibo, ErrorModule::NFC,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
constexpr ResultCode ResultNeedFormat(ErrCodes::NeedFormat, ErrorModule::NFC,
|
||||||
constexpr ResultCode ResultCorruptedData(ErrCodes::CorruptedData, ErrorModule::NFC,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
constexpr ResultCode ResultOperationFailed(ErrCodes::OperationFailed, ErrorModule::NFC,
|
||||||
constexpr ResultCode ResultWriteAmiiboFailed(ErrCodes::WriteFailed, ErrorModule::NFC,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
constexpr ResultCode ResultNeedCreate(ErrCodes::NeedCreate, ErrorModule::NFC,
|
||||||
constexpr ResultCode ResultApplicationAreaIsNotInitialized(ErrCodes::AppDataUninitialized,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorModule::NFC,
|
constexpr ResultCode ResultNeedRegister(ErrCodes::NeedRegister, ErrorModule::NFC,
|
||||||
ErrorSummary::InvalidState,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorLevel::Status);
|
constexpr ResultCode ResultAlreadyCreated(ErrCodes::AlreadyCreated, ErrorModule::NFC,
|
||||||
constexpr ResultCode ResultRegistrationIsNotInitialized(ErrCodes::RegistrationUnitialized,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorModule::NFC,
|
constexpr ResultCode ResultAccessIdMisMatch(ErrCodes::AccessIdMisMatch, ErrorModule::NFC,
|
||||||
ErrorSummary::InvalidState,
|
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
ErrorLevel::Status);
|
constexpr ResultCode ResultSleep(ErrCodes::Sleep, ErrorModule::NFC, ErrorSummary::InvalidState,
|
||||||
constexpr ResultCode ResultApplicationAreaExist(ErrCodes::ApplicationAreaExist, ErrorModule::NFC,
|
ErrorLevel::Status);
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
constexpr ResultCode ResultWifiOff(ErrCodes::WifiOff, ErrorModule::NFC, ErrorSummary::InvalidState,
|
||||||
constexpr ResultCode ResultWrongApplicationAreaId(ErrCodes::AppIdMismatch, ErrorModule::NFC,
|
ErrorLevel::Status);
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
|
||||||
constexpr ResultCode ResultCommunicationLost(ErrCodes::CommunicationLost, ErrorModule::NFC,
|
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
|
||||||
constexpr ResultCode ResultNoAdapterDetected(ErrCodes::NoAdapterDetected, ErrorModule::NFC,
|
|
||||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
|
||||||
|
|
||||||
} // namespace Service::NFC
|
} // namespace Service::NFC
|
||||||
|
|
|
@ -13,31 +13,31 @@ NFC_U::NFC_U(std::shared_ptr<Module> nfc) : Module::Interface(std::move(nfc), "n
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{IPC::MakeHeader(0x0001, 1, 0), &NFC_U::Initialize, "Initialize"},
|
{IPC::MakeHeader(0x0001, 1, 0), &NFC_U::Initialize, "Initialize"},
|
||||||
{IPC::MakeHeader(0x0002, 1, 0), &NFC_U::Shutdown, "Shutdown"},
|
{IPC::MakeHeader(0x0002, 1, 0), &NFC_U::Finalize, "Finalize"},
|
||||||
{IPC::MakeHeader(0x0003, 0, 0), &NFC_U::StartCommunication, "StartCommunication"},
|
{IPC::MakeHeader(0x0003, 0, 0), &NFC_U::Connect, "Connect"},
|
||||||
{IPC::MakeHeader(0x0004, 0, 0), &NFC_U::StopCommunication, "StopCommunication"},
|
{IPC::MakeHeader(0x0004, 0, 0), &NFC_U::Disconnect, "Disconnect"},
|
||||||
{IPC::MakeHeader(0x0005, 1, 0), &NFC_U::StartTagScanning, "StartTagScanning"},
|
{IPC::MakeHeader(0x0005, 1, 0), &NFC_U::StartDetection, "StartDetection"},
|
||||||
{IPC::MakeHeader(0x0006, 0, 0), &NFC_U::StopTagScanning, "StopTagScanning"},
|
{IPC::MakeHeader(0x0006, 0, 0), &NFC_U::StopDetection, "StopDetection"},
|
||||||
{IPC::MakeHeader(0x0007, 0, 0), &NFC_U::LoadAmiiboData, "LoadAmiiboData"},
|
{IPC::MakeHeader(0x0007, 0, 0), &NFC_U::Mount, "Mount"},
|
||||||
{IPC::MakeHeader(0x0008, 0, 0), &NFC_U::ResetTagScanState, "ResetTagScanState"},
|
{IPC::MakeHeader(0x0008, 0, 0), &NFC_U::Unmount, "Unmount"},
|
||||||
{IPC::MakeHeader(0x0009, 0, 2), &NFC_U::UpdateStoredAmiiboData, "UpdateStoredAmiiboData"},
|
{IPC::MakeHeader(0x0009, 0, 2), &NFC_U::Flush, "Flush"},
|
||||||
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "Unknown0x0A"},
|
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "Restore"},
|
||||||
{IPC::MakeHeader(0x000B, 0, 0), &NFC_U::GetTagInRangeEvent, "GetTagInRangeEvent"},
|
{IPC::MakeHeader(0x000B, 0, 0), &NFC_U::GetActivateEvent, "GetActivateEvent"},
|
||||||
{IPC::MakeHeader(0x000C, 0, 0), &NFC_U::GetTagOutOfRangeEvent, "GetTagOutOfRangeEvent"},
|
{IPC::MakeHeader(0x000C, 0, 0), &NFC_U::GetDeactivateEvent, "GetDeactivateEvent"},
|
||||||
{IPC::MakeHeader(0x000D, 0, 0), &NFC_U::GetTagState, "GetTagState"},
|
{IPC::MakeHeader(0x000D, 0, 0), &NFC_U::GetStatus, "GetStatus"},
|
||||||
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "Unknown0x0E"},
|
{IPC::MakeHeader(0x000E, 0, 0), nullptr, "Unknown0x0E"},
|
||||||
{IPC::MakeHeader(0x000F, 0, 0), &NFC_U::CommunicationGetStatus, "CommunicationGetStatus"},
|
{IPC::MakeHeader(0x000F, 0, 0), &NFC_U::GetTargetConnectionStatus, "GetTargetConnectionStatus"},
|
||||||
{IPC::MakeHeader(0x0010, 0, 0), &NFC_U::GetTagInfo2, "GetTagInfo2"},
|
{IPC::MakeHeader(0x0010, 0, 0), &NFC_U::GetTagInfo2, "GetTagInfo2"},
|
||||||
{IPC::MakeHeader(0x0011, 0, 0), &NFC_U::GetTagInfo, "GetTagInfo"},
|
{IPC::MakeHeader(0x0011, 0, 0), &NFC_U::GetTagInfo, "GetTagInfo"},
|
||||||
{IPC::MakeHeader(0x0012, 0, 0), &NFC_U::CommunicationGetResult, "CommunicationGetResult"},
|
{IPC::MakeHeader(0x0012, 0, 0), &NFC_U::GetConnectResult, "GetConnectResult"},
|
||||||
{IPC::MakeHeader(0x0013, 1, 0), &NFC_U::OpenAppData, "OpenAppData"},
|
{IPC::MakeHeader(0x0013, 1, 0), &NFC_U::OpenApplicationArea, "OpenApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0014, 14, 4), &NFC_U::InitializeWriteAppData, "InitializeWriteAppData"},
|
{IPC::MakeHeader(0x0014, 14, 4), &NFC_U::CreateApplicationArea, "CreateApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0015, 1, 0), &NFC_U::ReadAppData, "ReadAppData"},
|
{IPC::MakeHeader(0x0015, 1, 0), &NFC_U::ReadApplicationArea, "ReadApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0016, 9, 2), &NFC_U::WriteAppData, "WriteAppData"},
|
{IPC::MakeHeader(0x0016, 9, 2), &NFC_U::WriteApplicationArea, "WriteApplicationArea"},
|
||||||
{IPC::MakeHeader(0x0017, 0, 0), &NFC_U::GetRegisterInfo, "GetRegisterInfo"},
|
{IPC::MakeHeader(0x0017, 0, 0), &NFC_U::GetNfpRegisterInfo, "GetNfpRegisterInfo"},
|
||||||
{IPC::MakeHeader(0x0018, 0, 0), &NFC_U::GetCommonInfo, "GetCommonInfo"},
|
{IPC::MakeHeader(0x0018, 0, 0), &NFC_U::GetNfpCommonInfo, "GetNfpCommonInfo"},
|
||||||
{IPC::MakeHeader(0x0019, 0, 0), &NFC_U::GetAppDataInitStruct, "GetAppDataInitStruct"},
|
{IPC::MakeHeader(0x0019, 0, 0), &NFC_U::InitializeCreateInfo, "InitializeCreateInfo"},
|
||||||
{IPC::MakeHeader(0x001A, 0, 0), &NFC_U::LoadAmiiboPartially, "LoadAmiiboPartially"},
|
{IPC::MakeHeader(0x001A, 0, 0), &NFC_U::MountRom, "MountRom"},
|
||||||
{IPC::MakeHeader(0x001B, 0, 0), &NFC_U::GetIdentificationBlock, "GetIdentificationBlock"},
|
{IPC::MakeHeader(0x001B, 0, 0), &NFC_U::GetIdentificationBlock, "GetIdentificationBlock"},
|
||||||
{IPC::MakeHeader(0x001C, 0, 0), nullptr, "Unknown0x1C"},
|
{IPC::MakeHeader(0x001C, 0, 0), nullptr, "Unknown0x1C"},
|
||||||
{IPC::MakeHeader(0x001D, 0, 0), nullptr, "Unknown0x1D"},
|
{IPC::MakeHeader(0x001D, 0, 0), nullptr, "Unknown0x1D"},
|
||||||
|
|
Reference in New Issue