mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 00:40:58 +01:00
service: nfc: Create backup when none exist
This commit is contained in:
parent
c683ec2bcb
commit
c661b95864
1 changed files with 4 additions and 1 deletions
|
@ -441,7 +441,10 @@ Result NfcDevice::Mount(NFP::ModelType model_type, NFP::MountTarget mount_target
|
||||||
device_state = DeviceState::TagMounted;
|
device_state = DeviceState::TagMounted;
|
||||||
mount_target = mount_target_;
|
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<u8> data(sizeof(NFP::EncryptedNTAG215File));
|
std::vector<u8> data(sizeof(NFP::EncryptedNTAG215File));
|
||||||
memcpy(data.data(), &encrypted_tag_data, sizeof(encrypted_tag_data));
|
memcpy(data.data(), &encrypted_tag_data, sizeof(encrypted_tag_data));
|
||||||
WriteBackupData(encrypted_tag_data.uuid, data);
|
WriteBackupData(encrypted_tag_data.uuid, data);
|
||||||
|
|
Loading…
Reference in a new issue