Files
dolphin/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h
T

50 lines
1.4 KiB
C++
Raw Normal View History

// Copyright 2010 Dolphin Emulator Project
2015-05-18 01:08:10 +02:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
2010-06-12 17:15:16 +00:00
#pragma once
#include <memory>
2016-07-14 17:45:59 +02:00
#include <mutex>
#include <string>
2014-02-17 05:18:15 -05:00
#include <vector>
2014-02-17 05:18:15 -05:00
#include "Common/IniFile.h"
#include "InputCommon/ControllerInterface/Device.h"
class ControllerInterface;
#define sign(x) ((x) ? (x) < 0 ? -1 : 1 : 0)
const char* const named_directions[] = {"Up", "Down", "Left", "Right"};
namespace ControllerEmu
{
class ControlGroup;
class EmulatedController
{
public:
virtual ~EmulatedController();
virtual std::string GetName() const = 0;
virtual void LoadDefaults(const ControllerInterface& ciface);
virtual void LoadConfig(IniFile::Section* sec, const std::string& base = "");
virtual void SaveConfig(IniFile::Section* sec, const std::string& base = "");
void UpdateDefaultDevice();
void UpdateReferences(const ControllerInterface& devi);
2016-07-14 17:45:59 +02:00
// This returns a lock that should be held before calling State() on any control
// references and GetState(), by extension. This prevents a race condition
// which happens while handling a hotplug event because a control reference's State()
// could be called before we have finished updating the reference.
static std::unique_lock<std::recursive_mutex> GetStateLock();
std::vector<std::unique_ptr<ControlGroup>> groups;
ciface::Core::DeviceQualifier default_device;
};
} // namespace ControllerEmu