summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nfc/nfc.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-01-26 03:47:56 +0100
committerGitHub <noreply@github.com>2017-01-26 03:47:56 +0100
commit3feb3ce283b53be644bc4ca884817aba9cf63a81 (patch)
treec1e78b9bfc27805b5a2667e465b55ddae047cc87 /src/core/hle/service/nfc/nfc.cpp
parentMerge pull request #2469 from Kloen/killing-warnings (diff)
parentService/NFC: stub some functions (diff)
downloadyuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.tar
yuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.tar.gz
yuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.tar.bz2
yuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.tar.lz
yuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.tar.xz
yuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.tar.zst
yuzu-3feb3ce283b53be644bc4ca884817aba9cf63a81.zip
Diffstat (limited to 'src/core/hle/service/nfc/nfc.cpp')
-rw-r--r--src/core/hle/service/nfc/nfc.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
index e248285f9..fd3c7d9c2 100644
--- a/src/core/hle/service/nfc/nfc.cpp
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -11,6 +11,81 @@ namespace Service {
namespace NFC {
static Kernel::SharedPtr<Kernel::Event> tag_in_range_event;
+static Kernel::SharedPtr<Kernel::Event> tag_out_of_range_event;
+static TagState nfc_tag_state = TagState::NotInitialized;
+static CommunicationStatus nfc_status = CommunicationStatus::NfcInitialized;
+
+void Initialize(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ u8 param = static_cast<u8>(cmd_buff[1] & 0xFF);
+
+ nfc_tag_state = TagState::NotScanning;
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called, param=%u", param);
+}
+
+void Shutdown(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ u8 param = static_cast<u8>(cmd_buff[1] & 0xFF);
+ nfc_tag_state = TagState::NotInitialized;
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called, param=%u", param);
+}
+
+void StartCommunication(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
+
+void StopCommunication(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
+
+void StartTagScanning(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ nfc_tag_state = TagState::TagInRange;
+ tag_in_range_event->Signal();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
+
+void StopTagScanning(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ nfc_tag_state = TagState::NotScanning;
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
+
+void LoadAmiiboData(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ nfc_tag_state = TagState::TagDataLoaded;
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
+
+void ResetTagScanState(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ nfc_tag_state = TagState::NotScanning;
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
void GetTagInRangeEvent(Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
@@ -22,16 +97,46 @@ void GetTagInRangeEvent(Interface* self) {
LOG_WARNING(Service_NFC, "(STUBBED) called");
}
+void GetTagOutOfRangeEvent(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[0] = IPC::MakeHeader(0xC, 1, 2);
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = IPC::CopyHandleDesc();
+ cmd_buff[3] = Kernel::g_handle_table.Create(tag_out_of_range_event).MoveFrom();
+ LOG_WARNING(Service_NFC, "(STUBBED) called");
+}
+
+void GetTagState(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ cmd_buff[2] = static_cast<u8>(nfc_tag_state);
+ LOG_DEBUG(Service_NFC, "(STUBBED) called");
+}
+
+void CommunicationGetStatus(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+ cmd_buff[2] = static_cast<u8>(nfc_status);
+ LOG_DEBUG(Service_NFC, "(STUBBED) called");
+}
+
void Init() {
AddService(new NFC_M());
AddService(new NFC_U());
tag_in_range_event =
Kernel::Event::Create(Kernel::ResetType::OneShot, "NFC::tag_in_range_event");
+ tag_out_of_range_event =
+ Kernel::Event::Create(Kernel::ResetType::OneShot, "NFC::tag_out_range_event");
+ nfc_tag_state = TagState::NotInitialized;
}
void Shutdown() {
tag_in_range_event = nullptr;
+ tag_out_of_range_event = nullptr;
}
} // namespace NFC