diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index 62f82d8ba3..f1e2801fb3 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -316,7 +316,7 @@ void Module::Interface::GetTagInfo2(Kernel::HLERequestContext& ctx) { if (nfc->nfc_mode == CommunicationMode::TrainTag) { LOG_ERROR(Service_NFC, "CommunicationMode {} not implemented", nfc->nfc_mode); - IPC::RequestBuilder rb = rp.MakeBuilder(26, 0); + IPC::RequestBuilder rb = rp.MakeBuilder(25, 0); rb.Push(RESULT_SUCCESS); rb.PushRaw({}); return; @@ -324,7 +324,7 @@ void Module::Interface::GetTagInfo2(Kernel::HLERequestContext& ctx) { TagInfo2 tag_info{}; const auto result = nfc->device->GetTagInfo2(tag_info); - IPC::RequestBuilder rb = rp.MakeBuilder(26, 0); + IPC::RequestBuilder rb = rp.MakeBuilder(25, 0); rb.Push(result); rb.PushRaw(tag_info); } @@ -383,10 +383,14 @@ void Module::Interface::OpenApplicationArea(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateApplicationArea(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); u32 access_id = rp.Pop(); - [[maybe_unused]] u32 size = rp.Pop(); + u32 size = rp.Pop(); std::vector buffer = rp.PopStaticBuffer(); - LOG_CRITICAL(Service_NFC, "called, size={}", size); + LOG_INFO(Service_NFC, "called, size={}", size); + + if (buffer.size() > size) { + buffer.resize(size); + } if (nfc->nfc_mode != CommunicationMode::Amiibo) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); @@ -402,8 +406,9 @@ void Module::Interface::CreateApplicationArea(Kernel::HLERequestContext& ctx) { void Module::Interface::ReadApplicationArea(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); + u32 size = rp.Pop(); - LOG_INFO(Service_NFC, "called"); + LOG_INFO(Service_NFC, "called, size={}", size); nfc->device->RescheduleTagRemoveEvent(); @@ -413,7 +418,7 @@ void Module::Interface::ReadApplicationArea(Kernel::HLERequestContext& ctx) { return; } - std::vector buffer(sizeof(ApplicationArea)); + std::vector buffer(size); const auto result = nfc->device->GetApplicationArea(buffer); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); @@ -423,11 +428,15 @@ void Module::Interface::ReadApplicationArea(Kernel::HLERequestContext& ctx) { void Module::Interface::WriteApplicationArea(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); - [[maybe_unused]] u32 size = rp.Pop(); + u32 size = rp.Pop(); std::vector tag_uuid_info = rp.PopStaticBuffer(); std::vector buffer = rp.PopStaticBuffer(); - LOG_CRITICAL(Service_NFC, "called, size={}", size); + LOG_INFO(Service_NFC, "called, size={}", size); + + if (buffer.size() > size) { + buffer.resize(size); + } if (nfc->nfc_mode != CommunicationMode::Amiibo) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); @@ -540,7 +549,7 @@ void Module::Interface::GetIdentificationBlock(Kernel::HLERequestContext& ctx) { ModelInfo model_info{}; const auto result = nfc->device->GetModelInfo(model_info); - IPC::RequestBuilder rb = rp.MakeBuilder(0x1F, 0); + IPC::RequestBuilder rb = rp.MakeBuilder(14, 0); rb.Push(result); rb.PushRaw(model_info); } diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp index 18ac135cc2..107ff8101c 100644 --- a/src/core/hle/service/nfc/nfc_device.cpp +++ b/src/core/hle/service/nfc/nfc_device.cpp @@ -1101,8 +1101,8 @@ void NfcDevice::BuildAmiiboWithoutKeys() { } void NfcDevice::RescheduleTagRemoveEvent() { - /// The interval at which the amiibo will be removed automatically 1.5s - static constexpr u64 amiibo_removal_interval = nsToCycles(1500 * 1000 * 1000); + /// The interval at which the amiibo will be removed automatically 3s + static constexpr u64 amiibo_removal_interval = msToCycles(3 * 1000); system.CoreTiming().UnscheduleEvent(remove_amiibo_event, 0);