mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
service: nfp: Close app area and recreate crc
This commit is contained in:
parent
5031f5b8b0
commit
7187732454
1 changed files with 10 additions and 0 deletions
|
@ -685,6 +685,11 @@ Result NfpDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> dat
|
||||||
return WrongDeviceState;
|
return WrongDeviceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_app_area_open) {
|
||||||
|
LOG_ERROR(Service_NFP, "Application area is open");
|
||||||
|
return WrongDeviceState;
|
||||||
|
}
|
||||||
|
|
||||||
if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) {
|
if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) {
|
||||||
LOG_ERROR(Service_NFP, "Amiibo is read only", device_state);
|
LOG_ERROR(Service_NFP, "Amiibo is read only", device_state);
|
||||||
return WrongDeviceState;
|
return WrongDeviceState;
|
||||||
|
@ -715,6 +720,7 @@ Result NfpDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> dat
|
||||||
tag_data.settings.settings.appdata_initialized.Assign(1);
|
tag_data.settings.settings.appdata_initialized.Assign(1);
|
||||||
tag_data.application_area_id = access_id;
|
tag_data.application_area_id = access_id;
|
||||||
tag_data.unknown = {};
|
tag_data.unknown = {};
|
||||||
|
tag_data.unknown2 = {};
|
||||||
|
|
||||||
UpdateRegisterInfoCrc();
|
UpdateRegisterInfoCrc();
|
||||||
|
|
||||||
|
@ -750,6 +756,10 @@ Result NfpDevice::DeleteApplicationArea() {
|
||||||
rng.GenerateRandomBytes(&tag_data.application_id_byte, sizeof(u8));
|
rng.GenerateRandomBytes(&tag_data.application_id_byte, sizeof(u8));
|
||||||
tag_data.settings.settings.appdata_initialized.Assign(0);
|
tag_data.settings.settings.appdata_initialized.Assign(0);
|
||||||
tag_data.unknown = {};
|
tag_data.unknown = {};
|
||||||
|
tag_data.unknown2 = {};
|
||||||
|
is_app_area_open = false;
|
||||||
|
|
||||||
|
UpdateRegisterInfoCrc();
|
||||||
|
|
||||||
return Flush();
|
return Flush();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue