Merge pull request #3589 from mathieui/gcadapter-recording

Fix recording a movie with the GC Adapter
This commit is contained in:
Pierre Bourdon 2016-03-03 02:02:29 +01:00
commit f752c6e704
5 changed files with 42 additions and 4 deletions

View file

@ -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;

View file

@ -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)
{

View file

@ -107,4 +107,6 @@ public:
}
};
bool SIDevice_IsGCController(SIDevices type);
std::unique_ptr<ISIDevice> SIDevice_Create(const SIDevices device, const int port_number);

View file

@ -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);
}

View file

@ -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)