From d61ef9a95aa4341ef430b8e0e0ea7b04eb3b55a4 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 2 Feb 2016 22:04:27 +0100 Subject: [PATCH] [SI] add a way to check if the current controller is a gcpad (or gcpad-compatible) --- Source/Core/Core/HW/SI_Device.cpp | 20 ++++++++++++++++++++ Source/Core/Core/HW/SI_Device.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/Source/Core/Core/HW/SI_Device.cpp b/Source/Core/Core/HW/SI_Device.cpp index c239ee1350..56c27b94df 100644 --- a/Source/Core/Core/HW/SI_Device.cpp +++ b/Source/Core/Core/HW/SI_Device.cpp @@ -67,6 +67,26 @@ public: }; +// Check if a device class is inheriting from CSIDevice_GCController +// The goal of this function is to avoid special casing a long list of +// device types when there is no "real" input device, e.g. when playing +// a TAS movie, or netplay input. +bool SIDevice_IsGCController(SIDevices type) +{ + switch (type) + { + case SIDEVICE_GC_CONTROLLER: + case SIDEVICE_WIIU_ADAPTER: + case SIDEVICE_GC_TARUKONGA: + case SIDEVICE_DANCEMAT: + case SIDEVICE_GC_STEERING: + return true; + default: + return false; + } +} + + // F A C T O R Y std::unique_ptr SIDevice_Create(const SIDevices device, const int port_number) { diff --git a/Source/Core/Core/HW/SI_Device.h b/Source/Core/Core/HW/SI_Device.h index 866ae98e2a..5671cfba05 100644 --- a/Source/Core/Core/HW/SI_Device.h +++ b/Source/Core/Core/HW/SI_Device.h @@ -107,4 +107,6 @@ public: } }; +bool SIDevice_IsGCController(SIDevices type); + std::unique_ptr SIDevice_Create(const SIDevices device, const int port_number);