From 5e8ab05cc01d430fc0e4ccbf379369effd00485c Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 17 Jan 2015 09:36:05 +1100 Subject: [PATCH] Added GameCube Keyboard support. --- Source/Core/Core/CMakeLists.txt | 3 + Source/Core/Core/Core.cpp | 18 +- Source/Core/Core/Core.vcxproj | 6 + Source/Core/Core/Core.vcxproj.filters | 21 + Source/Core/Core/HW/GCKeyboard.cpp | 71 +++ Source/Core/Core/HW/GCKeyboard.h | 21 + Source/Core/Core/HW/GCKeyboardEmu.cpp | 448 ++++++++++++++++++ Source/Core/Core/HW/GCKeyboardEmu.h | 32 ++ Source/Core/Core/HW/GCPad.cpp | 1 - Source/Core/Core/HW/SI_Device.cpp | 6 +- Source/Core/Core/HW/SI_DeviceGCController.cpp | 1 + Source/Core/Core/HW/SI_DeviceGCController.h | 1 + .../Core/Core/HW/SI_DeviceGCSteeringWheel.cpp | 5 +- .../Core/Core/HW/SI_DeviceGCSteeringWheel.h | 2 +- Source/Core/Core/HW/SI_DeviceKeyboard.cpp | 191 ++++++++ Source/Core/Core/HW/SI_DeviceKeyboard.h | 66 +++ .../Core/DolphinWX/ControllerConfigDiag.cpp | 35 +- Source/Core/DolphinWX/ControllerConfigDiag.h | 2 +- Source/Core/DolphinWX/InputConfigDiag.cpp | 11 +- Source/Core/InputCommon/KeyboardStatus.h | 198 ++++++++ 20 files changed, 1117 insertions(+), 22 deletions(-) create mode 100644 Source/Core/Core/HW/GCKeyboard.cpp create mode 100644 Source/Core/Core/HW/GCKeyboard.h create mode 100644 Source/Core/Core/HW/GCKeyboardEmu.cpp create mode 100644 Source/Core/Core/HW/GCKeyboardEmu.h create mode 100644 Source/Core/Core/HW/SI_DeviceKeyboard.cpp create mode 100644 Source/Core/Core/HW/SI_DeviceKeyboard.h create mode 100644 Source/Core/InputCommon/KeyboardStatus.h diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 7cbf4509f6..15a8b0e48d 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -97,6 +97,8 @@ set(SRCS ActionReplay.cpp HW/EXI_DeviceIPL.cpp HW/EXI_DeviceMemoryCard.cpp HW/EXI_DeviceMic.cpp + HW/GCKeyboard.cpp + HW/GCKeyboardEmu.cpp HW/GCMemcard.cpp HW/GCMemcardDirectory.cpp HW/GCMemcardRaw.cpp @@ -116,6 +118,7 @@ set(SRCS ActionReplay.cpp HW/SI_DeviceGBA.cpp HW/SI_DeviceGCController.cpp HW/SI_DeviceGCSteeringWheel.cpp + HW/SI_DeviceKeyboard.cpp HW/Sram.cpp HW/StreamADPCM.cpp HW/SystemTimers.cpp diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 4756659b36..9d5c2db2b2 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -39,6 +39,7 @@ #include "Core/HW/CPU.h" #include "Core/HW/DSP.h" #include "Core/HW/EXI.h" +#include "Core/HW/GCKeyboard.h" #include "Core/HW/GCPad.h" #include "Core/HW/GPFifo.h" #include "Core/HW/HW.h" @@ -360,7 +361,14 @@ void EmuThread() return; } - Pad::Initialize(s_window_handle); + for (unsigned int port_num = 0; port_num < 4; port_num++) + { + if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_GC_KEYBOARD) + Keyboard::Initialize(s_window_handle); + else + Pad::Initialize(s_window_handle); + } + // Load and Init Wiimotes - only if we are booting in Wii mode if (core_parameter.bWii) { @@ -475,7 +483,13 @@ void EmuThread() INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str()); HW::Shutdown(); INFO_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str()); - Pad::Shutdown(); + for (unsigned int port_num = 0; port_num < 4; port_num++) + { + if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_GC_KEYBOARD) + Keyboard::Shutdown(); + else + Pad::Shutdown(); + } Wiimote::Shutdown(); g_video_backend->Shutdown(); AudioCommon::ShutdownSoundStream(); diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index ae775bcc5a..bf34fbabbe 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -128,6 +128,8 @@ + + @@ -147,6 +149,7 @@ +