2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2009-07-05 04:29:00 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include "wiimote_hid.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "ConfigRecordingDlg.h"
|
|
|
|
#include "ConfigBasicDlg.h"
|
|
|
|
#include "Config.h"
|
|
|
|
#include "EmuMain.h" // for LoadRecordedMovements()
|
2010-01-08 20:27:54 +00:00
|
|
|
#include "wiimote_real.h"
|
|
|
|
|
2009-07-05 04:29:00 +00:00
|
|
|
|
2009-07-06 00:27:32 +00:00
|
|
|
BEGIN_EVENT_TABLE(WiimoteRecordingConfigDialog,wxDialog)
|
2009-07-05 04:29:00 +00:00
|
|
|
EVT_CLOSE(WiimoteRecordingConfigDialog::OnClose)
|
2010-02-25 06:12:35 +00:00
|
|
|
EVT_BUTTON(wxID_CLOSE, WiimoteRecordingConfigDialog::CloseClick)
|
|
|
|
EVT_BUTTON(wxID_APPLY, WiimoteRecordingConfigDialog::CloseClick)
|
2009-07-05 04:29:00 +00:00
|
|
|
|
|
|
|
EVT_CHOICE(IDC_RECORD + 1, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 2, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 3, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 4, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 5, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 6, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 7, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 8, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 9, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 10, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 11, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 12, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 13, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 14, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_CHOICE(IDC_RECORD + 15, WiimoteRecordingConfigDialog::RecordingChanged)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 1, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 2, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 3, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 4, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 5, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 6, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 7, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 8, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 9, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 10, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 11, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 12, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 13, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 14, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_BUTTON(IDB_RECORD + 15, WiimoteRecordingConfigDialog::RecordMovement)
|
|
|
|
EVT_TIMER(IDTM_UPDATE, WiimoteRecordingConfigDialog::Update)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
WiimoteRecordingConfigDialog::WiimoteRecordingConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
|
|
|
|
const wxPoint &position, const wxSize& size, long style)
|
2010-02-25 06:12:35 +00:00
|
|
|
: wxDialog(parent, id, title, position, size, style)
|
2009-07-05 04:29:00 +00:00
|
|
|
{
|
2009-07-08 07:16:26 +00:00
|
|
|
#if wxUSE_TIMER
|
|
|
|
m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_bWaitForRecording = false;
|
|
|
|
m_bRecording = false;
|
|
|
|
|
2009-07-05 04:29:00 +00:00
|
|
|
m_vRecording.resize(RECORDING_ROWS + 1);
|
|
|
|
|
|
|
|
g_Config.Load();
|
|
|
|
CreateGUIControlsRecording();
|
|
|
|
SetBackgroundColour(m_PageRecording->GetBackgroundColour());
|
|
|
|
LoadFile();
|
|
|
|
// Set control values
|
|
|
|
UpdateRecordingGUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WiimoteRecordingConfigDialog::OnClose(wxCloseEvent& event)
|
|
|
|
{
|
|
|
|
SaveFile();
|
2009-11-29 17:58:52 +00:00
|
|
|
EndModal(wxID_CLOSE);
|
2009-07-05 04:29:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WiimoteRecordingConfigDialog::CloseClick(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch(event.GetId())
|
|
|
|
{
|
2010-02-25 06:12:35 +00:00
|
|
|
case wxID_CLOSE:
|
2010-02-21 18:53:11 +00:00
|
|
|
#if HAVE_WIIUSE
|
|
|
|
if (!WiiMoteReal::SafeClose())
|
|
|
|
#endif
|
2010-01-09 17:11:59 +00:00
|
|
|
Close();
|
2009-07-05 04:29:00 +00:00
|
|
|
break;
|
2010-02-25 06:12:35 +00:00
|
|
|
case wxID_APPLY:
|
2009-07-05 04:29:00 +00:00
|
|
|
SaveFile();
|
|
|
|
WiiMoteEmu::LoadRecordedMovements();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WiimoteRecordingConfigDialog::RecordingChanged(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case ID_UPDATE_REAL:
|
|
|
|
g_Config.bUpdateRealWiimote = m_UpdateMeters->IsChecked();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Check if any of the other choice boxes has the same hotkey
|
|
|
|
for (int i = 1; i < (RECORDING_ROWS + 1); i++)
|
|
|
|
{
|
|
|
|
int CurrentChoiceBox = (event.GetId() - IDC_RECORD);
|
|
|
|
if (i == CurrentChoiceBox) continue;
|
|
|
|
if (m_RecordHotKeyWiimote[i]->GetSelection() == m_RecordHotKeyWiimote[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyWiimote[i]->SetSelection(10);
|
|
|
|
if (m_RecordHotKeyNunchuck[i]->GetSelection() == m_RecordHotKeyNunchuck[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyNunchuck[i]->SetSelection(10);
|
|
|
|
if (m_RecordHotKeyIR[i]->GetSelection() == m_RecordHotKeyIR[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyIR[i]->SetSelection(10);
|
|
|
|
|
2009-09-15 02:12:55 +00:00
|
|
|
//DEBUG_LOG(WIIMOTE, "HotKey: %i %i",
|
2009-07-05 04:29:00 +00:00
|
|
|
// m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_Config.Save();
|
|
|
|
UpdateRecordingGUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WiimoteRecordingConfigDialog::UpdateRecordingGUI(int Slot)
|
|
|
|
{
|
|
|
|
// Disable all recording buttons
|
|
|
|
#ifdef _WIN32
|
2010-03-07 22:48:37 +00:00
|
|
|
bool ActiveRecording = !(m_bWaitForRecording || m_bRecording);
|
2009-07-05 04:29:00 +00:00
|
|
|
for(int i = IDB_RECORD + 1; i < (IDB_RECORD + RECORDING_ROWS + 1); i++)
|
|
|
|
if(ControlsCreated) m_PageRecording->FindItem(i)->Enable(ActiveRecording);
|
|
|
|
#endif
|
|
|
|
}
|