From 59d6df7046b1ed1137d28da02aec3809e3e6439c Mon Sep 17 00:00:00 2001 From: Braden Date: Sun, 11 Nov 2012 15:35:08 -0600 Subject: Adds Support for multiple GameCube Controllers Conflicts: Source/Core/DolphinWX/Src/Frame.cpp --- Source/Core/DolphinWX/Src/Frame.cpp | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'Source/Core/DolphinWX/Src/Frame.cpp') diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index aaa16d80cb..287bb6b2f3 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -328,6 +328,10 @@ CFrame::CFrame(wxFrame* parent, m_LogWindow->Disable(); g_TASInputDlg = new TASInputDlg(this); + g_TASInputDlg1 = new TASInputDlg(this); + g_TASInputDlg2 = new TASInputDlg(this); + g_TASInputDlg3 = new TASInputDlg(this); + Movie::SetInputManip(TASManipFunction); State::SetOnAfterLoadCallback(OnAfterLoadCallback); @@ -793,14 +797,41 @@ void OnAfterLoadCallback() void TASManipFunction(SPADStatus *PadStatus, int controllerID) { - if (main_frame) + if (main_frame && controllerID == 0) main_frame->g_TASInputDlg->GetValues(PadStatus, controllerID); + + if (main_frame && controllerID == 1) + main_frame->g_TASInputDlg1->GetValues(PadStatus, controllerID); + + if (main_frame && controllerID == 2) + main_frame->g_TASInputDlg2->GetValues(PadStatus, controllerID); + + if (main_frame && controllerID == 3) + main_frame->g_TASInputDlg3->GetValues(PadStatus, controllerID); } +bool TASInputHasFocus() +{ + if(main_frame->g_TASInputDlg->HasFocus()) + return true; + + if(main_frame->g_TASInputDlg1->HasFocus()) + return true; + + if(main_frame->g_TASInputDlg2->HasFocus()) + return true; + + if(main_frame->g_TASInputDlg3->HasFocus()) + return true; + + return false; +} + + void CFrame::OnKeyDown(wxKeyEvent& event) { if(Core::GetState() != Core::CORE_UNINITIALIZED && - (RendererHasFocus() || g_TASInputDlg->HasFocus())) + (RendererHasFocus() || TASInputHasFocus())) { int WiimoteId = -1; // Toggle fullscreen @@ -834,7 +865,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event) else { unsigned int i = NUM_HOTKEYS; - if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || g_TASInputDlg->HasFocus()) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || TASInputHasFocus()) { for (i = 0; i < NUM_HOTKEYS; i++) { -- cgit v1.2.3 From ec148008d0638ea4eafffd6bf95706e8d3507c5e Mon Sep 17 00:00:00 2001 From: Braden Date: Sun, 11 Nov 2012 16:38:01 -0600 Subject: Clean up code for multiple GameCube Controllers Conflicts: Source/Core/DolphinWX/Src/Frame.cpp Source/Core/DolphinWX/Src/FrameTools.cpp --- Source/Core/DolphinWX/Src/Frame.cpp | 44 ++++++++++++------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'Source/Core/DolphinWX/Src/Frame.cpp') diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 287bb6b2f3..af71066314 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -327,11 +327,11 @@ CFrame::CFrame(wxFrame* parent, m_LogWindow->Hide(); m_LogWindow->Disable(); - g_TASInputDlg = new TASInputDlg(this); - g_TASInputDlg1 = new TASInputDlg(this); - g_TASInputDlg2 = new TASInputDlg(this); - g_TASInputDlg3 = new TASInputDlg(this); - + g_TASInputDlg[0] = new TASInputDlg(this); + g_TASInputDlg[1] = new TASInputDlg(this); + g_TASInputDlg[2] = new TASInputDlg(this); + g_TASInputDlg[3] = new TASInputDlg(this); + Movie::SetInputManip(TASManipFunction); State::SetOnAfterLoadCallback(OnAfterLoadCallback); @@ -788,7 +788,7 @@ int GetCmdForHotkey(unsigned int key) void OnAfterLoadCallback() { // warning: this gets called from the CPU thread, so we should only queue things to do on the proper thread - if(main_frame) + if (main_frame) { wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI); main_frame->GetEventHandler()->AddPendingEvent(event); @@ -797,34 +797,18 @@ void OnAfterLoadCallback() void TASManipFunction(SPADStatus *PadStatus, int controllerID) { - if (main_frame && controllerID == 0) - main_frame->g_TASInputDlg->GetValues(PadStatus, controllerID); - - if (main_frame && controllerID == 1) - main_frame->g_TASInputDlg1->GetValues(PadStatus, controllerID); - - if (main_frame && controllerID == 2) - main_frame->g_TASInputDlg2->GetValues(PadStatus, controllerID); - - if (main_frame && controllerID == 3) - main_frame->g_TASInputDlg3->GetValues(PadStatus, controllerID); + if (main_frame) + main_frame->g_TASInputDlg[controllerID]->GetValues(PadStatus, controllerID); } bool TASInputHasFocus() { - if(main_frame->g_TASInputDlg->HasFocus()) - return true; - - if(main_frame->g_TASInputDlg1->HasFocus()) - return true; - - if(main_frame->g_TASInputDlg2->HasFocus()) - return true; - - if(main_frame->g_TASInputDlg3->HasFocus()) - return true; - - return false; + for (int i = 0; i < 4; i++) + { + if (main_frame->g_TASInputDlg[i]->HasFocus()) + return true; + } + return false; } -- cgit v1.2.3