summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/Control
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2017-02-08 22:15:43 -0500
committerLioncash <mathew1800@gmail.com>2017-02-09 18:18:52 -0500
commit6a75ea5653ec596b1a08e985e98fca0b05ccd6f7 (patch)
treed76f549ca6c7591fa2b11a86f63e0351b418f4c8 /Source/Core/InputCommon/ControllerEmu/Control
parent1385a012d94bbec76bc8b2922467c715b63f0158 (diff)
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.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/Control')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Control.cpp15
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Control.h25
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Input.cpp15
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Input.h17
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Output.cpp15
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Output.h17
6 files changed, 104 insertions, 0 deletions
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 <memory>
+#include <string>
+
+class ControlReference;
+
+namespace ControllerEmu
+{
+class Control
+{
+public:
+ virtual ~Control();
+
+ std::unique_ptr<ControlReference> 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 <string>
+#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 <string>
+#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 <string>
+#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 <string>
+#include "InputCommon/ControllerEmu/Control/Control.h"
+
+namespace ControllerEmu
+{
+class Output : public Control
+{
+public:
+ explicit Output(const std::string& name);
+};
+} // namespace ControllerEmu