mirror of
https://github.com/PabloMK7/citra.git
synced 2025-10-11 20:10:03 +00:00
kernel: Update to use atmosphere macros and correct Result (#7242)
* kernel: Switch to atmosphere style macros * code: Rename ResultCode to Result * code: Result constants are lower case * Address review comments * core: Remove CASCADE_CODE * R_TRY replaces completely * core: Run clang format
This commit is contained in:
parent
811303ea54
commit
5a7f615da1
132 changed files with 2807 additions and 2995 deletions
|
@ -34,7 +34,7 @@ void Module::Interface::Initialize(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (communication_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
case CommunicationMode::Amiibo:
|
||||
|
@ -68,7 +68,7 @@ void Module::Interface::Finalize(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (communication_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
case CommunicationMode::Amiibo:
|
||||
|
@ -97,7 +97,7 @@ void Module::Interface::Connect(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void Module::Interface::Disconnect(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ void Module::Interface::StartDetection(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_INFO(Service_NFC, "called, in_val={:04x}", in_val);
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (nfc->nfc_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
case CommunicationMode::Amiibo:
|
||||
|
@ -150,7 +150,7 @@ void Module::Interface::StopDetection(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_INFO(Service_NFC, "called");
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (nfc->nfc_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
case CommunicationMode::Amiibo:
|
||||
|
@ -175,7 +175,7 @@ void Module::Interface::Mount(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
nfc->device->RescheduleTagRemoveEvent();
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (nfc->nfc_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
result = nfc->device->Mount();
|
||||
|
@ -197,7 +197,7 @@ void Module::Interface::Unmount(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_INFO(Service_NFC, "called");
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (nfc->nfc_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
case CommunicationMode::Amiibo:
|
||||
|
@ -217,7 +217,7 @@ void Module::Interface::Flush(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_INFO(Service_NFC, "called");
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (nfc->nfc_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||
|
@ -247,7 +247,7 @@ void Module::Interface::GetActivateEvent(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(nfc->device->GetActivateEvent());
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ void Module::Interface::GetDeactivateEvent(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(nfc->device->GetDeactivateEvent());
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ void Module::Interface::GetStatus(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(state);
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ void Module::Interface::GetTargetConnectionStatus(Kernel::HLERequestContext& ctx
|
|||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(CommunicationState::Idle);
|
||||
return;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ void Module::Interface::GetTagInfo2(Kernel::HLERequestContext& ctx) {
|
|||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(25, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<TagInfo2>({});
|
||||
return;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ void Module::Interface::GetTagInfo(Kernel::HLERequestContext& ctx) {
|
|||
if (nfc->nfc_mode == CommunicationMode::TrainTag) {
|
||||
LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode);
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(12, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<TagInfo>({});
|
||||
return;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(0);
|
||||
LOG_WARNING(Service_NFC, "(STUBBED) called");
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ void Module::Interface::InitializeCreateInfo(Kernel::HLERequestContext& ctx) {
|
|||
InitialStruct empty{};
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(16, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<InitialStruct>(empty);
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ void Module::Interface::MountRom(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_INFO(Service_NFC, "called");
|
||||
|
||||
ResultCode result = RESULT_SUCCESS;
|
||||
Result result = ResultSuccess;
|
||||
switch (nfc->nfc_mode) {
|
||||
case CommunicationMode::Ntag:
|
||||
result = nfc->device->PartiallyMount();
|
||||
|
@ -599,7 +599,7 @@ void Module::Interface::GetEmptyRegisterInfo(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(43, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<RegisterInfo>({});
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ void NfcDevice::Finalize() {
|
|||
is_initalized = false;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::StartCommunication() {
|
||||
Result NfcDevice::StartCommunication() {
|
||||
const auto connection_result = CheckConnectionState();
|
||||
if (connection_result.IsError()) {
|
||||
return connection_result;
|
||||
|
@ -181,10 +181,10 @@ ResultCode NfcDevice::StartCommunication() {
|
|||
|
||||
// This is a hack. This mode needs to change when the tag reader has completed the initalization
|
||||
communication_state = CommunicationState::Initialized;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::StopCommunication() {
|
||||
Result NfcDevice::StopCommunication() {
|
||||
const auto connection_result = CheckConnectionState();
|
||||
if (connection_result.IsError()) {
|
||||
return connection_result;
|
||||
|
@ -201,10 +201,10 @@ ResultCode NfcDevice::StopCommunication() {
|
|||
|
||||
device_state = DeviceState::Initialized;
|
||||
communication_state = CommunicationState::Idle;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::StartDetection(TagProtocol allowed_protocol) {
|
||||
Result NfcDevice::StartDetection(TagProtocol allowed_protocol) {
|
||||
const auto connection_result = CheckConnectionState();
|
||||
if (connection_result.IsError()) {
|
||||
return connection_result;
|
||||
|
@ -227,10 +227,10 @@ ResultCode NfcDevice::StartDetection(TagProtocol allowed_protocol) {
|
|||
LoadAmiibo(amiibo_filename);
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::StopDetection() {
|
||||
Result NfcDevice::StopDetection() {
|
||||
const auto connection_result = CheckConnectionState();
|
||||
if (connection_result.IsError()) {
|
||||
return connection_result;
|
||||
|
@ -250,14 +250,14 @@ ResultCode NfcDevice::StopDetection() {
|
|||
// TODO: Stop console search mode here
|
||||
device_state = DeviceState::Initialized;
|
||||
connection_state = ConnectionState::Success;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
return ResultInvalidOperation;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::Flush() {
|
||||
Result NfcDevice::Flush() {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -282,7 +282,7 @@ ResultCode NfcDevice::Flush() {
|
|||
|
||||
if (is_write_protected) {
|
||||
LOG_ERROR(Service_NFC, "No keys available skipping write request");
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
if (!is_plain_amiibo) {
|
||||
|
@ -324,10 +324,10 @@ ResultCode NfcDevice::Flush() {
|
|||
|
||||
is_data_moddified = false;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::Mount() {
|
||||
Result NfcDevice::Mount() {
|
||||
if (device_state != DeviceState::TagFound) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -345,7 +345,7 @@ ResultCode NfcDevice::Mount() {
|
|||
// The loaded amiibo is not encrypted
|
||||
if (is_plain_amiibo) {
|
||||
device_state = DeviceState::TagMounted;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
|
||||
|
@ -354,10 +354,10 @@ ResultCode NfcDevice::Mount() {
|
|||
}
|
||||
|
||||
device_state = DeviceState::TagMounted;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::MountAmiibo() {
|
||||
Result NfcDevice::MountAmiibo() {
|
||||
TagInfo tag_info{};
|
||||
const auto result = GetTagInfo(tag_info);
|
||||
|
||||
|
@ -372,7 +372,7 @@ ResultCode NfcDevice::MountAmiibo() {
|
|||
return Mount();
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::PartiallyMount() {
|
||||
Result NfcDevice::PartiallyMount() {
|
||||
if (device_state != DeviceState::TagFound) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -390,7 +390,7 @@ ResultCode NfcDevice::PartiallyMount() {
|
|||
// The loaded amiibo is not encrypted
|
||||
if (is_plain_amiibo) {
|
||||
device_state = DeviceState::TagPartiallyMounted;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
if (!AmiiboCrypto::DecodeAmiibo(encrypted_tag.file, tag.file)) {
|
||||
|
@ -399,10 +399,10 @@ ResultCode NfcDevice::PartiallyMount() {
|
|||
}
|
||||
|
||||
device_state = DeviceState::TagPartiallyMounted;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::PartiallyMountAmiibo() {
|
||||
Result NfcDevice::PartiallyMountAmiibo() {
|
||||
TagInfo tag_info{};
|
||||
const auto result = GetTagInfo(tag_info);
|
||||
|
||||
|
@ -416,7 +416,7 @@ ResultCode NfcDevice::PartiallyMountAmiibo() {
|
|||
|
||||
return PartiallyMount();
|
||||
}
|
||||
ResultCode NfcDevice::ResetTagScanState() {
|
||||
Result NfcDevice::ResetTagScanState() {
|
||||
if (device_state != DeviceState::TagMounted &&
|
||||
device_state != DeviceState::TagPartiallyMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
|
@ -430,10 +430,10 @@ ResultCode NfcDevice::ResetTagScanState() {
|
|||
device_state = DeviceState::TagFound;
|
||||
is_app_area_open = false;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
|
||||
Result NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
|
||||
tag_info = {
|
||||
.uuid_length = static_cast<u16>(encrypted_tag.file.uuid.uid.size()),
|
||||
.tag_type = PackedTagType::Type2,
|
||||
|
@ -443,10 +443,10 @@ ResultCode NfcDevice::GetTagInfo2(TagInfo2& tag_info) const {
|
|||
.extra_data2 = {}, // Used on non amiibo tags
|
||||
};
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetTagInfo(TagInfo& tag_info) const {
|
||||
Result NfcDevice::GetTagInfo(TagInfo& tag_info) const {
|
||||
if (device_state != DeviceState::TagFound && device_state != DeviceState::TagMounted &&
|
||||
device_state != DeviceState::TagPartiallyMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
|
@ -465,10 +465,10 @@ ResultCode NfcDevice::GetTagInfo(TagInfo& tag_info) const {
|
|||
.extra_data = {}, // Used on non amiibo tags
|
||||
};
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
|
||||
Result NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -494,10 +494,10 @@ ResultCode NfcDevice::GetCommonInfo(CommonInfo& common_info) const {
|
|||
.application_area_size = sizeof(ApplicationArea),
|
||||
};
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetModelInfo(ModelInfo& model_info) const {
|
||||
Result NfcDevice::GetModelInfo(ModelInfo& model_info) const {
|
||||
if (device_state != DeviceState::TagMounted &&
|
||||
device_state != DeviceState::TagPartiallyMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
|
@ -517,10 +517,10 @@ ResultCode NfcDevice::GetModelInfo(ModelInfo& model_info) const {
|
|||
.amiibo_type = model_info_data.amiibo_type,
|
||||
};
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
|
||||
Result NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -545,10 +545,10 @@ ResultCode NfcDevice::GetRegisterInfo(RegisterInfo& register_info) const {
|
|||
.creation_date = settings.init_date.GetWriteDate(),
|
||||
};
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
|
||||
Result NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -604,10 +604,10 @@ ResultCode NfcDevice::GetAdminInfo(AdminInfo& admin_info) const {
|
|||
.app_area_version = app_area_version,
|
||||
};
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::DeleteRegisterInfo() {
|
||||
Result NfcDevice::DeleteRegisterInfo() {
|
||||
// This is a hack to get around a HW issue
|
||||
if (device_state == DeviceState::TagFound) {
|
||||
Mount();
|
||||
|
@ -645,7 +645,7 @@ ResultCode NfcDevice::DeleteRegisterInfo() {
|
|||
return Flush();
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info) {
|
||||
Result NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -677,7 +677,7 @@ ResultCode NfcDevice::SetRegisterInfoPrivate(const RegisterInfoPrivate& register
|
|||
return Flush();
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::RestoreAmiibo() {
|
||||
Result NfcDevice::RestoreAmiibo() {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -689,25 +689,25 @@ ResultCode NfcDevice::RestoreAmiibo() {
|
|||
|
||||
// TODO: Load amiibo from backup on system
|
||||
LOG_ERROR(Service_NFC, "Not Implemented");
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::Format() {
|
||||
auto ResultCode = DeleteApplicationArea();
|
||||
auto ResultCode2 = DeleteRegisterInfo();
|
||||
Result NfcDevice::Format() {
|
||||
auto Result = DeleteApplicationArea();
|
||||
auto Result2 = DeleteRegisterInfo();
|
||||
|
||||
if (ResultCode.IsError()) {
|
||||
return ResultCode;
|
||||
if (Result.IsError()) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
if (ResultCode2.IsError()) {
|
||||
return ResultCode2;
|
||||
if (Result2.IsError()) {
|
||||
return Result2;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::OpenApplicationArea(u32 access_id) {
|
||||
Result NfcDevice::OpenApplicationArea(u32 access_id) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -729,10 +729,10 @@ ResultCode NfcDevice::OpenApplicationArea(u32 access_id) {
|
|||
|
||||
is_app_area_open = true;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
|
||||
Result NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
|
||||
application_area_id = {};
|
||||
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
|
@ -751,10 +751,10 @@ ResultCode NfcDevice::GetApplicationAreaId(u32& application_area_id) const {
|
|||
|
||||
application_area_id = tag.file.application_area_id;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
|
||||
Result NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -780,10 +780,10 @@ ResultCode NfcDevice::GetApplicationArea(std::vector<u8>& data) const {
|
|||
|
||||
memcpy(data.data(), tag.file.application_area.data(), data.size());
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::SetApplicationArea(std::span<const u8> data) {
|
||||
Result NfcDevice::SetApplicationArea(std::span<const u8> data) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -828,10 +828,10 @@ ResultCode NfcDevice::SetApplicationArea(std::span<const u8> data) {
|
|||
|
||||
is_data_moddified = true;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> data) {
|
||||
Result NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> data) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -849,7 +849,7 @@ ResultCode NfcDevice::CreateApplicationArea(u32 access_id, std::span<const u8> d
|
|||
return RecreateApplicationArea(access_id, data);
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> data) {
|
||||
Result NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> data) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -900,7 +900,7 @@ ResultCode NfcDevice::RecreateApplicationArea(u32 access_id, std::span<const u8>
|
|||
return Flush();
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::DeleteApplicationArea() {
|
||||
Result NfcDevice::DeleteApplicationArea() {
|
||||
// This is a hack to get around a HW issue
|
||||
if (device_state == DeviceState::TagFound) {
|
||||
Mount();
|
||||
|
@ -943,7 +943,7 @@ ResultCode NfcDevice::DeleteApplicationArea() {
|
|||
return Flush();
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::ApplicationAreaExist(bool& has_application_area) {
|
||||
Result NfcDevice::ApplicationAreaExist(bool& has_application_area) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
const auto connection_result = CheckConnectionState();
|
||||
|
@ -955,7 +955,7 @@ ResultCode NfcDevice::ApplicationAreaExist(bool& has_application_area) {
|
|||
|
||||
has_application_area = tag.file.settings.settings.appdata_initialized.Value() != 0;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
constexpr u32 NfcDevice::GetApplicationAreaSize() const {
|
||||
|
@ -966,23 +966,23 @@ DeviceState NfcDevice::GetCurrentState() const {
|
|||
return device_state;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
|
||||
Result NfcDevice::GetCommunicationStatus(CommunicationState& status) const {
|
||||
if (communication_state == CommunicationState::Idle ||
|
||||
communication_state == CommunicationState::SearchingForAdapter) {
|
||||
status = communication_state;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
if (communication_state == CommunicationState::Initialized ||
|
||||
communication_state == CommunicationState::Active) {
|
||||
status = CommunicationState::Initialized;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
return ResultInvalidOperation;
|
||||
}
|
||||
|
||||
ResultCode NfcDevice::CheckConnectionState() const {
|
||||
Result NfcDevice::CheckConnectionState() const {
|
||||
if (connection_state == ConnectionState::Lost) {
|
||||
return ResultSleep;
|
||||
}
|
||||
|
@ -991,7 +991,7 @@ ResultCode NfcDevice::CheckConnectionState() const {
|
|||
return ResultWifiOff;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void NfcDevice::SetAmiiboName(AmiiboSettings& settings, const AmiiboName& amiibo_name) {
|
||||
|
|
|
@ -31,42 +31,42 @@ public:
|
|||
void Initialize();
|
||||
void Finalize();
|
||||
|
||||
ResultCode StartCommunication();
|
||||
ResultCode StopCommunication();
|
||||
ResultCode StartDetection(TagProtocol allowed_protocol);
|
||||
ResultCode StopDetection();
|
||||
ResultCode Mount();
|
||||
ResultCode MountAmiibo();
|
||||
ResultCode PartiallyMount();
|
||||
ResultCode PartiallyMountAmiibo();
|
||||
ResultCode ResetTagScanState();
|
||||
ResultCode Flush();
|
||||
Result StartCommunication();
|
||||
Result StopCommunication();
|
||||
Result StartDetection(TagProtocol allowed_protocol);
|
||||
Result StopDetection();
|
||||
Result Mount();
|
||||
Result MountAmiibo();
|
||||
Result PartiallyMount();
|
||||
Result PartiallyMountAmiibo();
|
||||
Result ResetTagScanState();
|
||||
Result Flush();
|
||||
|
||||
ResultCode GetTagInfo2(TagInfo2& tag_info) const;
|
||||
ResultCode GetTagInfo(TagInfo& tag_info) const;
|
||||
ResultCode GetCommonInfo(CommonInfo& common_info) const;
|
||||
ResultCode GetModelInfo(ModelInfo& model_info) const;
|
||||
ResultCode GetRegisterInfo(RegisterInfo& register_info) const;
|
||||
ResultCode GetAdminInfo(AdminInfo& admin_info) const;
|
||||
Result GetTagInfo2(TagInfo2& tag_info) const;
|
||||
Result GetTagInfo(TagInfo& tag_info) const;
|
||||
Result GetCommonInfo(CommonInfo& common_info) const;
|
||||
Result GetModelInfo(ModelInfo& model_info) const;
|
||||
Result GetRegisterInfo(RegisterInfo& register_info) const;
|
||||
Result GetAdminInfo(AdminInfo& admin_info) const;
|
||||
|
||||
ResultCode DeleteRegisterInfo();
|
||||
ResultCode SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info);
|
||||
ResultCode RestoreAmiibo();
|
||||
ResultCode Format();
|
||||
Result DeleteRegisterInfo();
|
||||
Result SetRegisterInfoPrivate(const RegisterInfoPrivate& register_info);
|
||||
Result RestoreAmiibo();
|
||||
Result Format();
|
||||
|
||||
ResultCode OpenApplicationArea(u32 access_id);
|
||||
ResultCode GetApplicationAreaId(u32& application_area_id) const;
|
||||
ResultCode GetApplicationArea(std::vector<u8>& data) const;
|
||||
ResultCode SetApplicationArea(std::span<const u8> data);
|
||||
ResultCode CreateApplicationArea(u32 access_id, std::span<const u8> data);
|
||||
ResultCode RecreateApplicationArea(u32 access_id, std::span<const u8> data);
|
||||
ResultCode DeleteApplicationArea();
|
||||
ResultCode ApplicationAreaExist(bool& has_application_area);
|
||||
Result OpenApplicationArea(u32 access_id);
|
||||
Result GetApplicationAreaId(u32& application_area_id) const;
|
||||
Result GetApplicationArea(std::vector<u8>& data) const;
|
||||
Result SetApplicationArea(std::span<const u8> data);
|
||||
Result CreateApplicationArea(u32 access_id, std::span<const u8> data);
|
||||
Result RecreateApplicationArea(u32 access_id, std::span<const u8> data);
|
||||
Result DeleteApplicationArea();
|
||||
Result ApplicationAreaExist(bool& has_application_area);
|
||||
|
||||
constexpr u32 GetApplicationAreaSize() const;
|
||||
DeviceState GetCurrentState() const;
|
||||
ResultCode GetCommunicationStatus(CommunicationState& status) const;
|
||||
ResultCode CheckConnectionState() const;
|
||||
Result GetCommunicationStatus(CommunicationState& status) const;
|
||||
Result CheckConnectionState() const;
|
||||
|
||||
std::shared_ptr<Kernel::Event> GetActivateEvent() const;
|
||||
std::shared_ptr<Kernel::Event> GetDeactivateEvent() const;
|
||||
|
|
|
@ -43,29 +43,29 @@ enum {
|
|||
};
|
||||
} // namespace ErrCodes
|
||||
|
||||
constexpr ResultCode ResultInvalidArgumentValue(ErrCodes::InvalidArgumentValue, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
||||
constexpr ResultCode ResultInvalidArgument(ErrCodes::InvalidArgument, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
||||
constexpr ResultCode ResultInvalidOperation(ErrCodes::InvalidOperation, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr ResultCode ResultNotSupported(ErrCodes::NotSupported, ErrorModule::NFC,
|
||||
constexpr Result ResultInvalidArgumentValue(ErrCodes::InvalidArgumentValue, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
||||
constexpr Result ResultInvalidArgument(ErrCodes::InvalidArgument, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Status);
|
||||
constexpr Result ResultInvalidOperation(ErrCodes::InvalidOperation, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr ResultCode ResultNeedFormat(ErrCodes::NeedFormat, ErrorModule::NFC,
|
||||
constexpr Result ResultNotSupported(ErrCodes::NotSupported, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr Result ResultNeedFormat(ErrCodes::NeedFormat, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr Result ResultOperationFailed(ErrCodes::OperationFailed, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr Result ResultNeedCreate(ErrCodes::NeedCreate, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr Result ResultNeedRegister(ErrCodes::NeedRegister, ErrorModule::NFC,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
constexpr Result ResultAlreadyCreated(ErrCodes::AlreadyCreated, 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,
|
||||
constexpr Result ResultAccessIdMisMatch(ErrCodes::AccessIdMisMatch, 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 ResultWifiOff(ErrCodes::WifiOff, ErrorModule::NFC, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status);
|
||||
constexpr Result ResultSleep(ErrCodes::Sleep, ErrorModule::NFC, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status);
|
||||
constexpr Result ResultWifiOff(ErrCodes::WifiOff, ErrorModule::NFC, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status);
|
||||
|
||||
} // namespace Service::NFC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue