mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-09 20:58:48 -04:00
hid_core: Move hid to it's own subproject
This commit is contained in:
38
src/hid_core/resources/unique_pad/unique_pad.cpp
Normal file
38
src/hid_core/resources/unique_pad/unique_pad.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/core_timing.h"
|
||||
#include "hid_core/resources/applet_resource.h"
|
||||
#include "hid_core/resources/shared_memory_format.h"
|
||||
#include "hid_core/resources/unique_pad/unique_pad.h"
|
||||
|
||||
namespace Service::HID {
|
||||
|
||||
UniquePad::UniquePad(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
|
||||
|
||||
UniquePad::~UniquePad() = default;
|
||||
|
||||
void UniquePad::OnInit() {}
|
||||
|
||||
void UniquePad::OnRelease() {}
|
||||
|
||||
void UniquePad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
if (!smart_update) {
|
||||
return;
|
||||
}
|
||||
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
if (data == nullptr || !data->flag.is_assigned) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& header = data->shared_memory_format->capture_button.header;
|
||||
header.timestamp = core_timing.GetGlobalTimeNs().count();
|
||||
header.total_entry_count = 17;
|
||||
header.entry_count = 0;
|
||||
header.last_entry_index = 0;
|
||||
}
|
||||
|
||||
} // namespace Service::HID
|
||||
27
src/hid_core/resources/unique_pad/unique_pad.h
Normal file
27
src/hid_core/resources/unique_pad/unique_pad.h
Normal file
@@ -0,0 +1,27 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hid_core/resources/controller_base.h"
|
||||
|
||||
namespace Service::HID {
|
||||
|
||||
class UniquePad final : public ControllerBase {
|
||||
public:
|
||||
explicit UniquePad(Core::HID::HIDCore& hid_core_);
|
||||
~UniquePad() override;
|
||||
|
||||
// Called when the controller is initialized
|
||||
void OnInit() override;
|
||||
|
||||
// When the controller is released
|
||||
void OnRelease() override;
|
||||
|
||||
// When the controller is requesting an update for the shared memory
|
||||
void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
|
||||
|
||||
private:
|
||||
bool smart_update{};
|
||||
};
|
||||
} // namespace Service::HID
|
||||
Reference in New Issue
Block a user