summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2023-05-25 14:07:16 -0700
committerGravatar GitHub2023-05-25 14:07:16 -0700
commitffa1fba7d632d69e564cce302b5e5cf4bf131071 (patch)
treea601ac622b62f4931202e13a7cf733b6f580390a /src/core
parentMerge pull request #10454 from 521337/fix-u-option (diff)
parentinput_common: Implement amiibo writting (diff)
downloadyuzu-ffa1fba7d632d69e564cce302b5e5cf4bf131071.tar.gz
yuzu-ffa1fba7d632d69e564cce302b5e5cf4bf131071.tar.xz
yuzu-ffa1fba7d632d69e564cce302b5e5cf4bf131071.zip
Merge pull request #10396 from german77/amiibo_write
input_common: Implement amiibo writing
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 e5d4545a8..0bd7900e1 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -426,11 +426,11 @@ Result NfcDevice::Flush() {
426 426
427 tag_data.write_counter++; 427 tag_data.write_counter++;
428 428
429 FlushWithBreak(NFP::BreakType::Normal); 429 const auto result = FlushWithBreak(NFP::BreakType::Normal);
430 430
431 is_data_moddified = false; 431 is_data_moddified = false;
432 432
433 return ResultSuccess; 433 return result;
434} 434}
435 435
436Result NfcDevice::FlushDebug() { 436Result NfcDevice::FlushDebug() {
@@ -449,11 +449,11 @@ Result NfcDevice::FlushDebug() {
449 449
450 tag_data.write_counter++; 450 tag_data.write_counter++;
451 451
452 FlushWithBreak(NFP::BreakType::Normal); 452 const auto result = FlushWithBreak(NFP::BreakType::Normal);
453 453
454 is_data_moddified = false; 454 is_data_moddified = false;
455 455
456 return ResultSuccess; 456 return result;
457} 457}
458 458
459Result NfcDevice::FlushWithBreak(NFP::BreakType break_type) { 459Result NfcDevice::FlushWithBreak(NFP::BreakType break_type) {