summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nfc/common
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2023-05-09 06:03:32 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2023-05-10 01:51:59 +0200
commit1968cc7b106159e2bd2166459c3cb04d5f79601f (patch)
tree733a35691c7db1bdded2cc521b6cc31d0b4ef43e /src/core/hle/service/nfc/common
parentMerge pull request #10183 from liamwhite/mods (diff)
downloadyuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.gz
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.bz2
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.lz
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.xz
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.zst
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.zip
Diffstat (limited to 'src/core/hle/service/nfc/common')
-rw-r--r--src/core/hle/service/nfc/common/device.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp
index e5de65ce0..9b0685bdb 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -227,11 +227,20 @@ Result NfcDevice::GetTagInfo(NFP::TagInfo& tag_info, bool is_mifare) const {
return ResultWrongDeviceState;
}
+ UniqueSerialNumber uuid = encrypted_tag_data.uuid.uid;
+
+ // Generate random UUID to bypass amiibo load limits
+ if (Settings::values.random_amiibo_id) {
+ Common::TinyMT rng{};
+ rng.GenerateRandomBytes(uuid.data(), sizeof(UniqueSerialNumber));
+ uuid[3] = 0x88 ^ uuid[0] ^ uuid[1] ^ uuid[2];
+ }
+
if (is_mifare) {
tag_info = {
- .uuid = encrypted_tag_data.uuid.uid,
+ .uuid = uuid,
.uuid_extension = {},
- .uuid_length = static_cast<u8>(encrypted_tag_data.uuid.uid.size()),
+ .uuid_length = static_cast<u8>(uuid.size()),
.protocol = NfcProtocol::TypeA,
.tag_type = TagType::Type4,
};
@@ -240,9 +249,9 @@ Result NfcDevice::GetTagInfo(NFP::TagInfo& tag_info, bool is_mifare) const {
// Protocol and tag type may change here
tag_info = {
- .uuid = encrypted_tag_data.uuid.uid,
+ .uuid = uuid,
.uuid_extension = {},
- .uuid_length = static_cast<u8>(encrypted_tag_data.uuid.uid.size()),
+ .uuid_length = static_cast<u8>(uuid.size()),
.protocol = NfcProtocol::TypeA,
.tag_type = TagType::Type2,
};