digitizer.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "core/core_timing.h"
  4. #include "hid_core/resources/applet_resource.h"
  5. #include "hid_core/resources/digitizer/digitizer.h"
  6. #include "hid_core/resources/shared_memory_format.h"
  7. namespace Service::HID {
  8. Digitizer::Digitizer(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
  9. Digitizer::~Digitizer() = default;
  10. void Digitizer::OnInit() {}
  11. void Digitizer::OnRelease() {}
  12. void Digitizer::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
  13. if (!smart_update) {
  14. return;
  15. }
  16. std::scoped_lock shared_lock{*shared_mutex};
  17. const u64 aruid = applet_resource->GetActiveAruid();
  18. auto* data = applet_resource->GetAruidData(aruid);
  19. if (data == nullptr || !data->flag.is_assigned) {
  20. return;
  21. }
  22. auto& header = data->shared_memory_format->digitizer.header;
  23. header.timestamp = core_timing.GetGlobalTimeNs().count();
  24. header.total_entry_count = 17;
  25. header.entry_count = 0;
  26. header.last_entry_index = 0;
  27. }
  28. } // namespace Service::HID