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