summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar german772023-05-08 22:03:32 -0600
committerGravatar Narr the Reg2023-05-09 17:51:59 -0600
commit1968cc7b106159e2bd2166459c3cb04d5f79601f (patch)
tree733a35691c7db1bdded2cc521b6cc31d0b4ef43e /src/core
parentMerge pull request #10183 from liamwhite/mods (diff)
downloadyuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.gz
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.tar.xz
yuzu-1968cc7b106159e2bd2166459c3cb04d5f79601f.zip
service: nfp: Allow to load with a different amiibo id
Diffstat (limited to 'src/core')
-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 {
227 return ResultWrongDeviceState; 227 return ResultWrongDeviceState;
228 } 228 }
229 229
230 UniqueSerialNumber uuid = encrypted_tag_data.uuid.uid;
231
232 // Generate random UUID to bypass amiibo load limits
233 if (Settings::values.random_amiibo_id) {
234 Common::TinyMT rng{};
235 rng.GenerateRandomBytes(uuid.data(), sizeof(UniqueSerialNumber));
236 uuid[3] = 0x88 ^ uuid[0] ^ uuid[1] ^ uuid[2];
237 }
238
230 if (is_mifare) { 239 if (is_mifare) {
231 tag_info = { 240 tag_info = {
232 .uuid = encrypted_tag_data.uuid.uid, 241 .uuid = uuid,
233 .uuid_extension = {}, 242 .uuid_extension = {},
234 .uuid_length = static_cast<u8>(encrypted_tag_data.uuid.uid.size()), 243 .uuid_length = static_cast<u8>(uuid.size()),
235 .protocol = NfcProtocol::TypeA, 244 .protocol = NfcProtocol::TypeA,
236 .tag_type = TagType::Type4, 245 .tag_type = TagType::Type4,
237 }; 246 };
@@ -240,9 +249,9 @@ Result NfcDevice::GetTagInfo(NFP::TagInfo& tag_info, bool is_mifare) const {
240 249
241 // Protocol and tag type may change here 250 // Protocol and tag type may change here
242 tag_info = { 251 tag_info = {
243 .uuid = encrypted_tag_data.uuid.uid, 252 .uuid = uuid,
244 .uuid_extension = {}, 253 .uuid_extension = {},
245 .uuid_length = static_cast<u8>(encrypted_tag_data.uuid.uid.size()), 254 .uuid_length = static_cast<u8>(uuid.size()),
246 .protocol = NfcProtocol::TypeA, 255 .protocol = NfcProtocol::TypeA,
247 .tag_type = TagType::Type2, 256 .tag_type = TagType::Type2,
248 }; 257 };