From 0d4aa9125e3cf457b970fd33b05b5255d44a59d3 Mon Sep 17 00:00:00 2001
From: german77 <juangerman-13@hotmail.com>
Date: Fri, 15 Sep 2023 21:41:05 -0600
Subject: [PATCH] service: nfc: Fix amiibo formatting

---
 src/core/hle/service/nfc/common/device.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp
index 5dda123438..674d2e4b25 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -874,17 +874,19 @@ Result NfcDevice::RestoreAmiibo() {
 }
 
 Result NfcDevice::Format() {
-    auto result1 = DeleteApplicationArea();
-    auto result2 = DeleteRegisterInfo();
+    Result result = ResultSuccess;
 
-    if (result1.IsError()) {
-        return result1;
+    if (device_state == DeviceState::TagFound) {
+        result = Mount(NFP::ModelType::Amiibo, NFP::MountTarget::All);
     }
 
-    if (result2.IsError()) {
-        return result2;
+    if (result.IsError()) {
+        return result;
     }
 
+    DeleteApplicationArea();
+    DeleteRegisterInfo();
+
     return Flush();
 }
 
-- 
GitLab