summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Narr the Reg2023-05-17 22:17:16 -0600
committerGravatar german772023-05-21 21:09:20 -0600
commitfdb2002f77de6af19cc7f526b2e7540c329161c3 (patch)
tree6bcb2ca55810c05d15a561e2fa0bc0a6c1a9175a /src/core
parentMerge pull request #10344 from german77/pro-amiibo (diff)
downloadyuzu-fdb2002f77de6af19cc7f526b2e7540c329161c3.tar.gz
yuzu-fdb2002f77de6af19cc7f526b2e7540c329161c3.tar.xz
yuzu-fdb2002f77de6af19cc7f526b2e7540c329161c3.zip
input_common: Implement amiibo writting
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hid/emulated_controller.cpp9
-rw-r--r--src/core/hle/service/nfc/common/device.cpp8
2 files changed, 11 insertions, 6 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 366880711..bbfea7117 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -1283,9 +1283,14 @@ bool EmulatedController::HasNfc() const {
1283} 1283}
1284 1284
1285bool EmulatedController::WriteNfc(const std::vector<u8>& data) { 1285bool EmulatedController::WriteNfc(const std::vector<u8>& data) {
1286 auto& nfc_output_device = output_devices[3]; 1286 auto& nfc_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
1287 auto& nfc_virtual_output_device = output_devices[3];
1288
1289 if (nfc_output_device->SupportsNfc() != Common::Input::NfcState::NotSupported) {
1290 return nfc_output_device->WriteNfcData(data) == Common::Input::NfcState::Success;
1291 }
1287 1292
1288 return nfc_output_device->WriteNfcData(data) == Common::Input::NfcState::Success; 1293 return nfc_virtual_output_device->WriteNfcData(data) == Common::Input::NfcState::Success;
1289} 1294}
1290 1295
1291void EmulatedController::SetLedPattern() { 1296void EmulatedController::SetLedPattern() {
diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp
index 322bde2ed..8a7e9edac 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -421,11 +421,11 @@ Result NfcDevice::Flush() {
421 421
422 tag_data.write_counter++; 422 tag_data.write_counter++;
423 423
424 FlushWithBreak(NFP::BreakType::Normal); 424 const auto result = FlushWithBreak(NFP::BreakType::Normal);
425 425
426 is_data_moddified = false; 426 is_data_moddified = false;
427 427
428 return ResultSuccess; 428 return result;
429} 429}
430 430
431Result NfcDevice::FlushDebug() { 431Result NfcDevice::FlushDebug() {
@@ -444,11 +444,11 @@ Result NfcDevice::FlushDebug() {
444 444
445 tag_data.write_counter++; 445 tag_data.write_counter++;
446 446
447 FlushWithBreak(NFP::BreakType::Normal); 447 const auto result = FlushWithBreak(NFP::BreakType::Normal);
448 448
449 is_data_moddified = false; 449 is_data_moddified = false;
450 450
451 return ResultSuccess; 451 return result;
452} 452}
453 453
454Result NfcDevice::FlushWithBreak(NFP::BreakType break_type) { 454Result NfcDevice::FlushWithBreak(NFP::BreakType break_type) {