Merge branch 'multi-tas-input'

This commit is contained in:
Rachel Bryk 2013-07-23 20:44:21 -04:00
commit 7a6eeb5fbd
4 changed files with 32 additions and 11 deletions

View File

@ -327,7 +327,11 @@ CFrame::CFrame(wxFrame* parent,
m_LogWindow->Hide(); m_LogWindow->Hide();
m_LogWindow->Disable(); m_LogWindow->Disable();
g_TASInputDlg = 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); Movie::SetInputManip(TASManipFunction);
State::SetOnAfterLoadCallback(OnAfterLoadCallback); State::SetOnAfterLoadCallback(OnAfterLoadCallback);
@ -794,13 +798,24 @@ void OnAfterLoadCallback()
void TASManipFunction(SPADStatus *PadStatus, int controllerID) void TASManipFunction(SPADStatus *PadStatus, int controllerID)
{ {
if (main_frame) if (main_frame)
main_frame->g_TASInputDlg->GetValues(PadStatus, controllerID); main_frame->g_TASInputDlg[controllerID]->GetValues(PadStatus, controllerID);
} }
bool TASInputHasFocus()
{
for (int i = 0; i < 4; i++)
{
if (main_frame->g_TASInputDlg[i]->HasFocus())
return true;
}
return false;
}
void CFrame::OnKeyDown(wxKeyEvent& event) void CFrame::OnKeyDown(wxKeyEvent& event)
{ {
if(Core::GetState() != Core::CORE_UNINITIALIZED && if(Core::GetState() != Core::CORE_UNINITIALIZED &&
(RendererHasFocus() || g_TASInputDlg->HasFocus())) (RendererHasFocus() || TASInputHasFocus()))
{ {
int WiimoteId = -1; int WiimoteId = -1;
// Toggle fullscreen // Toggle fullscreen
@ -834,7 +849,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
else else
{ {
unsigned int i = NUM_HOTKEYS; 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++) for (i = 0; i < NUM_HOTKEYS; i++)
{ {

View File

@ -110,7 +110,7 @@ public:
CCodeWindow* g_pCodeWindow; CCodeWindow* g_pCodeWindow;
NetPlaySetupDiag* g_NetPlaySetupDiag; NetPlaySetupDiag* g_NetPlaySetupDiag;
wxCheatsWindow* g_CheatsWindow; wxCheatsWindow* g_CheatsWindow;
TASInputDlg* g_TASInputDlg; TASInputDlg* g_TASInputDlg[4];
void InitBitmaps(); void InitBitmaps();
void DoPause(); void DoPause();
@ -349,6 +349,7 @@ void OnAfterLoadCallback();
// For TASInputDlg // For TASInputDlg
void TASManipFunction(SPADStatus *PadStatus, int controllerID); void TASManipFunction(SPADStatus *PadStatus, int controllerID);
bool TASInputHasFocus();
#endif // __FRAME_H_ #endif // __FRAME_H_

View File

@ -647,7 +647,16 @@ void CFrame::OnRecordReadOnly(wxCommandEvent& event)
void CFrame::OnTASInput(wxCommandEvent& event) void CFrame::OnTASInput(wxCommandEvent& event)
{ {
g_TASInputDlg->Show(true); std::string number[4] = {"1","2","3","4"};
for (int i = 0; i < 4; ++i)
{
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
{
g_TASInputDlg[i]->Show(true);
g_TASInputDlg[i]->SetTitle("TAS Input - Controller " + number[i]);
}
}
} }
void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event)) void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event))

View File

@ -459,10 +459,6 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID)
GetKeyBoardInput(PadStatus); GetKeyBoardInput(PadStatus);
SetLandRTriggers(); SetLandRTriggers();
// TODO: implement support for more controllers
if (controllerID != 0)
return;
PadStatus->stickX = mainX; PadStatus->stickX = mainX;
PadStatus->stickY = mainY; PadStatus->stickY = mainY;
PadStatus->substickX = cX; PadStatus->substickX = cX;