2019-01-01 07:32:39 -07:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-01-01 07:32:39 -07:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
2021-05-04 14:51:58 -06:00
|
|
|
#include "Core/HW/WiimoteEmu/ExtensionPort.h"
|
2019-01-01 07:32:39 -07:00
|
|
|
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
|
|
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
2020-01-18 10:19:32 -07:00
|
|
|
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
2019-01-01 07:32:39 -07:00
|
|
|
|
|
|
|
namespace ControllerEmu
|
|
|
|
{
|
|
|
|
// A container of the selected and available attachments
|
|
|
|
// for configuration saving/loading purposes
|
|
|
|
class Attachments : public ControlGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Attachments(const std::string& name);
|
|
|
|
|
|
|
|
void AddAttachment(std::unique_ptr<EmulatedController> att);
|
|
|
|
|
|
|
|
u32 GetSelectedAttachment() const;
|
|
|
|
void SetSelectedAttachment(u32 val);
|
|
|
|
|
2020-01-18 10:19:32 -07:00
|
|
|
NumericSetting<int>& GetSelectionSetting();
|
|
|
|
|
2019-01-01 07:32:39 -07:00
|
|
|
const std::vector<std::unique_ptr<EmulatedController>>& GetAttachmentList() const;
|
|
|
|
|
|
|
|
private:
|
2020-01-18 10:19:32 -07:00
|
|
|
SettingValue<int> m_selection_value;
|
2021-05-04 14:51:58 -06:00
|
|
|
// This is here and not added to the list of numeric_settings because it's serialized differently,
|
|
|
|
// by string (to be independent from the enum), and visualized differently in the UI.
|
|
|
|
// For the rest, it's treated similarly to other numeric_settings in the group.
|
|
|
|
NumericSetting<int> m_selection_setting = {
|
|
|
|
&m_selection_value, {""}, 0, 0, WiimoteEmu::ExtensionNumber::MAX - 1};
|
2019-01-01 07:32:39 -07:00
|
|
|
|
2020-01-18 10:19:32 -07:00
|
|
|
std::vector<std::unique_ptr<EmulatedController>> m_attachments;
|
2019-01-01 07:32:39 -07:00
|
|
|
};
|
|
|
|
} // namespace ControllerEmu
|