2022-04-23 08:59:50 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-08-21 11:39:24 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <functional>
|
2022-11-21 16:31:18 +00:00
|
|
|
#include <vector>
|
2020-08-21 11:39:24 +00:00
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2021-10-21 18:56:52 +00:00
|
|
|
namespace Core::HID {
|
|
|
|
class HIDCore;
|
2020-09-25 23:13:10 +00:00
|
|
|
}
|
|
|
|
|
2020-08-21 11:39:24 +00:00
|
|
|
namespace Core::Frontend {
|
|
|
|
|
|
|
|
using BorderColor = std::array<u8, 4>;
|
2020-08-27 05:21:48 +00:00
|
|
|
using ExplainText = std::array<char, 0x81>;
|
2020-08-21 11:39:24 +00:00
|
|
|
|
|
|
|
struct ControllerParameters {
|
|
|
|
s8 min_players{};
|
|
|
|
s8 max_players{};
|
|
|
|
bool keep_controllers_connected{};
|
|
|
|
bool enable_single_mode{};
|
|
|
|
bool enable_border_color{};
|
|
|
|
std::vector<BorderColor> border_colors{};
|
2020-08-27 05:21:48 +00:00
|
|
|
bool enable_explain_text{};
|
|
|
|
std::vector<ExplainText> explain_text{};
|
2020-08-21 11:39:24 +00:00
|
|
|
bool allow_pro_controller{};
|
|
|
|
bool allow_handheld{};
|
|
|
|
bool allow_dual_joycons{};
|
|
|
|
bool allow_left_joycon{};
|
|
|
|
bool allow_right_joycon{};
|
2021-02-06 17:53:25 +00:00
|
|
|
bool allow_gamecube_controller{};
|
2020-08-21 11:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ControllerApplet {
|
|
|
|
public:
|
|
|
|
virtual ~ControllerApplet();
|
|
|
|
|
|
|
|
virtual void ReconfigureControllers(std::function<void()> callback,
|
2020-10-26 23:36:58 +00:00
|
|
|
const ControllerParameters& parameters) const = 0;
|
2020-08-21 11:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DefaultControllerApplet final : public ControllerApplet {
|
|
|
|
public:
|
2021-10-21 18:56:52 +00:00
|
|
|
explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
|
2020-08-21 11:39:24 +00:00
|
|
|
~DefaultControllerApplet() override;
|
|
|
|
|
|
|
|
void ReconfigureControllers(std::function<void()> callback,
|
2020-10-26 23:36:58 +00:00
|
|
|
const ControllerParameters& parameters) const override;
|
2020-09-25 23:13:10 +00:00
|
|
|
|
|
|
|
private:
|
2021-10-21 18:56:52 +00:00
|
|
|
HID::HIDCore& hid_core;
|
2020-08-21 11:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core::Frontend
|