summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-03-03 02:02:29 +0100
committerPierre Bourdon <delroth@gmail.com>2016-03-03 02:02:29 +0100
commitf752c6e7044c9b391bb2c88a6114bd46ca43d09c (patch)
tree56a2147bbfe6f4e110914be4507f1beb104c4dc8 /Source/Core
parenta64dd3659ad9b8bf9c6297124f0496d3f1aa0df2 (diff)
parent4fe2886c2c115751e7040ade63493ce92fd73824 (diff)
Merge pull request #3589 from mathieui/gcadapter-recording
Fix recording a movie with the GC Adapter
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/SI.cpp18
-rw-r--r--Source/Core/Core/HW/SI_Device.cpp20
-rw-r--r--Source/Core/Core/HW/SI_Device.h2
-rw-r--r--Source/Core/Core/NetPlayClient.cpp4
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp2
5 files changed, 42 insertions, 4 deletions
diff --git a/Source/Core/Core/HW/SI.cpp b/Source/Core/Core/HW/SI.cpp
index 148fc217db..7c0e11801b 100644
--- a/Source/Core/Core/HW/SI.cpp
+++ b/Source/Core/Core/HW/SI.cpp
@@ -260,9 +260,25 @@ void Init()
g_Channel[i].m_InLo.Hex = 0;
if (Movie::IsMovieActive())
- AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
+ {
+ if (Movie::IsUsingPad(i))
+ {
+ SIDevices current = SConfig::GetInstance().m_SIDevice[i];
+ // GC pad-compatible devices can be used for both playing and recording
+ if (SIDevice_IsGCController(current))
+ AddDevice(Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : current, i);
+ else
+ AddDevice(Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER, i);
+ }
+ else
+ {
+ AddDevice(SIDEVICE_NONE, i);
+ }
+ }
else if (!NetPlay::IsNetPlayRunning())
+ {
AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
+ }
}
g_Poll.Hex = 0;
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<ISIDevice> 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<ISIDevice> SIDevice_Create(const SIDevices device, const int port_number);
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp
index f76b097aa1..13eb60f45e 100644
--- a/Source/Core/Core/NetPlayClient.cpp
+++ b/Source/Core/Core/NetPlayClient.cpp
@@ -765,10 +765,10 @@ void NetPlayClient::UpdateDevices()
// so they should be added first.
for (auto player_id : m_pad_map)
{
- // Use local controller types for local controllers
+ // Use local controller types for local controllers if they are compatible
if (player_id == m_local_player->pid)
{
- if (SConfig::GetInstance().m_SIDevice[local_pad] != SIDEVICE_NONE)
+ if (SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[local_pad]))
{
SerialInterface::AddDevice(SConfig::GetInstance().m_SIDevice[local_pad], local_pad);
}
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index db0acc7fe0..45a9c397be 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -797,7 +797,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
for (int i = 0; i < 4; i++)
{
- if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
+ if (SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
controllers |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)