From a994a404676feed8c812e66edf3d055af8bc10e4 Mon Sep 17 00:00:00 2001
From: german <german@thesoftwareartisans.com>
Date: Sat, 6 Feb 2021 11:53:25 -0600
Subject: hid: Implement GC controller

---
 src/yuzu/applets/controller.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'src/yuzu/applets/controller.cpp')

diff --git a/src/yuzu/applets/controller.cpp b/src/yuzu/applets/controller.cpp
index c680fd2c21..b92cd6886f 100644
--- a/src/yuzu/applets/controller.cpp
+++ b/src/yuzu/applets/controller.cpp
@@ -67,6 +67,8 @@ bool IsControllerCompatible(Settings::ControllerType controller_type,
         return parameters.allow_right_joycon;
     case Settings::ControllerType::Handheld:
         return parameters.enable_single_mode && parameters.allow_handheld;
+    case Settings::ControllerType::GameCube:
+        return parameters.allow_gamecube_controller;
     default:
         return false;
     }
@@ -370,7 +372,7 @@ void QtControllerSelectorDialog::SetSupportedControllers() {
             QStringLiteral("image: url(:/controller/applet_joycon_right%0_disabled); ").arg(theme));
     }
 
-    if (parameters.allow_pro_controller) {
+    if (parameters.allow_pro_controller || parameters.allow_gamecube_controller) {
         ui->controllerSupported5->setStyleSheet(
             QStringLiteral("image: url(:/controller/applet_pro_controller%0); ").arg(theme));
     } else {
@@ -420,6 +422,10 @@ void QtControllerSelectorDialog::SetEmulatedControllers(std::size_t player_index
                            Settings::ControllerType::Handheld);
         emulated_controllers[player_index]->addItem(tr("Handheld"));
     }
+
+    pairs.emplace_back(emulated_controllers[player_index]->count(),
+                       Settings::ControllerType::GameCube);
+    emulated_controllers[player_index]->addItem(tr("GameCube Controller"));
 }
 
 Settings::ControllerType QtControllerSelectorDialog::GetControllerTypeFromIndex(
@@ -461,6 +467,7 @@ void QtControllerSelectorDialog::UpdateControllerIcon(std::size_t player_index)
         switch (GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(),
                                            player_index)) {
         case Settings::ControllerType::ProController:
+        case Settings::ControllerType::GameCube:
             return QStringLiteral("image: url(:/controller/applet_pro_controller%0); ");
         case Settings::ControllerType::DualJoyconDetached:
             return QStringLiteral("image: url(:/controller/applet_dual_joycon%0); ");
-- 
cgit v1.2.3-70-g09d2