diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-04-14 04:55:47 +0200 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2023-04-15 01:03:57 +0200 |
commit | 00800d5289f580ffebd38f18d1c3d7e024fc3b16 (patch) | |
tree | d0e0741f6d4db96784fa36f2b3c222c72ae15574 /src/core/hle/service/nfp/nfp_device.cpp | |
parent | service: nfp: Use an unique interface (diff) | |
download | yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.tar yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.tar.gz yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.tar.bz2 yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.tar.lz yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.tar.xz yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.tar.zst yuzu-00800d5289f580ffebd38f18d1c3d7e024fc3b16.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/nfp/nfp_device.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp index 607e70968..5ed6d4181 100644 --- a/src/core/hle/service/nfp/nfp_device.cpp +++ b/src/core/hle/service/nfp/nfp_device.cpp @@ -29,7 +29,6 @@ #include "core/hle/service/nfp/amiibo_crypto.h" #include "core/hle/service/nfp/nfp_device.h" #include "core/hle/service/nfp/nfp_result.h" -#include "core/hle/service/nfp/nfp_user.h" #include "core/hle/service/time/time_manager.h" #include "core/hle/service/time/time_zone_content_manager.h" #include "core/hle/service/time/time_zone_types.h" @@ -417,6 +416,38 @@ Result NfpDevice::GetRegisterInfo(RegisterInfo& register_info) const { return ResultSuccess; } +Result NfpDevice::GetRegisterInfoPrivate(RegisterInfoPrivate& register_info) const { + if (device_state != DeviceState::TagMounted) { + LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); + if (device_state == DeviceState::TagRemoved) { + return TagRemoved; + } + return WrongDeviceState; + } + + if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) { + LOG_ERROR(Service_NFP, "Amiibo is read only", device_state); + return WrongDeviceState; + } + + if (tag_data.settings.settings.amiibo_initialized == 0) { + return RegistrationIsNotInitialized; + } + + Service::Mii::MiiManager manager; + const auto& settings = tag_data.settings; + + // TODO: Validate and complete this data + register_info = { + .mii_store_data = {}, + .creation_date = settings.init_date.GetWriteDate(), + .amiibo_name = GetAmiiboName(settings), + .font_region = settings.settings.font_region, + }; + + return ResultSuccess; +} + Result NfpDevice::GetAdminInfo(AdminInfo& admin_info) const { if (device_state != DeviceState::TagMounted) { LOG_ERROR(Service_NFC, "Wrong device state {}", device_state); @@ -807,6 +838,25 @@ Result NfpDevice::DeleteApplicationArea() { return Flush(); } +Result NfpDevice::ExistApplicationArea(bool& has_application_area) { + if (device_state != DeviceState::TagMounted) { + LOG_ERROR(Service_NFC, "Wrong device state {}", device_state); + if (device_state == DeviceState::TagRemoved) { + return TagRemoved; + } + return WrongDeviceState; + } + + if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) { + LOG_ERROR(Service_NFC, "Amiibo is read only", device_state); + return WrongDeviceState; + } + + has_application_area = tag_data.settings.settings.appdata_initialized.Value() != 0; + + return ResultSuccess; +} + u64 NfpDevice::GetHandle() const { // Generate a handle based of the npad id return static_cast<u64>(npad_id); |