stubbed.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include <cstring>
  4. #include "common/common_types.h"
  5. #include "core/core_timing.h"
  6. #include "core/hid/hid_core.h"
  7. #include "core/hle/service/hid/controllers/stubbed.h"
  8. namespace Service::HID {
  9. Controller_Stubbed::Controller_Stubbed(Core::HID::HIDCore& hid_core_, u8* raw_shared_memory_)
  10. : ControllerBase{hid_core_} {
  11. raw_shared_memory = raw_shared_memory_;
  12. }
  13. Controller_Stubbed::~Controller_Stubbed() = default;
  14. void Controller_Stubbed::OnInit() {}
  15. void Controller_Stubbed::OnRelease() {}
  16. void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
  17. if (!smart_update) {
  18. return;
  19. }
  20. CommonHeader header{};
  21. header.timestamp = core_timing.GetCPUTicks();
  22. header.total_entry_count = 17;
  23. header.entry_count = 0;
  24. header.last_entry_index = 0;
  25. std::memcpy(raw_shared_memory + common_offset, &header, sizeof(CommonHeader));
  26. }
  27. void Controller_Stubbed::SetCommonHeaderOffset(std::size_t off) {
  28. common_offset = off;
  29. smart_update = true;
  30. }
  31. } // namespace Service::HID