diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt
index fa77ed20a1..3ca82051a7 100644
--- a/Source/Core/Core/CMakeLists.txt
+++ b/Source/Core/Core/CMakeLists.txt
@@ -148,6 +148,7 @@ add_library(core
HW/WiimoteEmu/Extension/Nunchuk.cpp
HW/WiimoteEmu/Extension/Drums.cpp
HW/WiimoteEmu/Extension/Guitar.cpp
+ HW/WiimoteEmu/Extension/TaTaCon.cpp
HW/WiimoteEmu/Extension/Turntable.cpp
HW/WiimoteEmu/Extension/UDrawTablet.cpp
HW/WiimoteReal/WiimoteReal.cpp
diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj
index 132c29a5dd..b12485dafc 100644
--- a/Source/Core/Core/Core.vcxproj
+++ b/Source/Core/Core/Core.vcxproj
@@ -182,6 +182,7 @@
+
@@ -451,6 +452,7 @@
+
diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters
index 29357418da..2420db532a 100644
--- a/Source/Core/Core/Core.vcxproj.filters
+++ b/Source/Core/Core/Core.vcxproj.filters
@@ -904,6 +904,9 @@
HW %28Flipper/Hollywood%29\Wiimote\Emu\Extension
+
+ HW %28Flipper/Hollywood%29\Wiimote\Emu\Extension
+
HW %28Flipper/Hollywood%29\Wiimote\Emu\Extension
@@ -1622,6 +1625,9 @@
HW %28Flipper/Hollywood%29\Wiimote\Emu\Extension
+
+ HW %28Flipper/Hollywood%29\Wiimote\Emu\Extension
+
HW %28Flipper/Hollywood%29\Wiimote\Emu\Extension
diff --git a/Source/Core/Core/HW/Wiimote.cpp b/Source/Core/Core/HW/Wiimote.cpp
index e59bcaa632..5d6f1a2286 100644
--- a/Source/Core/Core/HW/Wiimote.cpp
+++ b/Source/Core/Core/HW/Wiimote.cpp
@@ -72,6 +72,11 @@ ControllerEmu::ControlGroup* GetUDrawTabletGroup(int number, WiimoteEmu::UDrawTa
->GetUDrawTabletGroup(group);
}
+ControllerEmu::ControlGroup* GetTaTaConGroup(int number, WiimoteEmu::TaTaConGroup group)
+{
+ return static_cast(s_config.GetController(number))->GetTaTaConGroup(group);
+}
+
void Shutdown()
{
s_config.UnregisterHotplugCallback();
diff --git a/Source/Core/Core/HW/Wiimote.h b/Source/Core/Core/HW/Wiimote.h
index c4042558a9..af87e0e0c7 100644
--- a/Source/Core/Core/HW/Wiimote.h
+++ b/Source/Core/Core/HW/Wiimote.h
@@ -27,6 +27,7 @@ enum class GuitarGroup;
enum class DrumsGroup;
enum class TurntableGroup;
enum class UDrawTabletGroup;
+enum class TaTaConGroup;
} // namespace WiimoteEmu
enum
@@ -80,6 +81,7 @@ ControllerEmu::ControlGroup* GetGuitarGroup(int number, WiimoteEmu::GuitarGroup
ControllerEmu::ControlGroup* GetDrumsGroup(int number, WiimoteEmu::DrumsGroup group);
ControllerEmu::ControlGroup* GetTurntableGroup(int number, WiimoteEmu::TurntableGroup group);
ControllerEmu::ControlGroup* GetUDrawTabletGroup(int number, WiimoteEmu::UDrawTabletGroup group);
+ControllerEmu::ControlGroup* GetTaTaConGroup(int number, WiimoteEmu::TaTaConGroup group);
void ControlChannel(int number, u16 channel_id, const void* data, u32 size);
void InterruptChannel(int number, u16 channel_id, const void* data, u32 size);
diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp b/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp
new file mode 100644
index 0000000000..53ec58976a
--- /dev/null
+++ b/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.cpp
@@ -0,0 +1,95 @@
+// Copyright 2019 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#include "Core/HW/WiimoteEmu/Extension/TaTaCon.h"
+
+#include
+#include
+#include
+
+#include "Common/BitUtils.h"
+#include "Common/Common.h"
+#include "Common/CommonTypes.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+
+#include "InputCommon/ControllerEmu/Control/Input.h"
+#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
+
+namespace WiimoteEmu
+{
+constexpr std::array tatacon_id{{0x00, 0x00, 0xa4, 0x20, 0x01, 0x11}};
+
+constexpr std::array center_bitmasks{{
+ TaTaCon::CENTER_LEFT,
+ TaTaCon::CENTER_RIGHT,
+}};
+
+constexpr std::array rim_bitmasks{{
+ TaTaCon::RIM_LEFT,
+ TaTaCon::RIM_RIGHT,
+}};
+
+constexpr std::array position_names{{
+ _trans("Left"),
+ _trans("Right"),
+}};
+
+// i18n: The drum controller used in "Taiko no Tatsujin" games. Also known as a "TaTaCon".
+TaTaCon::TaTaCon() : Extension3rdParty("TaTaCon", _trans("Taiko Drum"))
+{
+ // i18n: Refers to the "center" of a TaTaCon drum.
+ groups.emplace_back(m_center = new ControllerEmu::Buttons(_trans("Center")));
+ for (auto& name : position_names)
+ m_center->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::Translate, name));
+
+ // i18n: Refers to the "rim" of a TaTaCon drum.
+ groups.emplace_back(m_rim = new ControllerEmu::Buttons(_trans("Rim")));
+ for (auto& name : position_names)
+ m_rim->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::Translate, name));
+}
+
+void TaTaCon::Update()
+{
+ DataFormat tatacon_data = {};
+
+ m_center->GetState(&tatacon_data.state, center_bitmasks.data());
+ m_rim->GetState(&tatacon_data.state, rim_bitmasks.data());
+
+ // Flip button bits.
+ tatacon_data.state ^= 0xff;
+
+ Common::BitCastPtr(&m_reg.controller_data) = tatacon_data;
+}
+
+bool TaTaCon::IsButtonPressed() const
+{
+ u8 state = 0;
+ m_center->GetState(&state, center_bitmasks.data());
+ m_rim->GetState(&state, rim_bitmasks.data());
+ return state != 0;
+}
+
+void TaTaCon::Reset()
+{
+ m_reg = {};
+ m_reg.identifier = tatacon_id;
+
+ // Assuming calibration is 0xff filled like every other 3rd-party extension.
+ m_reg.calibration.fill(0xff);
+}
+
+ControllerEmu::ControlGroup* TaTaCon::GetGroup(TaTaConGroup group)
+{
+ switch (group)
+ {
+ case TaTaConGroup::Center:
+ return m_center;
+ case TaTaConGroup::Rim:
+ return m_rim;
+ default:
+ assert(false);
+ return nullptr;
+ }
+}
+} // namespace WiimoteEmu
diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.h b/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.h
new file mode 100644
index 0000000000..31f3e6bcd0
--- /dev/null
+++ b/Source/Core/Core/HW/WiimoteEmu/Extension/TaTaCon.h
@@ -0,0 +1,50 @@
+// Copyright 2019 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "Core/HW/WiimoteEmu/Extension/Extension.h"
+
+namespace ControllerEmu
+{
+class Buttons;
+} // namespace ControllerEmu
+
+namespace WiimoteEmu
+{
+enum class TaTaConGroup
+{
+ Center,
+ Rim,
+};
+
+class TaTaCon : public Extension3rdParty
+{
+public:
+ struct DataFormat
+ {
+ std::array nothing;
+
+ u8 state;
+ };
+ static_assert(sizeof(DataFormat) == 6, "Wrong size");
+
+ TaTaCon();
+
+ void Update() override;
+ bool IsButtonPressed() const override;
+ void Reset() override;
+
+ ControllerEmu::ControlGroup* GetGroup(TaTaConGroup group);
+
+ static constexpr u8 CENTER_LEFT = 0x40;
+ static constexpr u8 CENTER_RIGHT = 0x10;
+ static constexpr u8 RIM_LEFT = 0x20;
+ static constexpr u8 RIM_RIGHT = 0x08;
+
+private:
+ ControllerEmu::Buttons* m_center;
+ ControllerEmu::Buttons* m_rim;
+};
+} // namespace WiimoteEmu
diff --git a/Source/Core/Core/HW/WiimoteEmu/ExtensionPort.h b/Source/Core/Core/HW/WiimoteEmu/ExtensionPort.h
index 8ca5aa8c4f..7f4f5c979c 100644
--- a/Source/Core/Core/HW/WiimoteEmu/ExtensionPort.h
+++ b/Source/Core/Core/HW/WiimoteEmu/ExtensionPort.h
@@ -20,6 +20,7 @@ enum ExtensionNumber : u8
DRUMS,
TURNTABLE,
UDRAW_TABLET,
+ TATACON,
};
// FYI: An extension must be attached.
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
index 623ab4dd9e..f8034901a2 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
@@ -29,6 +29,7 @@
#include "Core/HW/WiimoteEmu/Extension/Drums.h"
#include "Core/HW/WiimoteEmu/Extension/Guitar.h"
#include "Core/HW/WiimoteEmu/Extension/Nunchuk.h"
+#include "Core/HW/WiimoteEmu/Extension/TaTaCon.h"
#include "Core/HW/WiimoteEmu/Extension/Turntable.h"
#include "Core/HW/WiimoteEmu/Extension/UDrawTablet.h"
@@ -167,6 +168,7 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index)
m_attachments->AddAttachment(std::make_unique());
m_attachments->AddAttachment(std::make_unique());
m_attachments->AddAttachment(std::make_unique());
+ m_attachments->AddAttachment(std::make_unique());
m_attachments->AddSetting(&m_motion_plus_setting, {_trans("Attach MotionPlus")}, true);
@@ -291,6 +293,13 @@ ControllerEmu::ControlGroup* Wiimote::GetUDrawTabletGroup(UDrawTabletGroup group
return static_cast(
m_attachments->GetAttachmentList()[ExtensionNumber::UDRAW_TABLET].get())
->GetGroup(group);
+ ;
+}
+
+ControllerEmu::ControlGroup* Wiimote::GetTaTaConGroup(TaTaConGroup group)
+{
+ return static_cast(m_attachments->GetAttachmentList()[ExtensionNumber::TATACON].get())
+ ->GetGroup(group);
}
bool Wiimote::ProcessExtensionPortEvent()
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h
index 5386b4a17e..495a25ce0a 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h
@@ -56,6 +56,7 @@ enum class GuitarGroup;
enum class DrumsGroup;
enum class TurntableGroup;
enum class UDrawTabletGroup;
+enum class TaTaConGroup;
template
void UpdateCalibrationDataChecksum(T& data, int cksum_bytes)
@@ -115,6 +116,7 @@ public:
ControllerEmu::ControlGroup* GetDrumsGroup(DrumsGroup group);
ControllerEmu::ControlGroup* GetTurntableGroup(TurntableGroup group);
ControllerEmu::ControlGroup* GetUDrawTabletGroup(UDrawTabletGroup group);
+ ControllerEmu::ControlGroup* GetTaTaConGroup(TaTaConGroup group);
void Update();
void StepDynamics();
diff --git a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.cpp b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.cpp
index a6a06c6b18..7d68d7da27 100644
--- a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.cpp
+++ b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.cpp
@@ -14,6 +14,7 @@
#include "Core/HW/WiimoteEmu/Extension/Drums.h"
#include "Core/HW/WiimoteEmu/Extension/Guitar.h"
#include "Core/HW/WiimoteEmu/Extension/Nunchuk.h"
+#include "Core/HW/WiimoteEmu/Extension/TaTaCon.h"
#include "Core/HW/WiimoteEmu/Extension/Turntable.h"
#include "Core/HW/WiimoteEmu/Extension/UDrawTablet.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
@@ -29,6 +30,7 @@ WiimoteEmuExtension::WiimoteEmuExtension(MappingWindow* window) : MappingWidget(
CreateNunchukLayout();
CreateTurntableLayout();
CreateUDrawTabletLayout();
+ CreateTaTaConLayout();
CreateMainLayout();
ChangeExtensionType(WiimoteEmu::ExtensionNumber::NONE);
@@ -201,6 +203,19 @@ void WiimoteEmuExtension::CreateUDrawTabletLayout()
m_udraw_tablet_box->setLayout(hbox);
}
+void WiimoteEmuExtension::CreateTaTaConLayout()
+{
+ auto* hbox = new QHBoxLayout();
+ m_tatacon_box = new QGroupBox(tr("Taiko Drum"), this);
+
+ hbox->addWidget(CreateGroupBox(
+ tr("Center"), Wiimote::GetTaTaConGroup(GetPort(), WiimoteEmu::TaTaConGroup::Center)));
+ hbox->addWidget(CreateGroupBox(
+ tr("Rim"), Wiimote::GetTaTaConGroup(GetPort(), WiimoteEmu::TaTaConGroup::Rim)));
+
+ m_tatacon_box->setLayout(hbox);
+}
+
void WiimoteEmuExtension::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
@@ -212,6 +227,7 @@ void WiimoteEmuExtension::CreateMainLayout()
m_main_layout->addWidget(m_nunchuk_box);
m_main_layout->addWidget(m_turntable_box);
m_main_layout->addWidget(m_udraw_tablet_box);
+ m_main_layout->addWidget(m_tatacon_box);
setLayout(m_main_layout);
}
@@ -242,4 +258,5 @@ void WiimoteEmuExtension::ChangeExtensionType(u32 type)
m_drums_box->setHidden(type != ExtensionNumber::DRUMS);
m_turntable_box->setHidden(type != ExtensionNumber::TURNTABLE);
m_udraw_tablet_box->setHidden(type != ExtensionNumber::UDRAW_TABLET);
+ m_tatacon_box->setHidden(type != ExtensionNumber::TATACON);
}
diff --git a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.h b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.h
index d0b8bf13e9..b1c97339b3 100644
--- a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.h
+++ b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtension.h
@@ -32,6 +32,7 @@ private:
void CreateNunchukLayout();
void CreateTurntableLayout();
void CreateUDrawTabletLayout();
+ void CreateTaTaConLayout();
void CreateMainLayout();
// Main
@@ -43,4 +44,5 @@ private:
QGroupBox* m_nunchuk_box;
QGroupBox* m_turntable_box;
QGroupBox* m_udraw_tablet_box;
+ QGroupBox* m_tatacon_box;
};