From 6a75ea5653ec596b1a08e985e98fca0b05ccd6f7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 8 Feb 2017 22:15:43 -0500 Subject: ControllerEmu: Separate ControlGroup from ControllerEmu ControllerEmu, the class, is essentially acting like a namespace for ControlGroup. This makes it impossible to forward declare any of the internals. It also globs a bunch of classes together which is kind of a pain to manage. This splits ControlGroup and the classes it contains into their own source files and situates them all within a namespace, which gets them out of global scope. Since this allows forward declarations for the once-internal classes, it now requires significantly less files to be rebuilt if anything is changed in the ControllerEmu portion of code. It does not split out the settings classes yet, however, as it would be preferable to make a settings base class that all settings derive from, but this would be a functional change -- this commit only intends to move around existing code. Extracting the settings class will be done in another commit. --- .../InputCommon/ControllerEmu/Control/Control.cpp | 15 +++++++++++++ .../InputCommon/ControllerEmu/Control/Control.h | 25 ++++++++++++++++++++++ .../InputCommon/ControllerEmu/Control/Input.cpp | 15 +++++++++++++ .../Core/InputCommon/ControllerEmu/Control/Input.h | 17 +++++++++++++++ .../InputCommon/ControllerEmu/Control/Output.cpp | 15 +++++++++++++ .../InputCommon/ControllerEmu/Control/Output.h | 17 +++++++++++++++ 6 files changed, 104 insertions(+) create mode 100644 Source/Core/InputCommon/ControllerEmu/Control/Control.cpp create mode 100644 Source/Core/InputCommon/ControllerEmu/Control/Control.h create mode 100644 Source/Core/InputCommon/ControllerEmu/Control/Input.cpp create mode 100644 Source/Core/InputCommon/ControllerEmu/Control/Input.h create mode 100644 Source/Core/InputCommon/ControllerEmu/Control/Output.cpp create mode 100644 Source/Core/InputCommon/ControllerEmu/Control/Output.h (limited to 'Source/Core/InputCommon/ControllerEmu/Control') diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp new file mode 100644 index 0000000000..00f9a71069 --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp @@ -0,0 +1,15 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "InputCommon/ControllerEmu/Control/Control.h" +#include "InputCommon/ControlReference/ControlReference.h" + +namespace ControllerEmu +{ +Control::Control(ControlReference* ref, const std::string& name_) : control_ref(ref), name(name_) +{ +} + +Control::~Control() = default; +} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.h b/Source/Core/InputCommon/ControllerEmu/Control/Control.h new file mode 100644 index 0000000000..ef88ebd328 --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.h @@ -0,0 +1,25 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +class ControlReference; + +namespace ControllerEmu +{ +class Control +{ +public: + virtual ~Control(); + + std::unique_ptr const control_ref; + const std::string name; + +protected: + Control(ControlReference* ref, const std::string& name); +}; +} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp new file mode 100644 index 0000000000..0f2e400e56 --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp @@ -0,0 +1,15 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "InputCommon/ControllerEmu/Control/Input.h" + +#include +#include "InputCommon/ControlReference/ControlReference.h" + +namespace ControllerEmu +{ +Input::Input(const std::string& name_) : Control(new InputReference, name_) +{ +} +} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.h b/Source/Core/InputCommon/ControllerEmu/Control/Input.h new file mode 100644 index 0000000000..678514736e --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/Control/Input.h @@ -0,0 +1,17 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include +#include "InputCommon/ControllerEmu/Control/Control.h" + +namespace ControllerEmu +{ +class Input : public Control +{ +public: + explicit Input(const std::string& name); +}; +} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp new file mode 100644 index 0000000000..24d7b30499 --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp @@ -0,0 +1,15 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "InputCommon/ControllerEmu/Control/Output.h" + +#include +#include "InputCommon/ControlReference/ControlReference.h" + +namespace ControllerEmu +{ +Output::Output(const std::string& name_) : Control(new OutputReference, name_) +{ +} +} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.h b/Source/Core/InputCommon/ControllerEmu/Control/Output.h new file mode 100644 index 0000000000..415c67f7d9 --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/Control/Output.h @@ -0,0 +1,17 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include +#include "InputCommon/ControllerEmu/Control/Control.h" + +namespace ControllerEmu +{ +class Output : public Control +{ +public: + explicit Output(const std::string& name); +}; +} // namespace ControllerEmu -- cgit v1.2.3