From c661b95864690741f21f42976806ab1825af5e12 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Mon, 15 Jan 2024 13:59:56 -0600 Subject: service: nfc: Create backup when none exist --- src/core/hle/service/nfc/common/device.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp index 31cc87acc..cc7776efc 100644 --- a/src/core/hle/service/nfc/common/device.cpp +++ b/src/core/hle/service/nfc/common/device.cpp @@ -441,7 +441,10 @@ Result NfcDevice::Mount(NFP::ModelType model_type, NFP::MountTarget mount_target device_state = DeviceState::TagMounted; mount_target = mount_target_; - if (!is_corrupted && mount_target != NFP::MountTarget::Rom) { + const bool create_backup = + mount_target == NFP::MountTarget::All || mount_target == NFP::MountTarget::Ram || + (mount_target == NFP::MountTarget::Rom && HasBackup(encrypted_tag_data.uuid).IsError()); + if (!is_corrupted && create_backup) { std::vector data(sizeof(NFP::EncryptedNTAG215File)); memcpy(data.data(), &encrypted_tag_data, sizeof(encrypted_tag_data)); WriteBackupData(encrypted_tag_data.uuid, data); -- cgit v1.2.3