diff --git a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj
index 918bc36ffc..ea5169c6e1 100644
--- a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj
+++ b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj
@@ -525,18 +525,6 @@
-
-
-
-
-
-
@@ -621,21 +609,44 @@
>
+
+
+
+
+
+
+
+
+
+
+
IsShown()) || (m_RecordingConfigFrame && m_RecordingConfigFrame->IsShown()))
+ {
+ Closing = false;
+ Hide();
+ }
+ else
+ {
+ Closing = true;
+ if (m_PadConfigFrame)
+ {
+ m_PadConfigFrame->Close();
+ m_PadConfigFrame = NULL;
+ }
+ if (m_RecordingConfigFrame)
+ {
+ m_RecordingConfigFrame->Close();
+ m_RecordingConfigFrame = NULL;
+ }
+
+ if (!g_EmulatorRunning) Shutdown();
+ }
+ // This will let the Close() function close and remove the wxDialog
+ event.Skip();
+}
+
+/* Timeout the shutdown. In Windows at least the g_pReadThread execution will hang at any attempt to
+ call a frame function after the main thread has entered WaitForSingleObject() or any other loop.
+ We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */
+void WiimoteBasicConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event))
+{
+ // Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy().
+ if(!WiiMoteReal::g_ThreadGoing)
+ {
+ m_ShutDownTimer->Stop();
+ Close();
+ }
+}
+
+void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
+{
+ switch(event.GetId())
+ {
+ case ID_CLOSE:
+ // Wait for the Wiimote thread to stop, then close and shutdown
+ if(!g_EmulatorRunning)
+ {
+ WiiMoteReal::g_Shutdown = true;
+ m_ShutDownTimer->Start(10);
+ }
+ // Close directly
+ else
+ {
+ Close();
+ }
+ break;
+ case ID_APPLY:
+ g_Config.Save();
+ break;
+ case ID_BUTTONMAPPING:
+ if (!m_PadConfigFrame)
+ m_PadConfigFrame = new WiimotePadConfigDialog(this);
+ if (!m_PadConfigFrame->IsShown())
+ m_PadConfigFrame->Show();
+ break;
+ case ID_BUTTONRECORDING:
+ if (!m_RecordingConfigFrame)
+ m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this);
+
+ if (!m_RecordingConfigFrame->IsShown())
+ m_RecordingConfigFrame->Show();
+ break;
+ }
+}
+
+
+// Execute a delayed function
+void WiimoteBasicConfigDialog::UpdateOnce(wxTimerEvent& event)
+{
+ switch(event.GetId())
+ {
+ case IDTM_UPDATE_ONCE:
+ // Reenable the checkbox
+ m_bEnableUseRealWiimote = true;
+ SetCursor(wxCursor(wxCURSOR_ARROW));
+ UpdateGUI();
+ break;
+ }
+}
+
+void WiimoteBasicConfigDialog::CreateGUIControls()
+{
+ m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
+
+ for (int i = 0; i < MAX_WIIMOTES; i++)
+ {
+ m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize);
+ m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1));
+
+ m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_CONNECT_REAL, wxT("Connect Real Wiimote"));
+ m_UseRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_USE_REAL, wxT("Use Real Wiimote"));
+
+ m_ConnectRealWiimote[0]->SetValue(g_Config.bConnectRealWiimote);
+ m_UseRealWiimote[0]->SetValue(g_Config.bUseRealWiimote);
+
+ m_ConnectRealWiimote[i]->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay."));
+ m_UseRealWiimote[i]->SetToolTip(wxT("Use the real Wiimote in the game. This can be changed during gameplay. This can not be selected"
+ " when a recording is to be done. No status in this window will be updated when this is checked."));
+
+ m_SizeReal[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Real Wiimote"));
+ m_SizeReal[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5);
+ m_SizeReal[i]->Add(m_UseRealWiimote[i], 0, wxEXPAND | wxALL, 5);
+
+ m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Wii Motion Plus Connected"));
+ m_WiiMotionPlusConnected[0]->Enable(false);
+
+ wxArrayString arrayStringFor_extension;
+ arrayStringFor_extension.Add(wxT("None"));
+ arrayStringFor_extension.Add(wxT("Nunchuck"));
+ arrayStringFor_extension.Add(wxT("Classic Controller"));
+ arrayStringFor_extension.Add(wxT("Guitar Hero 3 Guitar"));
+ //arrayStringFor_extension.Add(wxT("Guitar Hero World Tour Drums Connected"));
+ // Prolly needs to be a separate plugin
+ //arrayStringFor_extension.Add(wxT("Balance Board"));
+
+ extensionChoice[i] = new wxChoice(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator);
+ extensionChoice[i]->SetSelection(0);
+
+ m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension"));
+ m_SizeExtensions[i]->Add(m_WiiMotionPlusConnected[i], 0, wxEXPAND | wxALL, 5);
+ m_SizeExtensions[i]->Add(extensionChoice[i], 0, wxEXPAND | wxALL, 5);
+
+ m_SizeBasicGeneralLeft[i] = new wxBoxSizer(wxVERTICAL);
+ m_SizeBasicGeneralLeft[i]->Add(m_SizeReal[i], 0, wxEXPAND | wxALL, 5);
+ m_SizeBasicGeneralLeft[i]->Add(m_SizeExtensions[i], 0, wxEXPAND | wxALL, 5);
+
+ // Basic Settings
+ m_WiimoteOnline[i] = new wxCheckBox(m_Controller[i], IDC_WIMOTE_ON, wxT("Wiimote On"));
+ m_WiimoteOnline[i]->SetValue(true);
+ m_WiimoteOnline[i]->Enable(false);
+ m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i));
+
+ m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("General Settings"));
+ m_SizeBasic[i]->Add(m_WiimoteOnline[i], 0, wxEXPAND | wxALL, 5);
+
+ // Emulated Wiimote
+ m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad"));
+ m_SidewaysDPad[i]->SetValue(g_Config.bSidewaysDPad);
+
+ m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
+ m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5);
+
+ //IR Pointer
+ m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000"));
+ m_TextScreenHeight[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Height: 000"));
+ m_TextScreenLeft[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: 000"));
+ m_TextScreenTop[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Top: 000"));
+
+ m_SliderWidth[i] = new wxSlider(m_Controller[i], IDS_WIDTH, 0, 100, 923, wxDefaultPosition, wxSize(75, -1));
+ m_SliderHeight[i] = new wxSlider(m_Controller[i], IDS_HEIGHT, 0, 0, 727, wxDefaultPosition, wxSize(75, -1));
+ m_SliderLeft[i] = new wxSlider(m_Controller[i], IDS_LEFT, 0, 100, 500, wxDefaultPosition, wxSize(75, -1));
+ m_SliderTop[i] = new wxSlider(m_Controller[i], IDS_TOP, 0, 0, 500, wxDefaultPosition, wxSize(75, -1));
+
+ m_SizerIRPointerWidth[i] = new wxBoxSizer(wxHORIZONTAL);
+ m_SizerIRPointerWidth[i]->Add(m_TextScreenLeft[i], 0, wxEXPAND | (wxTOP), 3);
+ m_SizerIRPointerWidth[i]->Add(m_SliderLeft[i], 0, wxEXPAND | (wxRIGHT), 0);
+ m_SizerIRPointerWidth[i]->Add(m_TextScreenWidth[i], 0, wxEXPAND | (wxTOP), 3);
+ m_SizerIRPointerWidth[i]->Add(m_SliderWidth[i], 0, wxEXPAND | (wxLEFT), 0);
+ m_SizerIRPointerHeight[i] = new wxBoxSizer(wxHORIZONTAL);
+ m_SizerIRPointerHeight[i]->Add(m_TextScreenTop[i], 0, wxEXPAND | (wxTOP), 3);
+ m_SizerIRPointerHeight[i]->Add(m_SliderTop[i], 0, wxEXPAND | (wxRIGHT), 0);
+ m_SizerIRPointerHeight[i]->Add(m_TextScreenHeight[i], 0, wxEXPAND | (wxTOP), 3);
+ m_SizerIRPointerHeight[i]->Add(m_SliderHeight[i], 0, wxEXPAND | (wxLEFT), 0);
+
+ //m_ScreenSize = new wxCheckBox(m_Controller[i], IDC_SCREEN_SIZE, wxT("Adjust screen size and position"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ //m_ScreenSize[i]->SetToolTip(wxT("Use the adjusted screen size."));
+
+ // These are changed from the graphics plugin settings, so they are just here to show the loaded status
+ m_TextAR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Aspect Ratio"));
+ m_CheckAR43[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("4:3"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
+ m_CheckAR169[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("16:9"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
+ m_Crop[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Crop"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
+
+ m_CheckAR43[i]->SetValue(g_Config.bKeepAR43);
+ m_CheckAR169[i]->SetValue(g_Config.bKeepAR169);
+ m_Crop[i]->SetValue(g_Config.bCrop);
+
+ m_TextAR[i]->Enable(false);
+ m_CheckAR43[i]->Enable(false);
+ m_CheckAR169[i]->Enable(false);
+ m_Crop[i]->Enable(false);
+
+ m_SizerIRPointerScreen[i] = new wxBoxSizer(wxHORIZONTAL);
+ m_SizerIRPointerScreen[i]->Add(m_TextAR[i], 0, wxEXPAND | (wxTOP), 0);
+ m_SizerIRPointerScreen[i]->Add(m_CheckAR43[i], 0, wxEXPAND | (wxLEFT), 5);
+ m_SizerIRPointerScreen[i]->Add(m_CheckAR169[i], 0, wxEXPAND | (wxLEFT), 5);
+ m_SizerIRPointerScreen[i]->Add(m_Crop[i], 0, wxEXPAND | (wxLEFT), 5);
+
+ m_SizerIRPointer[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("IR pointer"));
+ //m_SizerIRPointer[i]->Add(m_ScreenSize[i], 0, wxEXPAND | (wxALL), 5);
+ m_SizerIRPointer[i]->Add(m_SizerIRPointerWidth[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
+ m_SizerIRPointer[i]->Add(m_SizerIRPointerHeight[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
+ m_SizerIRPointer[i]->Add(m_SizerIRPointerScreen[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
+
+ m_SizeBasicGeneralRight[i] = new wxBoxSizer(wxVERTICAL);
+ m_SizeBasicGeneralRight[i]->Add(m_SizeBasic[i], 0, wxEXPAND | (wxUP), 0);
+ m_SizeBasicGeneralRight[i]->Add(m_SizeEmu[i], 0, wxEXPAND | (wxUP), 5);
+ m_SizeBasicGeneralRight[i]->Add(m_SizerIRPointer[i], 0, wxEXPAND | (wxUP), 5);
+
+ m_SizeBasicGeneral[i] = new wxBoxSizer(wxHORIZONTAL);
+ m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralLeft[i], 0, wxEXPAND | (wxUP), 0);
+ m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralRight[i], 0, wxEXPAND | (wxLEFT), 5);
+
+ m_SizeParent[i] = new wxBoxSizer(wxVERTICAL);
+ m_SizeParent[i]->Add(m_SizeBasicGeneral[i], 0, wxBORDER_STATIC | wxEXPAND | (wxALL), 5);
+ // The sizer m_sMain will be expanded inside m_Controller, m_SizeParent will not
+ m_sMain[i] = new wxBoxSizer(wxVERTICAL);
+ m_sMain[i]->Add(m_SizeParent[i]);
+
+ // Set the main sizer
+ m_Controller[i]->SetSizer(m_sMain[i]);
+ }
+
+ m_ButtonMapping = new wxButton(this, ID_BUTTONMAPPING, wxT("Button Mapping"));
+ m_Recording = new wxButton(this, ID_BUTTONRECORDING, wxT("Recording"));
+ m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
+ m_Close->SetToolTip(wxT("Apply and Close"));
+
+ wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
+ sButtons->Add(m_ButtonMapping, 0, (wxALL), 0);
+ sButtons->Add(m_Recording, 0, (wxALL), 0);
+ sButtons->AddStretchSpacer();
+ sButtons->Add(m_Apply, 0, (wxALL), 0);
+ sButtons->Add(m_Close, 0, (wxLEFT), 5);
+
+ m_MainSizer = new wxBoxSizer(wxVERTICAL);
+ m_MainSizer->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
+ m_MainSizer->Add(sButtons, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
+
+ this->SetSizer(m_MainSizer);
+ this->Layout();
+ Fit();
+
+ // Center the window if there is room for it
+ #ifdef _WIN32
+ if (GetSystemMetrics(SM_CYFULLSCREEN) > 800)
+ Center();
+ #endif
+ ControlsCreated = true;
+}
+
+void WiimoteBasicConfigDialog::DoConnectReal()
+{
+ g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked();
+
+ if(g_Config.bConnectRealWiimote)
+ {
+ if (!g_RealWiiMoteInitialized) WiiMoteReal::Initialize();
+ }
+ else
+ {
+ INFO_LOG(CONSOLE, "Post Message: %i\n", g_RealWiiMoteInitialized);
+ if (g_RealWiiMoteInitialized)
+ {
+ WiiMoteReal::Shutdown();
+ }
+ }
+}
+
+void WiimoteBasicConfigDialog::DoUseReal()
+{
+ // Clear any eventual events in the Wiimote queue
+ WiiMoteReal::ClearEvents();
+
+ // Are we using an extension now? The report that it's removed, then reconnected.
+ bool UsingExtension = false;
+ if (g_Config.iExtensionConnected != EXT_NONE)
+ UsingExtension = true;
+
+ INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension);
+ DoExtensionConnectedDisconnected(UsingExtension ? 0 : 1);
+
+ UsingExtension = !UsingExtension;
+ INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension);
+ DoExtensionConnectedDisconnected(UsingExtension ? 1 : 0);
+
+ if(g_EmulatorRunning)
+ {
+ // Disable the checkbox for a moment
+ SetCursor(wxCursor(wxCURSOR_WAIT));
+ m_bEnableUseRealWiimote = false;
+ // We may not need this if there is already a message queue that allows the nessesary timeout
+ //sleep(100);
+
+ /* Start the timer to allow the approximate time it takes for the Wiimote to come online
+ it would simpler to use sleep(1000) but that doesn't work because we need the functions in main.cpp
+ to work */
+ m_TimeoutOnce->Start(1000, true);
+ }
+}
+
+// ===================================================
+/* Generate connect/disconnect status event */
+// ----------------
+void WiimoteBasicConfigDialog::DoExtensionConnectedDisconnected(int Extension)
+{
+ // There is no need for this if no game is running
+ if(!g_EmulatorRunning) return;
+
+ u8 DataFrame[8]; // make a blank report for it
+ wm_request_status *rs = (wm_request_status*)DataFrame;
+
+ // Check if a game is running, in that case change the status
+ if(WiiMoteEmu::g_ReportingChannel > 0)
+ WiiMoteEmu::WmRequestStatus(WiiMoteEmu::g_ReportingChannel, rs, Extension);
+}
+
+
+void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
+{
+ switch (event.GetId())
+ {
+ case ID_CONNECT_REAL:
+ DoConnectReal();
+ break;
+ case ID_USE_REAL:
+ // Enable the Wiimote thread
+ g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked();
+ if(g_Config.bUseRealWiimote) DoUseReal();
+ break;
+
+ case ID_SIDEWAYSDPAD:
+ g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked();
+ break;
+
+ case ID_MOTIONPLUSCONNECTED:
+ break;
+ case ID_EXTCONNECTED:
+ g_Config.iExtensionConnected = EXT_NONE;
+ // Disconnect the extension so that the game recognize the change
+ DoExtensionConnectedDisconnected();
+ // It doesn't seem to be needed but shouldn't it at least take 25 ms to
+ // reconnect an extension after we disconnected another?
+ if(g_EmulatorRunning) SLEEP(25);
+
+ // Update status
+ g_Config.iExtensionConnected = extensionChoice[Page]->GetSelection();
+
+ // Copy the calibration data
+ WiiMoteEmu::SetDefaultExtensionRegistry();
+
+ // Generate connect/disconnect status event
+ DoExtensionConnectedDisconnected();
+ break;
+ }
+ g_Config.Save();
+ UpdateGUI();
+}
+
+void WiimoteBasicConfigDialog::IRCursorChanged(wxScrollEvent& event)
+{
+ switch (event.GetId())
+ {
+ case IDS_WIDTH:
+ g_Config.iIRWidth = m_SliderWidth[Page]->GetValue();
+ break;
+ case IDS_HEIGHT:
+ g_Config.iIRHeight = m_SliderHeight[Page]->GetValue();
+ break;
+ case IDS_LEFT:
+ g_Config.iIRLeft = m_SliderLeft[Page]->GetValue();
+ break;
+ case IDS_TOP:
+ g_Config.iIRTop = m_SliderTop[Page]->GetValue();
+ break;
+ }
+
+ UpdateGUI();
+}
+
+void WiimoteBasicConfigDialog::UpdateIRCalibration()
+{
+ // Update the slider position if a configuration has been loaded
+ m_SliderWidth[Page]->SetValue(g_Config.iIRWidth);
+ m_SliderHeight[Page]->SetValue(g_Config.iIRHeight);
+ m_SliderLeft[Page]->SetValue(g_Config.iIRLeft);
+ m_SliderTop[Page]->SetValue(g_Config.iIRTop);
+
+ // Update the labels
+ m_TextScreenWidth[Page]->SetLabel(wxString::Format(wxT("Width: %i"), g_Config.iIRWidth));
+ m_TextScreenHeight[Page]->SetLabel(wxString::Format(wxT("Height: %i"), g_Config.iIRHeight));
+ m_TextScreenLeft[Page]->SetLabel(wxString::Format(wxT("Left: %i"), g_Config.iIRLeft));
+ m_TextScreenTop[Page]->SetLabel(wxString::Format(wxT("Top: %i"), g_Config.iIRTop));
+}
+
+void WiimoteBasicConfigDialog::UpdateGUI(int Slot)
+{
+ // Update the Wiimote IR pointer calibration
+ UpdateIRCalibration();
+
+ /* We only allow a change of extension if we are not currently using the real Wiimote, if it's in use the status will be updated
+ from the data scanning functions in main.cpp */
+ bool AllowExtensionChange = !(g_RealWiiMotePresent && g_Config.bConnectRealWiimote && g_Config.bUseRealWiimote && g_EmulatorRunning);
+ extensionChoice[Page]->SetSelection(g_Config.iExtensionConnected);
+ extensionChoice[Page]->Enable(AllowExtensionChange);
+
+ /* I have disabled this option during a running game because it's enough to be able to switch
+ between using and not using then. To also use the connect option during a running game would
+ mean that the wiimote must be sent the current reporting mode and the channel ID after it
+ has been initialized. Functions for that are basically already in place so these two options
+ could possibly be simplified to one option. */
+ m_ConnectRealWiimote[Page]->Enable(!g_EmulatorRunning);
+ m_UseRealWiimote[Page]->Enable((m_bEnableUseRealWiimote && g_RealWiiMotePresent && g_Config.bConnectRealWiimote) || (!g_EmulatorRunning && g_Config.bConnectRealWiimote));
+}
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h
new file mode 100644
index 0000000000..f67799c843
--- /dev/null
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h
@@ -0,0 +1,156 @@
+// Copyright (C) 2003-2009 Dolphin Project.
+
+// 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/
+
+#ifndef __BASICCONFIGDIALOG_h__
+#define __BASICCONFIGDIALOG_h__
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class WiimoteBasicConfigDialog : public wxDialog
+{
+ public:
+ WiimoteBasicConfigDialog(wxWindow *parent,
+ wxWindowID id = 1,
+ const wxString &title = wxT("Wii Remote Plugin Configuration"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
+ virtual ~WiimoteBasicConfigDialog();
+
+ // General open, close and event functions
+ void ButtonClick(wxCommandEvent& event);
+ void UpdateGUI(int Slot = 0);
+ void UpdateIRCalibration();
+ void ShutDown(wxTimerEvent& WXUNUSED(event));
+ void UpdateOnce(wxTimerEvent& event);
+
+ // Timers
+ wxTimer *m_TimeoutOnce,
+ *m_ShutDownTimer;
+ wxCheckBox *m_UseRealWiimote[4];
+
+ bool Closing;
+ private:
+ DECLARE_EVENT_TABLE();
+
+ bool ControlsCreated,
+ m_bEnableUseRealWiimote;
+ int Page;
+
+ wxNotebook *m_Notebook;
+ wxPanel *m_Controller[4];
+ wxButton *m_Close,
+ *m_Apply,
+ *m_ButtonMapping,
+ *m_Recording;
+
+ wxBoxSizer *m_MainSizer,
+ *m_sMain[4],
+ *m_SizeParent[4];
+
+ wxSlider *m_SliderWidth[4],
+ *m_SliderHeight[4],
+ *m_SliderLeft[4],
+ *m_SliderTop[4];
+
+ // Emulated Wiimote settings
+ wxCheckBox *m_SidewaysDPad[4],
+ *m_WiimoteOnline[4],
+ *m_WiiMotionPlusConnected[4],
+ *m_CheckAR43[4],
+ *m_CheckAR169[4],
+ *m_Crop[4];
+
+ wxStaticText *m_TextScreenWidth[4],
+ *m_TextScreenHeight[4],
+ *m_TextScreenLeft[4],
+ *m_TextScreenTop[4],
+ *m_TextAR[4];
+ wxBoxSizer *m_SizeBasicGeneral[4],
+ *m_SizeBasicGeneralLeft[4],
+ *m_SizeBasicGeneralRight[4],
+ *m_SizerIRPointerWidth[4],
+ *m_SizerIRPointerHeight[4],
+ *m_SizerIRPointerScreen[4];
+
+ wxStaticBoxSizer *m_SizeBasic[4],
+ *m_SizeEmu[4],
+ *m_SizeReal[4],
+ *m_SizeExtensions[4],
+ *m_SizerIRPointer[4];
+
+ wxChoice* extensionChoice[4];
+
+ // Real Wiimote settings
+ wxCheckBox *m_ConnectRealWiimote[4];
+
+ enum
+ {
+ ID_CLOSE = 1000,
+ ID_APPLY,
+ ID_BUTTONMAPPING,
+ ID_BUTTONRECORDING,
+ IDTM_SHUTDOWN,
+ IDTM_UPDATE,
+ IDTM_UPDATE_ONCE,
+
+ ID_NOTEBOOK,
+ ID_CONTROLLERPAGE1,
+ ID_CONTROLLERPAGE2,
+ ID_CONTROLLERPAGE3,
+ ID_CONTROLLERPAGE4,
+
+ // Emulated Wiimote
+ ID_SIDEWAYSDPAD,
+ ID_MOTIONPLUSCONNECTED,
+ ID_EXTCONNECTED,
+ IDC_WIMOTE_ON,
+
+ IDS_WIDTH,
+ IDS_HEIGHT,
+ IDS_LEFT,
+ IDS_TOP,
+
+ // Real
+ ID_CONNECT_REAL,
+ ID_USE_REAL,
+ };
+
+ void OnClose(wxCloseEvent& event);
+ void CreateGUIControls();
+ void GeneralSettingsChanged(wxCommandEvent& event);
+ void IRCursorChanged(wxScrollEvent& event);
+
+ void DoConnectReal(); // Real
+ void DoUseReal();
+
+ void DoExtensionConnectedDisconnected(int Extension = -1); // Emulated
+};
+
+extern WiimoteBasicConfigDialog *m_BasicConfigFrame;
+#endif
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp
index 28ccdfbbe6..73bf10ea56 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,11 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-//#include "Common.h" // for u16
#include "CommonTypes.h" // for u16
#include "IniFile.h"
#include "Timer.h"
@@ -27,21 +22,18 @@
#include "wiimote_real.h" // Local
#include "wiimote_hid.h"
#include "main.h"
-#include "ConfigDlg.h"
+#include "ConfigPadDlg.h"
#include "Config.h"
#include "EmuMain.h" // for LoadRecordedMovements()
#include "EmuSubroutines.h" // for WmRequestStatus
#include "EmuDefinitions.h" // for joyinfo
-//////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////////////////////
// Change Joystick
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
/* Function: When changing the joystick we save and load the settings and update the PadMapping
and PadState array. PadState[].joy is the gamepad handle that is used to access the pad throughout
the plugin. Joyinfo[].joy is only used the first time the pads are checked. */
-void WiimoteConfigDialog::DoChangeJoystick()
+void WiimotePadConfigDialog::DoChangeJoystick()
{
// Close the current pad, unless it's used by another slot
//if (PadMapping[notebookpage].enabled) PadClose(notebookpage);
@@ -56,7 +48,7 @@ void WiimoteConfigDialog::DoChangeJoystick()
// Open the new pad
if (WiiMoteEmu::PadMapping[Page].enabled) PadOpen(Page);
}
-void WiimoteConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
+void WiimotePadConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
{
// Check that we got a good pad
if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good)
@@ -69,13 +61,13 @@ void WiimoteConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID);
WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID);
}
-void WiimoteConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4
+void WiimotePadConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4
{
if (SDL_JoystickOpened(WiiMoteEmu::PadMapping[Close].ID)) SDL_JoystickClose(WiiMoteEmu::PadState[Close].joy);
WiiMoteEmu::PadState[Close].joy = NULL;
}
-void WiimoteConfigDialog::DoChangeDeadZone(bool Left)
+void WiimotePadConfigDialog::DoChangeDeadZone(bool Left)
{
if(Left)
{
@@ -104,7 +96,7 @@ void WiimoteConfigDialog::DoChangeDeadZone(bool Left)
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
// Set the button text for all four Wiimotes
-void WiimoteConfigDialog::SetButtonTextAll(int id, char text[128])
+void WiimotePadConfigDialog::SetButtonTextAll(int id, char text[128])
{
for (int i = 0; i < 1; i++)
{
@@ -116,7 +108,7 @@ void WiimoteConfigDialog::SetButtonTextAll(int id, char text[128])
}
-void WiimoteConfigDialog::SaveButtonMappingAll(int Slot)
+void WiimotePadConfigDialog::SaveButtonMappingAll(int Slot)
{
for (int i = 0; i < 4; i++)
{
@@ -129,7 +121,7 @@ void WiimoteConfigDialog::SaveButtonMappingAll(int Slot)
// Set dialog items from saved values
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-void WiimoteConfigDialog::UpdateGUIButtonMapping(int controller)
+void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
{
// Temporary storage
wxString tmp;
@@ -215,7 +207,7 @@ void WiimoteConfigDialog::UpdateGUIButtonMapping(int controller)
/* Populate the PadMapping array with the dialog items settings (for example
selected joystick, enabled or disabled status and so on) */
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-void WiimoteConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
+void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
{
// Temporary storage
wxString tmp;
@@ -263,7 +255,7 @@ void WiimoteConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, i
}
// Save keyboard key mapping
-void WiimoteConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
+void WiimotePadConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
{
switch(Id)
{
@@ -323,7 +315,7 @@ void WiimoteConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
// Replace the harder to understand -1 with "" for the sake of user friendliness
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-void WiimoteConfigDialog::ToBlank(bool ToBlank)
+void WiimotePadConfigDialog::ToBlank(bool ToBlank)
{
if (!ControlsCreated) return;
@@ -352,7 +344,7 @@ void WiimoteConfigDialog::ToBlank(bool ToBlank)
// Update the textbox for the buttons
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-void WiimoteConfigDialog::SetButtonText(int id, char text[128], int _Page)
+void WiimotePadConfigDialog::SetButtonText(int id, char text[128], int _Page)
{
// Set controller value
int controller;
@@ -424,7 +416,7 @@ void WiimoteConfigDialog::SetButtonText(int id, char text[128], int _Page)
// Get the text in the textbox for the buttons
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-wxString WiimoteConfigDialog::GetButtonText(int id, int _Page)
+wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page)
{
//INFO_LOG(CONSOLE, "GetButtonText: %i\n", id);
@@ -462,12 +454,12 @@ wxString WiimoteConfigDialog::GetButtonText(int id, int _Page)
is that we start another parallel loop (at least in Windows) that blocks the old loop. And our only
option to wait for the old loop to finish is with a new loop, and that will block the old loop for as
long as it's going on. Therefore a timer is easier to control. */
-void WiimoteConfigDialog::GetButtons(wxCommandEvent& event)
+void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event)
{
DoGetButtons(event.GetId());
}
-void WiimoteConfigDialog::DoGetButtons(int GetId)
+void WiimotePadConfigDialog::DoGetButtons(int GetId)
{
// =============================================
// Collect the starting values
@@ -642,7 +634,7 @@ void WiimoteConfigDialog::DoGetButtons(int GetId)
// ŻŻŻŻŻŻŻŻŻŻ
// Convert the 0x8000 range values to BoxW and BoxH for the plot
-void WiimoteConfigDialog::Convert2Box(int &x)
+void WiimotePadConfigDialog::Convert2Box(int &x)
{
// Border adjustment
int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2;
@@ -653,7 +645,7 @@ void WiimoteConfigDialog::Convert2Box(int &x)
// Update the input status boxes
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-void WiimoteConfigDialog::PadGetStatus()
+void WiimotePadConfigDialog::PadGetStatus()
{
//INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0));
@@ -819,7 +811,7 @@ void WiimoteConfigDialog::PadGetStatus()
// Populate the advanced tab
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-void WiimoteConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
+void WiimotePadConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
{
// Show the current status
/*
@@ -833,4 +825,4 @@ void WiimoteConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
PadGetStatus();
}
-/////////////////////////////////////////////////////
+
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp
similarity index 62%
rename from Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp
rename to Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp
index 16d129c5a1..6d988bfa17 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,214 +15,122 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-//#include "Common.h" // for u16
#include "CommonTypes.h" // for u16
#include "IniFile.h"
-#include "Timer.h"
#include "StringUtil.h"
#include "wiimote_real.h" // Local
#include "wiimote_hid.h"
#include "main.h"
-#include "ConfigDlg.h"
+#include "ConfigPadDlg.h"
+#include "ConfigBasicDlg.h"
#include "Config.h"
#include "EmuMain.h" // for LoadRecordedMovements()
#include "EmuSubroutines.h" // for WmRequestStatus
#include "EmuDefinitions.h" // for joyinfo
-//////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Variables
-// ----------------
-// Trigger Type
-enum
+enum TriggerType
{
- CTL_TRIGGER_SDL = 0, //
- CTL_TRIGGER_XINPUT // The XBox 360 pad
+ CTL_TRIGGER_SDL = 0,
+ CTL_TRIGGER_XINPUT
};
-//////////////////////////////////////
+BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxFrame)
+ EVT_CLOSE(WiimotePadConfigDialog::OnClose)
+ EVT_BUTTON(ID_CLOSE, WiimotePadConfigDialog::CloseClick)
+ EVT_BUTTON(ID_APPLY, WiimotePadConfigDialog::CloseClick)
-//////////////////////////////////////////////////////////////////////////////////////////
-// Event table
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-BEGIN_EVENT_TABLE(WiimoteConfigDialog,wxDialog)
- EVT_CLOSE(WiimoteConfigDialog::OnClose)
- EVT_BUTTON(ID_CLOSE, WiimoteConfigDialog::CloseClick)
- EVT_BUTTON(ID_APPLY, WiimoteConfigDialog::CloseClick)
- EVT_BUTTON(ID_ABOUTOGL, WiimoteConfigDialog::AboutClick)
-
- EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged)
-
- EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(ID_USE_REAL, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(ID_UPDATE_REAL, WiimoteConfigDialog::GeneralSettingsChanged)
-
- // Recording
- EVT_CHOICE(IDC_RECORD + 1, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 2, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 3, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 4, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 5, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 6, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 7, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 8, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 9, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 10, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 11, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 12, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 13, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 14, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHOICE(IDC_RECORD + 15, WiimoteConfigDialog::GeneralSettingsChanged)
-
- EVT_BUTTON(IDB_RECORD + 1, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 2, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 3, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 4, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 5, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 6, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 7, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 8, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 9, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 10, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 11, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 12, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 13, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 14, WiimoteConfigDialog::RecordMovement)
- EVT_BUTTON(IDB_RECORD + 15, WiimoteConfigDialog::RecordMovement)
-
- // Gamepad
- EVT_COMBOBOX(IDC_JOYNAME, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(ID_TRIGGER_TYPE, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(ID_TILT_INPUT, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(ID_TILT_RANGE_ROLL, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(ID_TILT_RANGE_PITCH, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(IDC_LEFT_C2S, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(ID_TILT_INVERT_ROLL, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_CHECKBOX(ID_TILT_INVERT_PITCH, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_CC_LEFT_STICK, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, WiimoteConfigDialog::GeneralSettingsChanged)
- EVT_COMBOBOX(IDCB_CC_TRIGGERS, WiimoteConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDC_JOYNAME, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(ID_TRIGGER_TYPE, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(ID_TILT_INPUT, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(ID_TILT_RANGE_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(ID_TILT_RANGE_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_CHECKBOX(IDC_LEFT_C2S, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_CHECKBOX(ID_TILT_INVERT_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_CHECKBOX(ID_TILT_INVERT_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_CC_LEFT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
+ EVT_COMBOBOX(IDCB_CC_TRIGGERS, WiimotePadConfigDialog::GeneralSettingsChanged)
// Wiimote
- EVT_BUTTON(IDB_WM_A, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_WM_1, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_WM_P, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_M, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_H, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_WM_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_WM_U, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_WM_SHAKE, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_WM_PITCH_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, WiimoteConfigDialog::OnButtonClick)
- // IR cursor
- EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteConfigDialog::GeneralSettingsChangedScroll)
- EVT_COMMAND_SCROLL(IDS_HEIGHT, WiimoteConfigDialog::GeneralSettingsChangedScroll)
- EVT_COMMAND_SCROLL(IDS_LEFT, WiimoteConfigDialog::GeneralSettingsChangedScroll)
- EVT_COMMAND_SCROLL(IDS_TOP, WiimoteConfigDialog::GeneralSettingsChangedScroll)
+ EVT_BUTTON(IDB_WM_A, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_WM_1, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_WM_P, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_M, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_H, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_WM_L, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_WM_U, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_WM_SHAKE, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_WM_PITCH_L, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, WiimotePadConfigDialog::OnButtonClick)
// Nunchuck
- EVT_BUTTON(IDB_NC_Z, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_NC_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_NC_U, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_D, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_NC_SHAKE, WiimoteConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_NC_Z, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_NC_L, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_NC_U, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_D, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_NC_SHAKE, WiimotePadConfigDialog::OnButtonClick)
// Classic Controller
- EVT_BUTTON(IDB_CC_A, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_B, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_X, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_Y, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_CC_P, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_M, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_H, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_CC_TL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TR, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_CC_DL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_CC_DL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_CC_LL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, WiimoteConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_CC_RL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, WiimoteConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_A, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_B, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_X, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_Y, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_P, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_M, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_H, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_TL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TR, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_DL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_DL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_LL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, WiimotePadConfigDialog::OnButtonClick)
+ EVT_BUTTON(IDB_CC_RL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, WiimotePadConfigDialog::OnButtonClick)
- EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimoteConfigDialog::GetButtons)
- EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimoteConfigDialog::GetButtons)
- EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimoteConfigDialog::GetButtons)
- EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimoteConfigDialog::GetButtons)
- EVT_BUTTON(IDB_TRIGGER_L, WiimoteConfigDialog::GetButtons)
- EVT_BUTTON(IDB_TRIGGER_R, WiimoteConfigDialog::GetButtons)
-
- EVT_TIMER(IDTM_UPDATE, WiimoteConfigDialog::Update)
- EVT_TIMER(IDTM_UPDATE_ONCE, WiimoteConfigDialog::UpdateOnce)
- EVT_TIMER(IDTM_SHUTDOWN, WiimoteConfigDialog::ShutDown)
- EVT_TIMER(IDTM_BUTTON, WiimoteConfigDialog::OnButtonTimer)
- EVT_TIMER(IDTM_UPDATE_PAD, WiimoteConfigDialog::UpdatePad)
+ EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimotePadConfigDialog::GetButtons)
+ EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimotePadConfigDialog::GetButtons)
+ EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimotePadConfigDialog::GetButtons)
+ EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimotePadConfigDialog::GetButtons)
+ EVT_BUTTON(IDB_TRIGGER_L, WiimotePadConfigDialog::GetButtons)
+ EVT_BUTTON(IDB_TRIGGER_R, WiimotePadConfigDialog::GetButtons)
+ EVT_TIMER(IDTM_BUTTON, WiimotePadConfigDialog::OnButtonTimer)
+ EVT_TIMER(IDTM_UPDATE_PAD, WiimotePadConfigDialog::UpdatePad)
END_EVENT_TABLE()
-//////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Class
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-WiimoteConfigDialog::WiimoteConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
+WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
-: wxDialog(parent, id, title, position, size, style)
+: wxFrame(parent, id, title, position, size, style)
{
- #if wxUSE_TIMER
- m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE);
- m_ShutDownTimer = new wxTimer(this, IDTM_SHUTDOWN);
- m_TimeoutOnce = new wxTimer(this, IDTM_UPDATE_ONCE);
- m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON);
- m_UpdatePad = new wxTimer(this, IDTM_UPDATE_PAD);
+#if wxUSE_TIMER
+ m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON);
+ m_UpdatePad = new wxTimer(this, IDTM_UPDATE_PAD);
- // Reset values
- m_bWaitForRecording = false;
- m_bRecording = false;
- GetButtonWaitingID = 0; GetButtonWaitingTimer = 0;
+ // Reset values
+ GetButtonWaitingID = 0;
+ GetButtonWaitingTimer = 0;
- // Start the permanent timer
- const int TimesPerSecond = 30;
- m_UpdatePad->Start( floor((double)(1000 / TimesPerSecond)) );
- #endif
+ // Start the permanent timer
+ const int TimesPerSecond = 30;
+ m_UpdatePad->Start( floor((double)(1000 / TimesPerSecond)) );
+#endif
ControlsCreated = false;
- m_bEnableUseRealWiimote = true;
Page = 0;
- m_vRecording.resize(RECORDING_ROWS + 1);
ClickedButton = NULL;
g_Config.Load();
- CreateGUIControls();
- LoadFile();
+ CreatePadGUIControls();
+ SetBackgroundColour(m_Notebook->GetBackgroundColour());
+
// Set control values
UpdateGUI();
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
- wxKeyEventHandler(WiimoteConfigDialog::OnKeyDown),
+ wxKeyEventHandler(WiimotePadConfigDialog::OnKeyDown),
(wxObject*)0, this);
}
-WiimoteConfigDialog::~WiimoteConfigDialog()
-{
-}
-
-void WiimoteConfigDialog::OnKeyDown(wxKeyEvent& event)
+void WiimotePadConfigDialog::OnKeyDown(wxKeyEvent& event)
{
event.Skip();
// Save the key
g_Pressed = event.GetKeyCode();
- // Escape a recording event
- if (event.GetKeyCode() == WXK_ESCAPE)
- {
- m_bWaitForRecording = false;
- m_bRecording = false;
- UpdateGUI();
- }
-
- // ----------------------------------------------------
// Handle the keyboard key mapping
- // ------------------
std::string StrKey;
if(ClickedButton != NULL)
{
@@ -256,14 +164,11 @@ void WiimoteConfigDialog::OnKeyDown(wxKeyEvent& event)
//ClickedButton->SetLabel(wxString::Format(_T("%c"), event.GetKeyCode()));
#endif
}
-
- // Remove the button control pointer
ClickedButton = NULL;
- // ---------------------------
}
// Input button clicked
-void WiimoteConfigDialog::OnButtonClick(wxCommandEvent& event)
+void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event)
{
//INFO_LOG(CONSOLE, "OnButtonClick: %i\n", g_Pressed);
@@ -282,92 +187,35 @@ void WiimoteConfigDialog::OnButtonClick(wxCommandEvent& event)
}
-void WiimoteConfigDialog::OnClose(wxCloseEvent& event)
+void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
{
g_FrameOpen = false;
- m_UpdatePad->Stop();
- SaveFile();
- g_Config.Save();
- //SuccessAlert("Saved\n");
- if (!g_EmulatorRunning) Shutdown();
- // This will let the Close() function close and remove the wxDialog
- event.Skip();
+ SaveButtonMappingAll(Page);
+ if(m_UpdatePad)
+ m_UpdatePad->Stop();
+ g_Config.Save();
+ Hide();
+ if(!m_BasicConfigFrame->Closing)
+ m_BasicConfigFrame->Close();
}
-/* Timeout the shutdown. In Windows at least the g_pReadThread execution will hang at any attempt to
- call a frame function after the main thread has entered WaitForSingleObject() or any other loop.
- We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */
-void WiimoteConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event))
-{
- // Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy().
- if(!WiiMoteReal::g_ThreadGoing)
- {
- m_ShutDownTimer->Stop();
- Close();
- }
-}
-
-void WiimoteConfigDialog::CloseClick(wxCommandEvent& event)
+void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event)
{
switch(event.GetId())
{
case ID_CLOSE:
- // Wait for the Wiimote thread to stop, then close and shutdown
- if(!g_EmulatorRunning)
- {
- WiiMoteReal::g_Shutdown = true;
- m_ShutDownTimer->Start(10);
- }
- // Close directly
- else
- {
- Close();
- }
+ Close();
break;
case ID_APPLY:
SaveButtonMappingAll(Page);
g_Config.Save();
- SaveFile();
- WiiMoteEmu::LoadRecordedMovements();
break;
}
}
-void WiimoteConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
-{
-}
-
-// Execute a delayed function
-void WiimoteConfigDialog::UpdateOnce(wxTimerEvent& event)
-{
- switch(event.GetId())
- {
- case IDTM_UPDATE_ONCE:
- // Reenable the checkbox
- m_bEnableUseRealWiimote = true;
- SetCursor(wxCursor(wxCURSOR_ARROW));
- UpdateGUI();
- break;
- }
-}
-//////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////
-// Save Settings
-/* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
-
- Saving is currently done when:
-
- 1. Closing the configuration window
- 2. Changing the gamepad
- 3. When the gamepad is enabled or disbled
-
- Input: ChangePad needs to be used when we change the pad for a slot. Slot needs to be used when
- we only want to save changes to one slot.
-*/
-void WiimoteConfigDialog::DoSave(bool ChangePad, int Slot)
+void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot)
{
// Replace "" with "-1" before we are saving
ToBlank(false);
@@ -375,7 +223,8 @@ void WiimoteConfigDialog::DoSave(bool ChangePad, int Slot)
if(ChangePad)
{
// Since we are selecting the pad to save to by the Id we can't update it when we change the pad
- for(int i = 0; i < 4; i++) SaveButtonMapping(i, true);
+ for(int i = 0; i < 4; i++)
+ SaveButtonMapping(i, true);
// Save the settings for the current pad
g_Config.Save(Slot);
// Now we can update the ID
@@ -384,7 +233,8 @@ void WiimoteConfigDialog::DoSave(bool ChangePad, int Slot)
else
{
// Update PadMapping[] from the GUI controls
- for(int i = 0; i < 4; i++) SaveButtonMapping(i);
+ for(int i = 0; i < 4; i++)
+ SaveButtonMapping(i);
g_Config.Save(Slot);
}
@@ -393,13 +243,9 @@ void WiimoteConfigDialog::DoSave(bool ChangePad, int Slot)
INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].ID = %i\n", Page, m_Joyname[Page]->GetSelection());
}
-//////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
// Bitmap box and dot
-// ----------------
-wxBitmap WiimoteConfigDialog::CreateBitmap()
+wxBitmap WiimotePadConfigDialog::CreateBitmap()
{
BoxW = 70, BoxH = 70;
wxBitmap bitmap(BoxW, BoxH);
@@ -419,7 +265,7 @@ wxBitmap WiimoteConfigDialog::CreateBitmap()
dc.SelectObject(wxNullBitmap);
return bitmap;
}
-wxBitmap WiimoteConfigDialog::CreateBitmapDot()
+wxBitmap WiimotePadConfigDialog::CreateBitmapDot()
{
int w = 2, h = 2;
wxBitmap bitmap(w, h);
@@ -437,7 +283,7 @@ wxBitmap WiimoteConfigDialog::CreateBitmapDot()
dc.SelectObject(wxNullBitmap);
return bitmap;
}
-wxBitmap WiimoteConfigDialog::CreateBitmapDeadZone(int Radius)
+wxBitmap WiimotePadConfigDialog::CreateBitmapDeadZone(int Radius)
{
wxBitmap bitmap(Radius*2, Radius*2);
wxMemoryDC dc;
@@ -453,7 +299,7 @@ wxBitmap WiimoteConfigDialog::CreateBitmapDeadZone(int Radius)
//dc.SelectObject(wxNullBitmap);
return bitmap;
}
-wxBitmap WiimoteConfigDialog::CreateBitmapClear()
+wxBitmap WiimotePadConfigDialog::CreateBitmapClear()
{
wxBitmap bitmap(BoxW, BoxH);
wxMemoryDC dc;
@@ -467,31 +313,12 @@ wxBitmap WiimoteConfigDialog::CreateBitmapClear()
//dc.SelectObject(wxNullBitmap);
return bitmap;
}
-//////////////////////////////////////
-void WiimoteConfigDialog::CreateGUIControls()
+
+void WiimotePadConfigDialog::CreatePadGUIControls()
{
- ////////////////////////////////////////////////////////////////////////////////
- // Notebook
- // ----------------
- m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
-
- for (int i = 0; i < MAX_WIIMOTES; i++)
- {
- // Controller pages
- m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize);
- m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1));
- }
-
- m_PageRecording = new wxPanel(m_Notebook, ID_PAGE_RECORDING, wxDefaultPosition, wxDefaultSize);
- m_Notebook->AddPage(m_PageRecording, wxT("Recording"));
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Text lists
- // ----------------
// Search for devices and add them to the device list
wxArrayString StrJoyname; // The string array
@@ -535,189 +362,21 @@ void WiimoteConfigDialog::CreateGUIControls()
StrCcTriggers.Add(wxString::FromAscii("Keyboard"));
StrCcTriggers.Add(wxString::FromAscii("Triggers"));
- // A small type font
- wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
- ///////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- // This can take a few seconds so we show a progress bar for it
- // ----------------
- wxProgressDialog dialog(_T("Opening Wii Remote Configuration"),
- wxT("Loading controls..."),
- 6, // range
- this, // parent
- wxPD_APP_MODAL |
- // wxPD_AUTO_HIDE | -- try this as well
- wxPD_ELAPSED_TIME |
- wxPD_ESTIMATED_TIME |
- wxPD_REMAINING_TIME |
- wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
- );
- // I'm not sure what parent this refers to
- dialog.CenterOnParent();
- ///////////////////////////////////////
+ m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
- /* Populate all four pages. Page 2, 3 and 4 are currently disabled since we can't use more than one
- Wiimote at the moment */
for (int i = 0; i < MAX_WIIMOTES; i++)
{
+ m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize);
+ m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1));
- ////////////////////////////////////////////////////
- // General and basic Settings
- // ----------------
+ // A small type font
+ wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
// Configuration controls sizes
static const int TxtW = 50, TxtH = 19, ChW = 257, BtW = 75, BtH = 20;
- // Basic Settings
- m_WiimoteOnline[i] = new wxCheckBox(m_Controller[i], IDC_WIMOTE_ON, wxT("Wiimote On"), wxDefaultPosition, wxSize(ChW, -1));
- // Emulated Wiimote
- m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad"), wxDefaultPosition, wxSize(ChW, -1));
- // Extension
- m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Wii Motion Plus Connected"), wxDefaultPosition, wxSize(ChW, -1), 0, wxDefaultValidator);
- m_NunchuckConnected[i] = new wxCheckBox(m_Controller[i], ID_NUNCHUCKCONNECTED, wxT("Nunchuck Connected"));
- m_ClassicControllerConnected[i] = new wxCheckBox(m_Controller[i], ID_CLASSICCONTROLLERCONNECTED, wxT("Classic Controller Connected"));
- m_BalanceBoardConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Balance Board Connected"));
- m_GuitarHeroGuitarConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Guitar Hero Guitar Connected"));
- m_GuitarHeroWorldTourDrumsConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Guitar Hero World Tour Drums Connected"));
- // Real Wiimote
- m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_CONNECT_REAL, wxT("Connect Real Wiimote"), wxDefaultPosition, wxSize(ChW, -1));
- m_UseRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_USE_REAL, wxT("Use Real Wiimote"));
- // Default values
- m_WiimoteOnline[0]->SetValue(true);
- m_NunchuckConnected[0]->SetValue(g_Config.bNunchuckConnected);
- m_ClassicControllerConnected[0]->SetValue(g_Config.bClassicControllerConnected);
- m_SidewaysDPad[0]->SetValue(g_Config.bSidewaysDPad);
- m_ConnectRealWiimote[0]->SetValue(g_Config.bConnectRealWiimote);
- m_UseRealWiimote[0]->SetValue(g_Config.bUseRealWiimote);
-
- m_WiimoteOnline[0]->Enable(false);
- m_WiiMotionPlusConnected[0]->Enable(false);
- m_BalanceBoardConnected[0]->Enable(false);
- m_GuitarHeroGuitarConnected[0]->Enable(false);
- m_GuitarHeroWorldTourDrumsConnected[0]->Enable(false);
-
- // Tooltips
- m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i));
- m_ConnectRealWiimote[i]->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay."));
- m_UseRealWiimote[i]->SetToolTip(wxT(
- "Use the real Wiimote in the game. This can be changed during gameplay. This can not be selected"
- " when a recording is to be done. No status in this window will be updated when this is checked."));
-
- // -----------------------------------------------
- // Screen size
- // ---------------------
- // Controls
- m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000"));
- m_TextScreenHeight[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Height: 000"));
- m_TextScreenLeft[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: 000"));
- m_TextScreenTop[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Top: 000"));
- m_TextAR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Aspect Ratio"));
-
- m_SliderWidth[i] = new wxSlider(m_Controller[i], IDS_WIDTH, 0, 100, 923, wxDefaultPosition, wxSize(75, -1));
- m_SliderHeight[i] = new wxSlider(m_Controller[i], IDS_HEIGHT, 0, 0, 727, wxDefaultPosition, wxSize(75, -1));
- m_SliderLeft[i] = new wxSlider(m_Controller[i], IDS_LEFT, 0, 100, 500, wxDefaultPosition, wxSize(75, -1));
- m_SliderTop[i] = new wxSlider(m_Controller[i], IDS_TOP, 0, 0, 500, wxDefaultPosition, wxSize(75, -1));
- //m_ScreenSize = new wxCheckBox(m_Controller[i], IDC_SCREEN_SIZE, wxT("Adjust screen size and position"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
-
- m_CheckAR43[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("4:3"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
- m_CheckAR169[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("16:9"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
- m_Crop[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Crop"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
-
- // Sizers
- m_SizerIRPointerWidth[i] = new wxBoxSizer(wxHORIZONTAL);
- m_SizerIRPointerWidth[i]->Add(m_TextScreenLeft[i], 0, wxEXPAND | (wxTOP), 3);
- m_SizerIRPointerWidth[i]->Add(m_SliderLeft[i], 0, wxEXPAND | (wxRIGHT), 0);
- m_SizerIRPointerWidth[i]->Add(m_TextScreenWidth[i], 0, wxEXPAND | (wxTOP), 3);
- m_SizerIRPointerWidth[i]->Add(m_SliderWidth[i], 0, wxEXPAND | (wxLEFT), 0);
-
- m_SizerIRPointerHeight[i] = new wxBoxSizer(wxHORIZONTAL);
- m_SizerIRPointerHeight[i]->Add(m_TextScreenTop[i], 0, wxEXPAND | (wxTOP), 3);
- m_SizerIRPointerHeight[i]->Add(m_SliderTop[i], 0, wxEXPAND | (wxRIGHT), 0);
- m_SizerIRPointerHeight[i]->Add(m_TextScreenHeight[i], 0, wxEXPAND | (wxTOP), 3);
- m_SizerIRPointerHeight[i]->Add(m_SliderHeight[i], 0, wxEXPAND | (wxLEFT), 0);
-
- m_SizerIRPointerScreen[i] = new wxBoxSizer(wxHORIZONTAL);
- m_SizerIRPointerScreen[i]->Add(m_TextAR[i], 0, wxEXPAND | (wxTOP), 0);
- m_SizerIRPointerScreen[i]->Add(m_CheckAR43[i], 0, wxEXPAND | (wxLEFT), 5);
- m_SizerIRPointerScreen[i]->Add(m_CheckAR169[i], 0, wxEXPAND | (wxLEFT), 5);
- m_SizerIRPointerScreen[i]->Add(m_Crop[i], 0, wxEXPAND | (wxLEFT), 5);
-
- m_SizerIRPointer[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("IR pointer"));
- //m_SizerIRPointer[i]->Add(m_ScreenSize[i], 0, wxEXPAND | (wxALL), 5);
- m_SizerIRPointer[i]->Add(m_SizerIRPointerWidth[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
- m_SizerIRPointer[i]->Add(m_SizerIRPointerHeight[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
- m_SizerIRPointer[i]->Add(m_SizerIRPointerScreen[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
-
- // Default values
- m_CheckAR43[i]->SetValue(g_Config.bKeepAR43);
- m_CheckAR169[i]->SetValue(g_Config.bKeepAR169);
- m_Crop[i]->SetValue(g_Config.bCrop);
-
- // These are changed from the graphics plugin settings, so they are just here to show the loaded status
- m_TextAR[i]->Enable(false);
- m_CheckAR43[i]->Enable(false);
- m_CheckAR169[i]->Enable(false);
- m_Crop[i]->Enable(false);
-
- // Tool tips
- //m_ScreenSize[i]->SetToolTip(wxT("Use the adjusted screen size."));
- // -------------------------------
-
- // --------------------------------------------------------------------
- // Row 1 Sizers: General settings
- // -----------------------------
- m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("General Settings"));
- m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
- m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension"));
- m_SizeReal[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Real Wiimote"));
-
- m_SizeBasicPadding[i] = new wxBoxSizer(wxVERTICAL); m_SizeBasic[i]->Add(m_SizeBasicPadding[i], 0, wxEXPAND | (wxALL), 5);
- m_SizeBasicPadding[i]->Add(m_WiimoteOnline[i], 0, wxEXPAND | (wxUP), 2);
-
- m_SizeEmuPadding[i] = new wxBoxSizer(wxVERTICAL); m_SizeEmu[i]->Add(m_SizeEmuPadding[i], 0, wxEXPAND | (wxALL), 5);
- m_SizeEmuPadding[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | (wxUP), 0);
-
- m_SizeRealPadding[i] = new wxBoxSizer(wxVERTICAL); m_SizeReal[i]->Add(m_SizeRealPadding[i], 0, wxEXPAND | (wxALL), 5);
- m_SizeRealPadding[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | (wxUP), 0);
- m_SizeRealPadding[i]->Add(m_UseRealWiimote[i], 0, wxEXPAND | (wxUP), 2);
-
- m_SizeExtensionsPadding[i] = new wxBoxSizer(wxVERTICAL); m_SizeExtensions[i]->Add(m_SizeExtensionsPadding[i], 0, wxEXPAND | (wxALL), 5);
- m_SizeExtensionsPadding[i]->Add(m_WiiMotionPlusConnected[i], 0, (wxUP), 0);
- m_SizeExtensionsPadding[i]->Add(m_NunchuckConnected[i], 0, (wxUP), 2);
- m_SizeExtensionsPadding[i]->Add(m_ClassicControllerConnected[i], 0, (wxUP), 2);
- m_SizeExtensionsPadding[i]->Add(m_BalanceBoardConnected[i], 0, (wxUP), 2);
- m_SizeExtensionsPadding[i]->Add(m_GuitarHeroGuitarConnected[i], 0, (wxUP), 2);
- m_SizeExtensionsPadding[i]->Add(m_GuitarHeroWorldTourDrumsConnected[i], 0, (wxUP), 2);
-
- m_SizeBasicGeneral[i] = new wxBoxSizer(wxHORIZONTAL);
- m_SizeBasicGeneralLeft[i] = new wxBoxSizer(wxVERTICAL);
- m_SizeBasicGeneralRight[i] = new wxBoxSizer(wxVERTICAL);
-
- m_SizeBasicGeneralLeft[i]->Add(m_SizeReal[i], 0, wxEXPAND | (wxUP), 0);
- m_SizeBasicGeneralLeft[i]->Add(m_SizeExtensions[i], 0, wxEXPAND | (wxUP), 5);
-
- m_SizeBasicGeneralRight[i]->Add(m_SizeBasic[i], 0, wxEXPAND | (wxUP), 0);
- m_SizeBasicGeneralRight[i]->Add(m_SizeEmu[i], 0, wxEXPAND | (wxUP), 5);
- m_SizeBasicGeneralRight[i]->Add(m_SizerIRPointer[i], 0, wxEXPAND | (wxUP), 5);
-
- m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralLeft[i], 0, wxEXPAND | (wxUP), 0);
- m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralRight[i], 0, wxEXPAND | (wxLEFT), 5);
- // ------------------------
-
- ///////////////////////////
-
-
-
-
- ////////////////////////////////////////////////////////////////////////
- // Gamepad input
- // ----------------
-
- // --------------------------------------------------------------------
- // Controller
- // -----------------------------
// Controller
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, StrJoyname[0], wxDefaultPosition, wxSize(200, -1), StrJoyname, wxCB_READONLY);
@@ -1351,7 +1010,6 @@ void WiimoteConfigDialog::CreateGUIControls()
// Set up sizers and layout
// ----------------
m_SizeParent[i] = new wxBoxSizer(wxVERTICAL);
- m_SizeParent[i]->Add(m_SizeBasicGeneral[i], 0, wxBORDER_STATIC | wxEXPAND | (wxALL), 5);
m_SizeParent[i]->Add(m_HorizControllerTiltParent[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
m_SizeParent[i]->Add(m_HorizControllers[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
m_SizeParent[i]->Add(m_HorizControllerMapping[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
@@ -1362,40 +1020,19 @@ void WiimoteConfigDialog::CreateGUIControls()
// Set the main sizer
m_Controller[i]->SetSizer(m_sMain[i]);
- /////////////////////////////////
-
- // Update with the progress (i) and the message
- dialog.Update(i + 1, wxT("Loading notebook pages..."));
}
- ////////////////////////////////////////////
- // Movement recording
- // ----------------
- CreateGUIControlsRecording();
- /////////////////////////////////
- // Update with the progress (i) and the message (msg)
- dialog.Update(5, wxT("Loading notebook pages..."));
- //dialog.Close();
- ////////////////////////////////////////////////////////////////////////////////
- // Buttons
- //m_About = new wxButton(this, ID_ABOUTOGL, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
m_Close->SetToolTip(wxT("Apply and Close"));
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
- //sButtons->Add(m_About, 0, wxALL, 5); // there is no about
sButtons->AddStretchSpacer();
sButtons->Add(m_Apply, 0, (wxALL), 0);
sButtons->Add(m_Close, 0, (wxLEFT), 5);
- ///////////////////////////////
-
- ////////////////////////////////////////////
- // Set sizers and layout
- // ----------------
m_MainSizer = new wxBoxSizer(wxVERTICAL);
m_MainSizer->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
m_MainSizer->Add(sButtons, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
@@ -1417,154 +1054,15 @@ void WiimoteConfigDialog::CreateGUIControls()
#endif
ControlsCreated = true;
- /////////////////////////////////
-}
-/////////////////////////////////
-
-
-
-// ===================================================
-/* Do connect real wiimote */
-// ----------------
-void WiimoteConfigDialog::DoConnectReal()
-{
- g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked();
-
- if(g_Config.bConnectRealWiimote)
- {
- if (!g_RealWiiMoteInitialized) WiiMoteReal::Initialize();
- }
- else
- {
- INFO_LOG(CONSOLE, "Post Message: %i\n", g_RealWiiMoteInitialized);
- if (g_RealWiiMoteInitialized)
- {
- WiiMoteReal::Shutdown();
- }
- }
}
-// ===================================================
-/* Do use real wiimote. We let the game set up the real Wiimote reporting mode and init the Extension when we change
- want to use it again. */
-// ----------------
-void WiimoteConfigDialog::DoUseReal()
-{
- // Clear any eventual events in the Wiimote queue
- WiiMoteReal::ClearEvents();
-
- // Are we using an extension now? The report that it's removed, then reconnected.
- bool UsingExtension = false;
- if (g_Config.bNunchuckConnected || g_Config.bClassicControllerConnected)
- UsingExtension = true;
-
- INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension);
- DoExtensionConnectedDisconnected(UsingExtension ? 0 : 1);
-
- UsingExtension = !UsingExtension;
- INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension);
- DoExtensionConnectedDisconnected(UsingExtension ? 1 : 0);
-
- if(g_EmulatorRunning)
- {
- // Disable the checkbox for a moment
- SetCursor(wxCursor(wxCURSOR_WAIT));
- m_bEnableUseRealWiimote = false;
- // We may not need this if there is already a message queue that allows the nessesary timeout
- //sleep(100);
-
- /* Start the timer to allow the approximate time it takes for the Wiimote to come online
- it would simpler to use sleep(1000) but that doesn't work because we need the functions in main.cpp
- to work */
- m_TimeoutOnce->Start(1000, true);
- }
-}
-
-// ===================================================
-/* Generate connect/disconnect status event */
-// ----------------
-void WiimoteConfigDialog::DoExtensionConnectedDisconnected(int Extension)
-{
- // There is no need for this if no game is running
- if(!g_EmulatorRunning) return;
-
- u8 DataFrame[8]; // make a blank report for it
- wm_request_status *rs = (wm_request_status*)DataFrame;
-
- // Check if a game is running, in that case change the status
- if(WiiMoteEmu::g_ReportingChannel > 0)
- WiiMoteEmu::WmRequestStatus(WiiMoteEmu::g_ReportingChannel, rs, Extension);
-}
-
-// ===================================================
-/* Change settings */
-// ----------------
-void WiimoteConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
+void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
{
long TmpValue;
switch (event.GetId())
{
- case ID_CONNECT_REAL:
- DoConnectReal();
- break;
- case ID_USE_REAL:
- // Enable the Wiimote thread
- g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked();
- if(g_Config.bUseRealWiimote) DoUseReal();
- break;
-
- case ID_SIDEWAYSDPAD:
- g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked();
- break;
-
- //////////////////////////
- // Extensions
- // -----------
- case ID_NUNCHUCKCONNECTED:
- // Don't allow two extensions at the same time
- if(m_ClassicControllerConnected[Page]->IsChecked())
- {
- m_ClassicControllerConnected[Page]->SetValue(false);
- g_Config.bClassicControllerConnected = false;
- // Disconnect the extension so that the game recognize the change
- DoExtensionConnectedDisconnected();
- /* It doesn't seem to be needed but shouldn't it at least take 25 ms to
- reconnect an extension after we disconnected another? */
- if(g_EmulatorRunning) SLEEP(25);
- }
-
- // Update status
- g_Config.bNunchuckConnected = m_NunchuckConnected[Page]->IsChecked();
-
- // Copy the calibration data
- WiiMoteEmu::SetDefaultExtensionRegistry();
-
- // Generate connect/disconnect status event
- DoExtensionConnectedDisconnected();
- break;
-
- case ID_CLASSICCONTROLLERCONNECTED:
- // Don't allow two extensions at the same time
- if(m_NunchuckConnected[Page]->IsChecked())
- {
- m_NunchuckConnected[Page]->SetValue(false);
- g_Config.bNunchuckConnected = false;
- // Disconnect the extension so that the game recognize the change
- DoExtensionConnectedDisconnected();
- }
- g_Config.bClassicControllerConnected = m_ClassicControllerConnected[Page]->IsChecked();
-
- // Copy the calibration data
- WiiMoteEmu::SetDefaultExtensionRegistry();
- // Generate connect/disconnect status event
- DoExtensionConnectedDisconnected();
- break;
-
- //////////////////////////
- // Gamepad
- // -----------
case ID_TRIGGER_TYPE:
WiiMoteEmu::PadMapping[Page].triggertype = m_TriggerType[Page]->GetSelection();
break;
@@ -1606,125 +1104,16 @@ void WiimoteConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case IDCB_DEAD_ZONE_RIGHT:
SaveButtonMappingAll(Page);
break;
-
- //////////////////////////
- // Recording
- // -----------
- case ID_UPDATE_REAL:
- g_Config.bUpdateRealWiimote = m_UpdateMeters->IsChecked();
- break;
-
- case IDC_RECORD + 1:
- case IDC_RECORD + 2:
- case IDC_RECORD + 3:
- case IDC_RECORD + 4:
- case IDC_RECORD + 5:
- case IDC_RECORD + 6:
- case IDC_RECORD + 7:
- case IDC_RECORD + 8:
- case IDC_RECORD + 9:
- case IDC_RECORD + 10:
- case IDC_RECORD + 11:
- case IDC_RECORD + 12:
- case IDC_RECORD + 13:
- case IDC_RECORD + 14:
- case IDC_RECORD + 15:
- // 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);
-
- //INFO_LOG(CONSOLE, "HotKey: %i %i\n",
- // m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection());
- }
- break;
- /////////////////
}
g_Config.Save();
UpdateGUI();
}
-// =======================================================
-// Apparently we need a scroll event version of this for the sliders
-// -------------
-void WiimoteConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event)
+void WiimotePadConfigDialog::UpdateGUI(int Slot)
{
- switch (event.GetId())
- {
- // IR cursor position
- case IDS_WIDTH:
- g_Config.iIRWidth = m_SliderWidth[Page]->GetValue();
- break;
- case IDS_HEIGHT:
- g_Config.iIRHeight = m_SliderHeight[Page]->GetValue();
- break;
- case IDS_LEFT:
- g_Config.iIRLeft = m_SliderLeft[Page]->GetValue();
- break;
- case IDS_TOP:
- g_Config.iIRTop = m_SliderTop[Page]->GetValue();
- break;
- }
-
- UpdateGUI();
-}
-
-// =======================================================
-// Update the IR pointer calibration sliders
-// -------------
-void WiimoteConfigDialog::UpdateControls()
-{
- // Update the slider position if a configuration has been loaded
- m_SliderWidth[Page]->SetValue(g_Config.iIRWidth);
- m_SliderHeight[Page]->SetValue(g_Config.iIRHeight);
- m_SliderLeft[Page]->SetValue(g_Config.iIRLeft);
- m_SliderTop[Page]->SetValue(g_Config.iIRTop);
-
- // Update the labels
- m_TextScreenWidth[Page]->SetLabel(wxString::Format(wxT("Width: %i"), g_Config.iIRWidth));
- m_TextScreenHeight[Page]->SetLabel(wxString::Format(wxT("Height: %i"), g_Config.iIRHeight));
- m_TextScreenLeft[Page]->SetLabel(wxString::Format(wxT("Left: %i"), g_Config.iIRLeft));
- m_TextScreenTop[Page]->SetLabel(wxString::Format(wxT("Top: %i"), g_Config.iIRTop));
-}
-// ==============================
-
-
-// =======================================================
-// Update the enabled/disabled status
-// -------------
-void WiimoteConfigDialog::UpdateGUI(int Slot)
-{
- //INFO_LOG(CONSOLE, "UpdateGUI: \n");
-
- // Update the gamepad settings
UpdateGUIButtonMapping(Page);
-
- // Update dead zone
DoChangeDeadZone(true); DoChangeDeadZone(false);
- // Update the Wiimote IR pointer calibration
- UpdateControls();
-
- /* We only allow a change of extension if we are not currently using the real Wiimote, if it's in use the status will be updated
- from the data scanning functions in main.cpp */
- bool AllowExtensionChange = !(g_RealWiiMotePresent && g_Config.bConnectRealWiimote && g_Config.bUseRealWiimote && g_EmulatorRunning);
- m_NunchuckConnected[Page]->SetValue(g_Config.bNunchuckConnected);
- m_ClassicControllerConnected[Page]->SetValue(g_Config.bClassicControllerConnected);
- m_NunchuckConnected[Page]->Enable(AllowExtensionChange);
- m_ClassicControllerConnected[Page]->Enable(AllowExtensionChange);
-
- /* I have disabled this option during a running game because it's enough to be able to switch
- between using and not using then. To also use the connect option during a running game would
- mean that the wiimote must be sent the current reporting mode and the channel ID after it
- has been initialized. Functions for that are basically already in place so these two options
- could possibly be simplified to one option. */
- m_ConnectRealWiimote[Page]->Enable(!g_EmulatorRunning);
- m_UseRealWiimote[Page]->Enable((m_bEnableUseRealWiimote && g_RealWiiMotePresent && g_Config.bConnectRealWiimote) || (!g_EmulatorRunning && g_Config.bConnectRealWiimote));
-
// Linux has no FindItem()
// Disable all pad items if no pads are detected
if(ControlsCreated)
@@ -1740,12 +1129,5 @@ void WiimoteConfigDialog::UpdateGUI(int Slot)
m_Notebook->FindItem(ID_TRIGGER_TYPE)->Enable(PadEnabled);
#endif
}
-
- // Disable all recording buttons
- bool ActiveRecording = !(m_bWaitForRecording || m_bRecording);
- #ifdef _WIN32
- for(int i = IDB_RECORD + 1; i < (IDB_RECORD + RECORDING_ROWS + 1); i++)
- if(ControlsCreated) m_Notebook->FindItem(i)->Enable(ActiveRecording);
- #endif
}
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h
similarity index 55%
rename from Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h
rename to Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h
index 6570c8190b..a2d5f6da82 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,14 +15,13 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#ifndef __CONFIGDIALOG_h__
-#define __CONFIGDIALOG_h__
+#ifndef __PADCONFIGDIALOG_h__
+#define __PADCONFIGDIALOG_h__
#include
#include
#include
-#include
#include
#include
#include
@@ -30,84 +29,136 @@
#include
#include
#include
-#include
#include
-#include
-class WiimoteConfigDialog : public wxDialog
+class WiimotePadConfigDialog : public wxFrame
{
public:
- WiimoteConfigDialog(wxWindow *parent,
+ WiimotePadConfigDialog(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
- virtual ~WiimoteConfigDialog();
+ virtual ~WiimotePadConfigDialog(){;}
- // General open, close and event functions
void CloseClick(wxCommandEvent& event);
- void UpdateGUI(int Slot = 0); void UpdateGUIButtonMapping(int controller); void UpdateControls();
+ void UpdateGUI(int Slot = 0);
+ void UpdateGUIButtonMapping(int controller);
+ void UpdateControls();
void OnKeyDown(wxKeyEvent& event);
- void LoadFile(); void SaveFile();
-
- // Timers
- wxTimer *m_TimeoutTimer, *m_ShutDownTimer, *m_TimeoutOnce, *m_ButtonMappingTimer, *m_UpdatePad;
-
- // General status
- wxStaticText * m_TextUpdateRate;
-
- // Wiimote status
- wxGauge *m_GaugeBattery, *m_GaugeRoll[2], *m_GaugeGForce[3], *m_GaugeAccel[3];
- wxStaticBitmap *m_bmpDotLeftIn[4], *m_bmpDotLeftOut[4], *m_bmpDotRightIn[4], *m_bmpDotRightOut[4],
- *m_bmpDeadZoneLeftIn[4], *m_bmpDeadZoneRightIn[4];
- wxStaticText *m_TextIR;
- bool m_bWaitForRecording, m_bRecording, m_bAllowA;
- int m_iRecordTo;
- void RecordMovement(wxCommandEvent& event);
- void DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int IRBytes);
- void DoRecordA(bool Pressed);
void Convert2Box(int &x);
void ConvertToString();
- void Update(wxTimerEvent& WXUNUSED(event));
- void ShutDown(wxTimerEvent& WXUNUSED(event));
- void UpdateOnce(wxTimerEvent& event);
-
- // Gamepad configuration
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
void UpdatePad(wxTimerEvent& WXUNUSED(event));
+ wxTimer *m_UpdatePad,
+ *m_ButtonMappingTimer;
+
+ wxStaticBitmap *m_bmpDotLeftIn[4],
+ *m_bmpDotLeftOut[4],
+ *m_bmpDotRightIn[4],
+ *m_bmpDotRightOut[4],
+ *m_bmpDeadZoneLeftIn[4],
+ *m_bmpDeadZoneRightIn[4];
private:
DECLARE_EVENT_TABLE();
- bool ControlsCreated, m_bEnableUseRealWiimote; int Page, BoxW, BoxH, g_Pressed;
+ bool ControlsCreated;
+ int Page, BoxW, BoxH, g_Pressed;
wxNotebook *m_Notebook;
- wxPanel *m_Controller[4], *m_PageRecording;
- wxButton *m_About, *m_Close, *m_Apply;
- wxBoxSizer *m_MainSizer, *m_sMain[4], *m_SizeParent[4], *m_sRecordingMain;
+ wxPanel *m_Controller[4];
+ wxButton *m_Close,
+ *m_Apply;
+ wxBoxSizer *m_MainSizer,
+ *m_sMain[4],
+ *m_SizeParent[4];
+
+ wxCheckBox *m_CheckC2S[4],
+ *m_TiltInvertRoll[4],
+ *m_TiltInvertPitch[4];
// Emulated Wiimote key settings
- wxBoxSizer *m_SizerIRPointerWidth[4], *m_SizerIRPointerHeight[4], *m_SizerIRPointerScreen[4],
- *m_SizeBasicPadding[4], *m_SizeEmuPadding[4], *m_SizeRealPadding[4], *m_SizeExtensionsPadding[4],
- *m_SizeBasicGeneral[4], *m_SizeBasicGeneralLeft[4], *m_SizeBasicGeneralRight[4],
- *m_HorizControllers[4], *m_gC2SDeadZone[4], *m_gCircle2Square[4], *m_gCircle2SquareVert[4], *m_gDeadZone[4], *m_gDeadZoneHoriz[4], *m_HorizControllerTiltParent[4], *m_HorizControllerTilt[4], *m_TiltHoriz[4],
- *m_SizeAnalogLeft[4], *m_SizeAnalogLeftHorizX[4], *m_SizeAnalogLeftHorizY[4], *m_SizeAnalogRight[4], *m_SizeAnalogRightHorizX[4], *m_SizeAnalogRightHorizY[4],
- *m_SizeAnalogTriggerVertLeft[4], *m_SizeAnalogTriggerVertRight[4], *m_SizeAnalogTriggerHorizInput[4],
- // Nunchuck
- *m_SNcShake[4], *m_SNcZ[4], *m_SNcC[4], *m_SNcL[4], *m_SNcR[4], *m_SNcU[4], *m_SNcD[4],
- // Wiimote
- *m_SWmVertLeft[4], *m_SWmVertRight[4], *m_SWmShake[4], *m_SWmPitchL[4], *m_SWmPitchR[4], *m_SWmA[4], *m_SWmB[4], *m_SWm1[4], *m_SWm2[4], *m_SWmP[4], *m_SWmM[4], *m_SWmH[4], *m_SWmL[4], *m_SWmR[4], *m_SWmU[4], *m_SWmD[4],
- *m_HorizControllerMapping[4], *m_NunchuckStick[4],
- // Classic Controller
- *m_SCcVertLeft[4], *m_SCcVertMiddle[4], *m_SCcVertRight[4],
- *m_SCcLeftStick[4], *m_SCcRightStick[4], *m_SCcTriggers[4],
- *m_SCcA[4], *m_SCcB[4], *m_SCcX[4], *m_SCcY[4],
- *m_SCcP[4], *m_SCcM[4], *m_SCcH[4],
- *m_SCcTl[4], *m_SCcZl[4], *m_SCcZr[4], *m_SCcTr[4],
- *m_SCcDl[4], *m_SCcDu[4], *m_SCcDr[4], *m_SCcDd[4],
- *m_SCcLl[4], *m_SCcLu[4], *m_SCcLr[4], *m_SCcLd[4],
- *m_SCcRl[4], *m_SCcRu[4], *m_SCcRr[4], *m_SCcRd[4];
+ wxBoxSizer *m_HorizControllers[4],
+ *m_gC2SDeadZone[4],
+ *m_gCircle2Square[4],
+ *m_gCircle2SquareVert[4],
+ *m_gDeadZone[4],
+ *m_gDeadZoneHoriz[4],
+ *m_HorizControllerTiltParent[4],
+ *m_HorizControllerTilt[4],
+ *m_TiltHoriz[4],
+ *m_SizeAnalogLeft[4],
+ *m_SizeAnalogLeftHorizX[4],
+ *m_SizeAnalogLeftHorizY[4],
+ *m_SizeAnalogRight[4],
+ *m_SizeAnalogRightHorizX[4],
+ *m_SizeAnalogRightHorizY[4],
+ *m_SizeAnalogTriggerVertLeft[4],
+ *m_SizeAnalogTriggerVertRight[4],
+ *m_SizeAnalogTriggerHorizInput[4];
+
+ // Nunchuck
+ wxBoxSizer *m_SNcShake[4],
+ *m_SNcZ[4],
+ *m_SNcC[4],
+ *m_SNcL[4],
+ *m_SNcR[4],
+ *m_SNcU[4],
+ *m_SNcD[4];
+
+ // Wiimote
+ wxBoxSizer *m_SWmVertLeft[4],
+ *m_SWmVertRight[4],
+ *m_SWmShake[4],
+ *m_SWmPitchL[4],
+ *m_SWmPitchR[4],
+ *m_SWmA[4],
+ *m_SWmB[4],
+ *m_SWm1[4],
+ *m_SWm2[4],
+ *m_SWmP[4],
+ *m_SWmM[4],
+ *m_SWmH[4],
+ *m_SWmL[4],
+ *m_SWmR[4],
+ *m_SWmU[4],
+ *m_SWmD[4],
+ *m_HorizControllerMapping[4],
+ *m_NunchuckStick[4];
+
+ // Classic Controller
+ wxBoxSizer *m_SCcVertLeft[4],
+ *m_SCcVertMiddle[4],
+ *m_SCcVertRight[4],
+ *m_SCcLeftStick[4],
+ *m_SCcRightStick[4],
+ *m_SCcTriggers[4],
+ *m_SCcA[4],
+ *m_SCcB[4],
+ *m_SCcX[4],
+ *m_SCcY[4],
+ *m_SCcP[4],
+ *m_SCcM[4],
+ *m_SCcH[4],
+ *m_SCcTl[4],
+ *m_SCcZl[4],
+ *m_SCcZr[4],
+ *m_SCcTr[4],
+ *m_SCcDl[4],
+ *m_SCcDu[4],
+ *m_SCcDr[4],
+ *m_SCcDd[4],
+ *m_SCcLl[4],
+ *m_SCcLu[4],
+ *m_SCcLr[4],
+ *m_SCcLd[4],
+ *m_SCcRl[4],
+ *m_SCcRu[4],
+ *m_SCcRr[4],
+ *m_SCcRd[4];
+
wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4], *m_TiltGrid[4],
*m_GridLeftStick[4], *m_GridRightStick[4];
wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_SizerIRPointer[4], *m_gTilt[4], *m_gJoyname[4];
@@ -146,61 +197,33 @@ class WiimoteConfigDialog : public wxDialog
*m_CcTextLeftStick[4], *m_CcTextRightStick[4], *m_CcTextTriggers[4];
wxButton *ClickedButton;
wxString OldLabel;
- wxSlider *m_SliderWidth[4], *m_SliderHeight[4], *m_SliderLeft[4], *m_SliderTop[4];
- // Emulated Wiimote settings
- wxCheckBox *m_SidewaysDPad[4], *m_WiimoteOnline[4],
- *m_CheckC2S[4], *m_TiltInvertRoll[4], *m_TiltInvertPitch[4],
- *m_WiiMotionPlusConnected[4], *m_NunchuckConnected[4], *m_ClassicControllerConnected[4], *m_BalanceBoardConnected[4], *m_GuitarHeroGuitarConnected[4], *m_GuitarHeroWorldTourDrumsConnected[4],
- *m_CheckAR43[4], *m_CheckAR169[4], *m_Crop[4];
wxComboBox *m_TiltComboInput[4], *m_TiltComboRangeRoll[4], *m_TiltComboRangePitch[4], *m_Joyname[4], *m_ComboDiagonal[4], *m_ComboDeadZoneLeft[4], *m_ComboDeadZoneRight[4], *m_TriggerType[4],
*m_NunchuckComboStick[4], *m_CcComboLeftStick[4], *m_CcComboRightStick[4], *m_CcComboTriggers[4];
- // Real Wiimote settings
- wxCheckBox *m_ConnectRealWiimote[4], *m_UseRealWiimote[4], *m_UpdateMeters;
-
wxPanel *m_pLeftInStatus[4], *m_pLeftOutStatus[4], *m_pRightInStatus[4], *m_pRightOutStatus[4];
wxStaticBitmap *m_bmpSquareLeftIn[4], *m_bmpSquareLeftOut[4], *m_bmpSquareRightIn[4], *m_bmpSquareRightOut[4];
wxStaticBoxSizer *m_gAnalogLeft[4], *m_gAnalogRight[4], *m_gTrigger[4],
*m_gWiimote[4], *m_gNunchuck[4], *m_gClassicController[4];
- wxBitmap CreateBitmapDot(), CreateBitmap(), CreateBitmapDeadZone(int Radius), CreateBitmapClear();
- wxButton * m_RecordButton[RECORDING_ROWS + 1];
- wxChoice * m_RecordHotKeySwitch[RECORDING_ROWS + 1];
- wxChoice * m_RecordHotKeyWiimote[RECORDING_ROWS + 1];
- wxChoice * m_RecordHotKeyNunchuck[RECORDING_ROWS + 1];
- wxChoice * m_RecordHotKeyIR[RECORDING_ROWS + 1];
- wxTextCtrl * m_RecordText[RECORDING_ROWS + 1];
- wxTextCtrl * m_RecordGameText[RECORDING_ROWS + 1];
- wxTextCtrl * m_RecordIRBytesText[RECORDING_ROWS + 1];
- wxTextCtrl * m_RecordSpeed[RECORDING_ROWS + 1];
- wxChoice * m_RecordPlayBackSpeed[RECORDING_ROWS + 1];
-
- /*
- struct m_sRecording
- {
- u8 x;
- u8 y;
- u8 z;
- double Time;
- };
- */
- std::vector m_vRecording;
- int IRBytes;
+ wxBitmap CreateBitmapDot();
+ wxBitmap CreateBitmap();
+ wxBitmap CreateBitmapDeadZone(int Radius);
+ wxBitmap CreateBitmapClear();
enum
{
ID_CLOSE = 1000,
ID_APPLY,
- ID_ABOUTOGL,
- IDTM_EXIT, IDTM_UPDATE, IDTM_SHUTDOWN, IDTM_UPDATE_ONCE, IDTM_BUTTON, IDTM_UPDATE_PAD, // Timer
+ IDTM_EXIT,
+ IDTM_BUTTON,
+ IDTM_UPDATE_PAD, // Timer
- ID_NOTEBOOK, ID_CONTROLLERPAGE1, ID_CONTROLLERPAGE2, ID_CONTROLLERPAGE3, ID_CONTROLLERPAGE4, ID_PAGE_RECORDING,
-
- // Emulated Wiimote
- ID_SIDEWAYSDPAD,
- ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED,
- IDC_WIMOTE_ON,
+ ID_NOTEBOOK,
+ ID_CONTROLLERPAGE1,
+ ID_CONTROLLERPAGE2,
+ ID_CONTROLLERPAGE3,
+ ID_CONTROLLERPAGE4,
// Gamepad
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
@@ -236,25 +259,11 @@ class WiimoteConfigDialog : public wxDialog
IDC_JOYNAME, IDC_LEFT_C2S, IDCB_LEFT_DIAGONAL, IDCB_DEAD_ZONE_LEFT, IDCB_DEAD_ZONE_RIGHT,
ID_TRIGGER_TYPE, ID_TILT_INPUT, ID_TILT_RANGE_ROLL, ID_TILT_RANGE_PITCH, ID_TILT_INVERT_ROLL, ID_TILT_INVERT_PITCH,
IDCB_NUNCHUCK_STICK, IDCB_CC_LEFT_STICK, IDCB_CC_RIGHT_STICK, IDCB_CC_TRIGGERS,
-
- // Real
- ID_CONNECT_REAL, ID_USE_REAL, ID_UPDATE_REAL, IDT_STATUS,
- IDB_RECORD = 2000,
- IDC_RECORD = 3000,
- IDC_PLAY_WIIMOTE, IDC_PLAY_NUNCHUCK, IDC_PLAY_IR, IDT_RECORD_TEXT, IDT_RECORD_GAMETEXT, IDT_RECORD_IRBYTESTEXT, IDT_RECORD_SPEED, IDT_RECORD_PLAYSPEED
};
void OnClose(wxCloseEvent& event);
- void CreateGUIControls();
- void CreateGUIControlsRecording();
- void AboutClick(wxCommandEvent& event);
+ void CreatePadGUIControls();
void GeneralSettingsChanged(wxCommandEvent& event);
- void GeneralSettingsChangedScroll(wxScrollEvent& event);
-
- void DoConnectReal(); // Real
- void DoUseReal();
-
- void DoExtensionConnectedDisconnected(int Extension = -1); // Emulated
// Gamepad configuration
void SetButtonText(int id, char text[128], int _Page = -1); void SetButtonTextAll(int id, char text[128]);
@@ -271,7 +280,5 @@ class WiimoteConfigDialog : public wxDialog
// Configure buttons
int GetButtonWaitingID, GetButtonWaitingTimer;
};
-
-extern WiimoteConfigDialog *m_ConfigFrame;
-
-#endif
\ No newline at end of file
+extern WiimotePadConfigDialog *m_PadConfigFrame;
+#endif
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp
index fd98318d60..8ee12d39aa 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,11 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-//#include "Common.h" // for u16
#include "CommonTypes.h" // for u16
#include "IniFile.h"
#include "Timer.h"
@@ -27,15 +22,14 @@
#include "wiimote_real.h" // Local
#include "wiimote_hid.h"
#include "main.h"
-#include "ConfigDlg.h"
+#include "ConfigRecordingDlg.h"
+#include "ConfigBasicDlg.h"
#include "Config.h"
#include "EmuMain.h" // for LoadRecordedMovements()
#include "EmuSubroutines.h" // for WmRequestStatus
-//////////////////////////////////////
-
-void WiimoteConfigDialog::LoadFile()
+void WiimoteRecordingConfigDialog::LoadFile()
{
INFO_LOG(CONSOLE, "LoadFile()\n");
@@ -77,7 +71,8 @@ void WiimoteConfigDialog::LoadFile()
file.Get(SaveName.c_str(), "PlaybackSpeed", &iTmp, -1); m_RecordPlayBackSpeed[i]->SetSelection(iTmp);
}
}
-void WiimoteConfigDialog::SaveFile()
+
+void WiimoteRecordingConfigDialog::SaveFile()
{
INFO_LOG(CONSOLE, "SaveFile\n");
@@ -117,24 +112,11 @@ void WiimoteConfigDialog::SaveFile()
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
INFO_LOG(CONSOLE, "SaveFile()\n");
}
-/////////////////////////////
-
-
-
-
-/////////////////////////////////////////////////////////////////////////
-// Create GUI
-// ------------
-void WiimoteConfigDialog::CreateGUIControlsRecording()
+void WiimoteRecordingConfigDialog::CreateGUIControlsRecording()
{
- ////////////////////////////////////////////////////////////////////////////////
- // Real Wiimote
- // ----------------
+ m_PageRecording = new wxPanel(this, ID_RECORDINGPAGE, wxDefaultPosition, wxDefaultSize);
- // ---------------------------------------------
- // Status
- // ----------------
m_TextUpdateRate = new wxStaticText(m_PageRecording, wxID_ANY, wxT("Update rate: 000 times/s"));
m_UpdateMeters = new wxCheckBox(m_PageRecording, ID_UPDATE_REAL, wxT("Update gauges"));
@@ -144,10 +126,9 @@ void WiimoteConfigDialog::CreateGUIControlsRecording()
"You can turn this off when a game is running to avoid a potential slowdown that may come from redrawing the\n"
"configuration screen. Remember that you also need to press '+' on your Wiimote before you can record movements."
));
- // -----------------------
// Width and height of the gauges
- static const int Gw = 35, Gh = 110;
+ static const int Gw = 35, Gh = 110; //ugly
m_GaugeBattery = new wxGauge( m_PageRecording, wxID_ANY, 100, wxDefaultPosition, wxSize(Gw, Gh), wxGA_VERTICAL | wxNO_BORDER | wxGA_SMOOTH);
m_GaugeRoll[0] = new wxGauge( m_PageRecording, wxID_ANY, 360, wxDefaultPosition, wxSize(Gw, Gh), wxGA_VERTICAL | wxNO_BORDER | wxGA_SMOOTH);
@@ -162,9 +143,6 @@ void WiimoteConfigDialog::CreateGUIControlsRecording()
// The text controls
m_TextIR = new wxStaticText(m_PageRecording, wxID_ANY, wxT("Cursor: 000 000\nDistance: 0000"));
- // ------------------------------------
- // The sizers for all gauges together with their label
- // -----------
wxBoxSizer * sBoxBattery = new wxBoxSizer(wxVERTICAL);
wxBoxSizer * sBoxRoll[2];
sBoxRoll[0] = new wxBoxSizer(wxVERTICAL);
@@ -185,11 +163,7 @@ void WiimoteConfigDialog::CreateGUIControlsRecording()
m_TextX[0] = new wxStaticText(m_PageRecording, wxID_ANY, wxT("X"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); m_TextX[1] = new wxStaticText(m_PageRecording, wxID_ANY, wxT("X"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
m_TextY[0] = new wxStaticText(m_PageRecording, wxID_ANY, wxT("Y"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); m_TextY[1] = new wxStaticText(m_PageRecording, wxID_ANY, wxT("Y"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
m_TextZ[0] = new wxStaticText(m_PageRecording, wxID_ANY, wxT("Z"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); m_TextZ[1] = new wxStaticText(m_PageRecording, wxID_ANY, wxT("Z"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
- // ----------------
- // ----------------------------------------------
- // Row 1 Sizers
- // -----------
sBoxBattery->Add(m_GaugeBattery, 0, wxEXPAND | (wxALL), 0); sBoxBattery->Add(m_TextBattery, 0, wxEXPAND | (wxUP), 5);
sBoxRoll[0]->Add(m_GaugeRoll[0], 0, wxEXPAND | (wxUP | wxDOWN | wxLEFT), 0); sBoxRoll[0]->Add(m_TextRoll, 0, wxEXPAND | (wxUP), 5);
@@ -231,16 +205,9 @@ void WiimoteConfigDialog::CreateGUIControlsRecording()
sbRealWiimoteStatus->Add(sbRealRoll, 0, wxEXPAND | (wxLEFT), 5);
sbRealWiimoteStatus->Add(sbRealGForce, 0, wxEXPAND | (wxLEFT), 5);
sbRealWiimoteStatus->Add(sbRealAccel, 0, wxEXPAND | (wxLEFT), 5);
- // --------------------
- // Tool tips
m_GaugeBattery->SetToolTip(wxT("Press '+' to show the current status. Press '-' to stop recording the status."));
- // ==========================================
-
- // ====================================================================
- // Record movement
- // ----------------
wxStaticBoxSizer * sbRealRecord = new wxStaticBoxSizer(wxVERTICAL, m_PageRecording, wxT("Record movements"));
wxArrayString StrHotKeySwitch;
@@ -338,27 +305,42 @@ void WiimoteConfigDialog::CreateGUIControlsRecording()
sbRealRecord->Add(sRealRecord[i], 0, wxEXPAND | (wxTOP), 2);
}
- // ==========================================
- // ----------------------------------------------------------------------
- // Set up sizers for the whole page
- // ----------------
m_sRecordingMain = new wxBoxSizer(wxVERTICAL);
m_sRecordingMain->Add(sbRealWiimoteStatus, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxUP), 5);
m_sRecordingMain->Add(sbRealRecord, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
- m_PageRecording->SetSizer(m_sRecordingMain);
+ m_PageRecording->SetSizer(m_sRecordingMain);
+
+ m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"));
+ m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
+ m_Close->SetToolTip(wxT("Apply and Close"));
+
+ wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
+ sButtons->AddStretchSpacer();
+ sButtons->Add(m_Apply, 0, (wxALL), 0);
+ sButtons->Add(m_Close, 0, (wxLEFT), 5);
+
+ m_MainSizer = new wxBoxSizer(wxVERTICAL);
+ m_MainSizer->Add(m_PageRecording, 1, wxEXPAND | wxALL, 5);
+ m_MainSizer->Add(sButtons, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
+
+ this->SetSizer(m_MainSizer);
+ this->Layout();
+
+ Fit();
+
+ // Center the window if there is room for it
+ #ifdef _WIN32
+ if (GetSystemMetrics(SM_CYFULLSCREEN) > 800)
+ Center();
+ #endif
+
+ ControlsCreated = true;
}
-/////////////////////////////////
-
-/////////////////////////////////////////////////////////////////////////
-/* Record movement */
-// ------------
-
-void WiimoteConfigDialog::ConvertToString()
+void WiimoteRecordingConfigDialog::ConvertToString()
{
- // Load ini file
IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
std::string TmpStr = "", TmpIR = "", TmpTime = "";
@@ -382,8 +364,8 @@ void WiimoteConfigDialog::ConvertToString()
TmpTime += StringFromFormat("%05i", Time);
if (i < ((int)m_vRecording.size() - 1)) TmpTime += ",";
- /* Break just short of the IniFile.cpp byte limit so that we don't crash file.Load() the next time.
- This limit should never be hit because of the recording limit below. I keep it here just in case. */
+ // Break just short of the IniFile.cpp byte limit so that we don't crash file.Load() the next time.
+ // This limit should never be hit because of the recording limit below. I keep it here just in case.
if(TmpStr.length() > (1024*10 - 10) || TmpIR.length() > (1024*10 - 10) || TmpTime.length() > (1024*10 - 10))
{
break;
@@ -428,15 +410,15 @@ void WiimoteConfigDialog::ConvertToString()
}
// Timeout the recording
-void WiimoteConfigDialog::Update(wxTimerEvent& WXUNUSED(event))
+void WiimoteRecordingConfigDialog::Update(wxTimerEvent& WXUNUSED(event))
{
m_bWaitForRecording = false;
m_bRecording = false;
m_RecordButton[m_iRecordTo]->SetLabel(wxT(""));
- UpdateGUI();
+ UpdateRecordingGUI();
}
-void WiimoteConfigDialog::RecordMovement(wxCommandEvent& event)
+void WiimoteRecordingConfigDialog::RecordMovement(wxCommandEvent& event)
{
m_iRecordTo = event.GetId() - 2000;
@@ -454,20 +436,21 @@ void WiimoteConfigDialog::RecordMovement(wxCommandEvent& event)
m_RecordButton[m_iRecordTo]->SetLabel(wxT("Press +"));
// This is for usability purposes, it may not be obvious at all that this must be unchecked
// for the recording to work
- for(int i = 0; i < 1; i++) m_UseRealWiimote[i]->SetValue(false); g_Config.bUseRealWiimote = false;
+ for(int i = 0; i < MAX_WIIMOTES; i++)
+ m_BasicConfigFrame->m_UseRealWiimote[i]->SetValue(false);
+ g_Config.bUseRealWiimote = false;
return;
}
m_bWaitForRecording = true;
- m_bAllowA = true;
m_bRecording = false;
- UpdateGUI();
+ UpdateRecordingGUI();
m_TimeoutTimer->Start(5000, true);
}
-void WiimoteConfigDialog::DoRecordA(bool Pressed)
+void WiimoteRecordingConfigDialog::DoRecordA(bool Pressed)
{
// Return if we are not waiting or recording
if (! (m_bWaitForRecording || m_bRecording)) return;
@@ -498,10 +481,10 @@ void WiimoteConfigDialog::DoRecordA(bool Pressed)
ConvertToString();
}
- UpdateGUI();
+ UpdateRecordingGUI();
}
-void WiimoteConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes)
+void WiimoteRecordingConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes)
{
//std::string Tmp1 = ArrayToString(_IR, 20, 0, 30);
//INFO_LOG(CONSOLE, "DoRecordMovement: %s\n", Tmp1.c_str());
@@ -521,15 +504,13 @@ void WiimoteConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR
// Save the number of IR bytes
IRBytes = _IRBytes;
- /* The upper limit of a recording coincides with the IniFile.cpp limit, each list element
- is 7 bytes, therefore be divide by 7 */
+ // The upper limit of a recording coincides with the IniFile.cpp limit, each list element
+ // is 7 bytes, therefore be divide by 7
if (m_vRecording.size() > (10*1024 / 7 - 2) )
{
m_bRecording = false;
m_RecordButton[m_iRecordTo]->SetLabel(wxT("Done"));
ConvertToString();
- UpdateGUI();
+ UpdateRecordingGUI();
}
-}
-/////////////////////////////////
-
+}
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp
new file mode 100644
index 0000000000..ec8744ff6f
--- /dev/null
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp
@@ -0,0 +1,158 @@
+// Copyright (C) 2003-2009 Dolphin Project.
+
+// 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 "CommonTypes.h" // for u16
+#include "IniFile.h"
+#include "StringUtil.h"
+
+#include "wiimote_real.h" // Local
+#include "wiimote_hid.h"
+#include "main.h"
+#include "ConfigRecordingDlg.h"
+#include "ConfigBasicDlg.h"
+#include "Config.h"
+#include "EmuMain.h" // for LoadRecordedMovements()
+#include "EmuSubroutines.h" // for WmRequestStatus
+#include "EmuDefinitions.h" // for joyinfo
+
+BEGIN_EVENT_TABLE(WiimoteRecordingConfigDialog,wxFrame)//wxDialog)
+ EVT_CLOSE(WiimoteRecordingConfigDialog::OnClose)
+ EVT_BUTTON(ID_CLOSE, WiimoteRecordingConfigDialog::CloseClick)
+ EVT_BUTTON(ID_APPLY, WiimoteRecordingConfigDialog::CloseClick)
+
+ 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)
+: wxFrame
+(parent, id, title, position, size, style)
+{
+ #if wxUSE_TIMER
+ m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE);
+ m_bWaitForRecording = false;
+ m_bRecording = false;
+ #endif
+ m_vRecording.resize(RECORDING_ROWS + 1);
+
+ g_Config.Load();
+ CreateGUIControlsRecording();
+ SetBackgroundColour(m_PageRecording->GetBackgroundColour());
+ LoadFile();
+ // Set control values
+ UpdateRecordingGUI();
+}
+
+void WiimoteRecordingConfigDialog::OnClose(wxCloseEvent& event)
+{
+ g_FrameOpen = false;
+ SaveFile();
+ g_Config.Save();
+
+ Hide();
+ if(!m_BasicConfigFrame->Closing)
+ m_BasicConfigFrame->Close();
+}
+
+
+void WiimoteRecordingConfigDialog::CloseClick(wxCommandEvent& event)
+{
+ switch(event.GetId())
+ {
+ case ID_CLOSE:
+ g_Config.Save();
+ SaveFile();
+ Close();
+ break;
+ case ID_APPLY:
+ g_Config.Save();
+ 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);
+
+ //INFO_LOG(CONSOLE, "HotKey: %i %i\n",
+ // m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection());
+ }
+ break;
+ }
+ g_Config.Save();
+ UpdateRecordingGUI();
+}
+
+
+void WiimoteRecordingConfigDialog::UpdateRecordingGUI(int Slot)
+{
+ // Disable all recording buttons
+ bool ActiveRecording = !(m_bWaitForRecording || m_bRecording);
+ #ifdef _WIN32
+ for(int i = IDB_RECORD + 1; i < (IDB_RECORD + RECORDING_ROWS + 1); i++)
+ if(ControlsCreated) m_PageRecording->FindItem(i)->Enable(ActiveRecording);
+ #endif
+}
+
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.h
new file mode 100644
index 0000000000..5af962cd0f
--- /dev/null
+++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.h
@@ -0,0 +1,127 @@
+// Copyright (C) 2003-2009 Dolphin Project.
+
+// 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/
+
+#ifndef __CONFIGDIALOG_h__
+#define __CONFIGDIALOG_h__
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class WiimoteRecordingConfigDialog : public wxFrame
+{
+ public:
+ WiimoteRecordingConfigDialog(wxWindow *parent,
+ wxWindowID id = 1,
+ const wxString &title = wxT("Wii Remote Plugin Configuration"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
+ virtual ~WiimoteRecordingConfigDialog(){;}
+
+
+ void UpdateRecordingGUI(int Slot = 0);
+ void LoadFile();
+ void SaveFile();
+ void DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int IRBytes);
+ void DoRecordA(bool Pressed);
+ void ConvertToString();
+
+ void CloseClick(wxCommandEvent& event);
+ void RecordMovement(wxCommandEvent& event);
+ void Update(wxTimerEvent& WXUNUSED(event));
+
+ bool m_bWaitForRecording,
+ m_bRecording;
+
+ int m_iRecordTo;
+
+ wxTimer *m_TimeoutTimer;
+
+ // General status
+ wxStaticText * m_TextUpdateRate,
+ *m_TextIR;
+
+ // Wiimote status
+ wxGauge *m_GaugeBattery,
+ *m_GaugeRoll[2],
+ *m_GaugeGForce[3],
+ *m_GaugeAccel[3];
+
+ private:
+ DECLARE_EVENT_TABLE();
+
+ bool ControlsCreated;
+
+ wxPanel *m_PageRecording;
+ wxButton *m_Close,
+ *m_Apply;
+
+ wxBoxSizer *m_MainSizer,
+ *m_sRecordingMain;
+
+ wxCheckBox *m_UpdateMeters;
+
+ wxButton * m_RecordButton[RECORDING_ROWS + 1];
+ wxChoice * m_RecordHotKeySwitch[RECORDING_ROWS + 1];
+ wxChoice * m_RecordHotKeyWiimote[RECORDING_ROWS + 1];
+ wxChoice * m_RecordHotKeyNunchuck[RECORDING_ROWS + 1];
+ wxChoice * m_RecordHotKeyIR[RECORDING_ROWS + 1];
+ wxTextCtrl * m_RecordText[RECORDING_ROWS + 1];
+ wxTextCtrl * m_RecordGameText[RECORDING_ROWS + 1];
+ wxTextCtrl * m_RecordIRBytesText[RECORDING_ROWS + 1];
+ wxTextCtrl * m_RecordSpeed[RECORDING_ROWS + 1];
+ wxChoice * m_RecordPlayBackSpeed[RECORDING_ROWS + 1];
+
+ std::vector m_vRecording;
+ int IRBytes;
+
+ enum
+ {
+ ID_CLOSE = 1000,
+ ID_APPLY,
+ ID_RECORDINGPAGE,
+ IDTM_UPDATE,
+
+ // Real
+ ID_UPDATE_REAL,
+ IDB_RECORD = 2000,
+ IDC_RECORD = 3000,
+ IDC_PLAY_WIIMOTE,
+ IDC_PLAY_NUNCHUCK,
+ IDC_PLAY_IR,
+ IDT_RECORD_TEXT,
+ IDT_RECORD_GAMETEXT,
+ IDT_RECORD_IRBYTESTEXT,
+ IDT_RECORD_SPEED,
+ IDT_RECORD_PLAYSPEED
+ };
+
+ void OnClose(wxCloseEvent& event);
+ void CreateGUIControlsRecording();
+ void RecordingChanged(wxCommandEvent& event);
+};
+
+extern WiimoteRecordingConfigDialog *m_RecordingConfigFrame;
+#endif
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp b/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp
index 7c0a27e260..0ea6a0cb45 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/DataReports.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -45,11 +45,6 @@
// ================
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include "pluginspecs_wiimote.h"
#include
@@ -64,16 +59,9 @@
#include "EmuSubroutines.h"
#include "EmuDefinitions.h"
#include "Encryption.h" // for extension encryption
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
-///////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
extern SWiimoteInitialize g_WiimoteInitialize;
-///////////////////////////////
namespace WiiMoteEmu
@@ -226,13 +214,13 @@ void SendReportCoreAccelExt16(u16 _channelID)
FillReportAcc(pReport->a);
#endif
- if(g_Config.bNunchuckConnected)
+ if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
{
#if defined(HAVE_WX) && HAVE_WX
FillReportExtension(pReport->ext);
#endif
}
- else if(g_Config.bClassicControllerConnected)
+ else if(g_Config.iExtensionConnected == EXT_CLASSIC_CONTROLLER)
{
#if defined(HAVE_WX) && HAVE_WX
FillReportClassicExtension(_ext);
@@ -274,13 +262,13 @@ void SendReportCoreAccelIr10Ext(u16 _channelID)
FillReportIRBasic(pReport->ir[0], pReport->ir[1]);
#endif
- if(g_Config.bNunchuckConnected)
+ if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
{
#if defined(HAVE_WX) && HAVE_WX
FillReportExtension(pReport->ext);
#endif
}
- else if(g_Config.bClassicControllerConnected)
+ else if(g_Config.iExtensionConnected == EXT_CLASSIC_CONTROLLER)
{
#if defined(HAVE_WX) && HAVE_WX
FillReportClassicExtension(_ext);
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp
index 20391dc3ab..6323780324 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,9 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#ifndef _EMU_DEFINITIONS_
#define _EMU_DEFINITIONS_
@@ -29,8 +26,6 @@
#include "wiimote_hid.h"
#include "EmuDefinitions.h"
#include "Encryption.h"
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
-//////////////////////////
extern SWiimoteInitialize g_WiimoteInitialize;
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h
index 2d8123eb6c..4e7bba7208 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -29,7 +29,6 @@
#include "wiimote_hid.h" // Local
#include "Encryption.h"
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp
index c4ec90248f..9400807761 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include
#include
@@ -37,9 +33,7 @@
#include "EmuSubroutines.h"
#include "EmuMain.h"
#include "Encryption.h" // for extension encryption
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
-////////////////////////////////////
namespace WiiMoteEmu
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
index c3294db199..f36cfd0a47 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include
#include
@@ -36,9 +32,7 @@
#include "EmuSubroutines.h"
#include "EmuMain.h"
#include "Encryption.h" // for extension encryption
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
-////////////////////////////////////
extern SWiimoteInitialize g_WiimoteInitialize;
namespace WiiMoteEmu
@@ -358,7 +352,7 @@ void UpdateEeprom()
INFO_LOG(CONSOLE, "\nUpdateEeprom: %i %i %i\n",
WiiMoteEmu::g_Eeprom[22], WiiMoteEmu::g_Eeprom[23], WiiMoteEmu::g_Eeprom[28]);
- if(g_Config.bNunchuckConnected)
+ if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
{
g_nu.cal_zero.x = g_RegExt[0x20];
g_nu.cal_zero.y = g_RegExt[0x21];
@@ -377,7 +371,7 @@ void UpdateEeprom()
WiiMoteEmu::g_RegExt[0x2a], WiiMoteEmu::g_RegExt[0x2d],
WiiMoteEmu::g_RegExt[0x20], WiiMoteEmu::g_RegExt[0x21], WiiMoteEmu::g_RegExt[0x26]);
}
- else if(g_Config.bClassicControllerConnected)
+ else if(g_Config.iExtensionConnected == EXT_CLASSIC_CONTROLLER)
{
g_ClassicContCalibration.Lx.max = g_RegExt[0x20];
g_ClassicContCalibration.Lx.min = g_RegExt[0x21];
@@ -447,19 +441,19 @@ void ResetVariables()
void SetDefaultExtensionRegistry()
{
// Copy extension id and calibration to its register
- if(g_Config.bNunchuckConnected)
+ if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
{
memcpy(g_RegExt + 0x20, nunchuck_calibration, sizeof(nunchuck_calibration));
memcpy(g_RegExt + 0x30, nunchuck_calibration, sizeof(nunchuck_calibration));
memcpy(g_RegExt + 0xfa, nunchuck_id, sizeof(nunchuck_id));
}
- else if(g_Config.bClassicControllerConnected)
+ else if(g_Config.iExtensionConnected == EXT_CLASSIC_CONTROLLER)
{
memcpy(g_RegExt + 0x20, classic_calibration, sizeof(classic_calibration));
memcpy(g_RegExt + 0x30, classic_calibration, sizeof(classic_calibration));
memcpy(g_RegExt + 0xfa, classic_id, sizeof(classic_id));
}
- else if(g_Config.bGuitarConnected)
+ else if(g_Config.iExtensionConnected == EXT_GUITARHERO3_CONTROLLER)
{
// memcpy(g_RegExt + 0x20, classic_calibration, sizeof(classic_calibration));
// memcpy(g_RegExt + 0x30, classic_calibration, sizeof(classic_calibration));
@@ -787,4 +781,4 @@ void Update()
}
-} // end of namespace
+} // end of namespace
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h
index b2a96ae109..db68e9cf11 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp
index 4db783bfdf..44148d1d55 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuPad.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include
#include
@@ -36,9 +32,7 @@
#include "EmuSubroutines.h"
#include "EmuMain.h"
#include "Encryption.h" // for extension encryption
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
-////////////////////////////////////
extern SWiimoteInitialize g_WiimoteInitialize;
@@ -192,4 +186,3 @@ void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONT
} // end of namespace WiiMoteEmu
-
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp
index cdac1c6215..08b982884b 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -36,9 +36,6 @@
// ================
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include
#include
@@ -48,7 +45,6 @@
#include "EmuMain.h" // Local
#include "EmuSubroutines.h"
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // for g_Config
/////////////////////////////////
@@ -580,10 +576,10 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension)
if (Extension == -1)
{
// Read config value for this one
- if(g_Config.bNunchuckConnected || g_Config.bClassicControllerConnected)
- pStatus->extension = 1;
- else
+ if(g_Config.iExtensionConnected == EXT_NONE)
pStatus->extension = 0;
+ else
+ pStatus->extension = 1;
}
else
{
diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h
index fc583fd165..99a02f71bd 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Include
-// ŻŻŻŻŻŻŻŻŻ
#ifndef _EMU_SUBFUNCTIONS_
#define _EMU_SUBFUNCTIONS_
@@ -32,13 +28,7 @@
#include "wiimote_hid.h" // Local
#include "EmuDefinitions.h"
#include "Encryption.h"
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
-////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
-// ŻŻŻŻŻŻŻŻŻ
extern SWiimoteInitialize g_WiimoteInitialize;
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp b/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp
index b3475406a9..2a53c5e55f 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/Encryption.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com)
// This program is free software: you can redistribute it and/or modify
@@ -19,7 +19,6 @@
#include "pluginspecs_wiimote.h"
#include "Common.h"
-#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
#include "Encryption.h"
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Encryption.h b/Source/Plugins/Plugin_Wiimote/Src/Encryption.h
index 6322a57215..0f6c1b23ca 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/Encryption.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/Encryption.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com)
// This program is free software: you can redistribute it and/or modify
diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp
index f6e81f6f39..640bc5ff88 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include
#include
@@ -33,9 +29,7 @@
#include "EmuMain.h"
#include "EmuSubroutines.h"
#include "EmuDefinitions.h"
-#include "Logging.h" // For startConsoleWin, Console::Print, GetConsoleHwnd
#include "Config.h" // For g_Config
-//////////////////////////////////
extern SWiimoteInitialize g_WiimoteInitialize;
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Logging.cpp b/Source/Plugins/Plugin_Wiimote/Src/Logging.cpp
deleted file mode 100644
index df398aa805..0000000000
--- a/Source/Plugins/Plugin_Wiimote/Src/Logging.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// 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/
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// -------------
-#include
-#include
-#ifdef _WIN32
- #include
-#endif
-
-#include "StringUtil.h"
-
-#define HAVE_WX 1
-#if defined(HAVE_WX) && HAVE_WX // wxWidgets
- #include // for the timestamps
-#endif
-///////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Settings
-// -------------
-
-// On and off
-bool g_consoleEnable = true;
-bool gSaveFile = true;
-#define DEBUG_WIIMOTE // On or off
-const int nFiles = 1;
-
-// Create handles
-#ifdef DEBUG_WIIMOTE
- FILE* __fStdOut[nFiles];
-#endif
-#ifdef _WIN32
- HANDLE __hStdOut = NULL;
-#endif
-
-//////////////////////////////
-
-
-// =======================================================================================
-/* Get Timestamp */
-// -------------
-std::string Tm(bool Ms)
-{
- #if defined(HAVE_WX) && HAVE_WX
- std::string Tmp;
- if(Ms)
- {
- wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
- Tmp = StringFromFormat("%02i:%02i:%03i",
- datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond());
- }
- else
- {
- wxDateTime datetime = wxDateTime::Now(); // Get timestamp
- Tmp = StringFromFormat("%02i:%02i",
- datetime.GetMinute(), datetime.GetSecond());
- }
- return Tmp;
- #else
- std::string Tmp = "";
- return Tmp;
- #endif
-}
-// ===========================
-
-
-// ---------------------------------------------------------------------------------------
-// File printf function
-// ---------------
-int PrintFile(int a, char *fmt, ...)
-{
-#if defined(DEBUG_WIIMOTE) && defined(_WIN32)
- if(gSaveFile)
- {
- char s[500]; // WARNING: mind this value
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsnprintf(s, 500, fmt, argptr); // remember to update this value to
- va_end(argptr);
-
- // ---------------------------------------------------------------------------------------
- if(__fStdOut[a]) // TODO: make this work, we have to set all default values to NULL
- //to make it work
- fprintf(__fStdOut[a], s);
- fflush(__fStdOut[0]); // Write file now, don't wait
- // -------------
-
- return(cnt);
- }
- else
- {
- return 0;
- }
-#else
- return 0;
-#endif
-}
diff --git a/Source/Plugins/Plugin_Wiimote/Src/Logging.h b/Source/Plugins/Plugin_Wiimote/Src/Logging.h
deleted file mode 100644
index 965aa9def1..0000000000
--- a/Source/Plugins/Plugin_Wiimote/Src/Logging.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// 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/
-
-#ifndef WIIMOTE_CONSOLE_H
-#define WIIMOTE_CONSOLE_H
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-#include
-//////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-std::string Tm(bool Ms = false);
-int PrintFile(int a, const char *fmt, ...);
-void ClearScreen();
-
-#ifdef _WIN32
- HWND GetConsoleHwnd(void);
-#endif
-///////////////////////////////
-
-#endif // WIIMOTE_CONSOLE_H
-
diff --git a/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp b/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp
index 5c6d52f91c..bff49ad067 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -15,10 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include // System
#include "wiiuse.h" // Externals
@@ -33,10 +29,11 @@
#include "EmuMain.h"
#include "main.h"
#if defined(HAVE_WX) && HAVE_WX
- #include "ConfigDlg.h"
+ #include "ConfigBasicDlg.h"
+ #include "ConfigRecordingDlg.h"
+ #include "ConfigPadDlg.h"
#endif
#include "Config.h"
-////////////////////////////////////////
namespace WiiMoteReal
{
@@ -114,8 +111,8 @@ void handle_event(struct wiimote_t* wm)
// Print battery status
#if defined(HAVE_WX) && HAVE_WX
- if(m_ConfigFrame && g_Config.bUpdateRealWiimote)
- m_ConfigFrame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5));
+ if(m_RecordingConfigFrame && g_Config.bUpdateRealWiimote)
+ m_RecordingConfigFrame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5));
#endif
// Create shortcut to the nunchuck
struct nunchuk_t* nc = NULL;
@@ -170,7 +167,7 @@ void handle_event(struct wiimote_t* wm)
//INFO_LOG(CONSOLE, "%s\n\n", Tmp.c_str());
#if defined(HAVE_WX) && HAVE_WX
- if(m_ConfigFrame)
+ if(m_RecordingConfigFrame)
{
// Produce adjusted accelerometer values
float _Gx = (float)(wm->accel.x - wm->accel_calib.cal_zero.x) / (float)wm->accel_calib.cal_g.x;
@@ -194,56 +191,58 @@ void handle_event(struct wiimote_t* wm)
if(g_Config.bUpdateRealWiimote)
{
// Update gauges
- m_ConfigFrame->m_GaugeRoll[0]->SetValue(wm->orient.roll + 180);
- m_ConfigFrame->m_GaugeRoll[1]->SetValue(wm->orient.pitch + 180);
+ m_RecordingConfigFrame->m_GaugeRoll[0]->SetValue(wm->orient.roll + 180);
+ m_RecordingConfigFrame->m_GaugeRoll[1]->SetValue(wm->orient.pitch + 180);
// Show g. forces between -3 and 3
- m_ConfigFrame->m_GaugeGForce[0]->SetValue((int)floor((wm->gforce.x * 100) + 300.5));
- m_ConfigFrame->m_GaugeGForce[1]->SetValue((int)floor((wm->gforce.y * 100) + 300.5));
- m_ConfigFrame->m_GaugeGForce[2]->SetValue((int)floor((wm->gforce.z * 100) + 300.5));
+ m_RecordingConfigFrame->m_GaugeGForce[0]->SetValue((int)floor((wm->gforce.x * 100) + 300.5));
+ m_RecordingConfigFrame->m_GaugeGForce[1]->SetValue((int)floor((wm->gforce.y * 100) + 300.5));
+ m_RecordingConfigFrame->m_GaugeGForce[2]->SetValue((int)floor((wm->gforce.z * 100) + 300.5));
- m_ConfigFrame->m_GaugeAccel[0]->SetValue(wm->accel.x);
- m_ConfigFrame->m_GaugeAccel[1]->SetValue(wm->accel.y);
- m_ConfigFrame->m_GaugeAccel[2]->SetValue(wm->accel.z);
+ m_RecordingConfigFrame->m_GaugeAccel[0]->SetValue(wm->accel.x);
+ m_RecordingConfigFrame->m_GaugeAccel[1]->SetValue(wm->accel.y);
+ m_RecordingConfigFrame->m_GaugeAccel[2]->SetValue(wm->accel.z);
- m_ConfigFrame->m_TextIR->SetLabel(wxString::Format(
+ m_RecordingConfigFrame->m_TextIR->SetLabel(wxString::Format(
wxT("Cursor: %03u %03u\nDistance:%4.0f"), wm->ir.x, wm->ir.y, wm->ir.z));
- //m_ConfigFrame->m_TextAccNeutralCurrent->SetLabel(wxString::Format(
+ //m_RecordingConfigFrame->m_TextAccNeutralCurrent->SetLabel(wxString::Format(
// wxT("Current: %03u %03u %03u"), Gx, Gy, Gz));
- if(m_ConfigFrame->m_bRecording)
+ if(m_RecordingConfigFrame->m_bRecording)
INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", Gx, Gy, Gz);
//INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x\n", Gx, Gy, Gz);
}
// Send the data to be saved
//const u8* data = (const u8*)wm->event_buf;
- m_ConfigFrame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6),
+ m_RecordingConfigFrame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6),
(WIIUSE_USING_EXP(wm) ? 10 : 12));
// Turn recording on and off
- if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) m_ConfigFrame->DoRecordA(true);
- else m_ConfigFrame->DoRecordA(false);
+ if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) m_RecordingConfigFrame->DoRecordA(true);
+ else m_RecordingConfigFrame->DoRecordA(false);
// ------------------------------------
// Show roll and pitch in the status box
// --------------
- /*
+
if(!g_DebugData)
{
// Console::ClearScreen();
INFO_LOG(CONSOLE, "Roll:%03i Pitch:%03i\n", (int)wm->orient.roll, (int)wm->orient.pitch);
}
- // Convert Roll and Pitch from 180 to 0x8000
- int Roll = (int)wm->orient.roll * (0x8000 / 180);
- int Pitch = (int)wm->orient.pitch * (0x8000 / 180);
- // Convert it to the box
- m_ConfigFrame->Convert2Box(Roll);
- m_ConfigFrame->Convert2Box(Pitch);
- // Show roll and pitch in the axis boxes
- m_ConfigFrame->m_bmpDotRightOut[0]->SetPosition(wxPoint(Roll, Pitch));*/
- // ---------------------
+ if(m_PadConfigFrame)
+ {
+ // Convert Roll and Pitch from 180 to 0x8000
+ int Roll = (int)wm->orient.roll * (0x8000 / 180);
+ int Pitch = (int)wm->orient.pitch * (0x8000 / 180);
+ // Convert it to the box
+ m_PadConfigFrame->Convert2Box(Roll);
+ m_PadConfigFrame->Convert2Box(Pitch);
+ // Show roll and pitch in the axis boxes
+ m_PadConfigFrame->m_bmpDotRightOut[0]->SetPosition(wxPoint(Roll, Pitch));
+ }
}
#endif
}
@@ -251,20 +250,20 @@ void handle_event(struct wiimote_t* wm)
else
{
#if defined(HAVE_WX) && HAVE_WX
- if (m_ConfigFrame)
+ if (m_RecordingConfigFrame)
{
- m_ConfigFrame->m_GaugeRoll[0]->SetValue(0);
- m_ConfigFrame->m_GaugeRoll[1]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeRoll[0]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeRoll[1]->SetValue(0);
- m_ConfigFrame->m_GaugeGForce[0]->SetValue(0);
- m_ConfigFrame->m_GaugeGForce[1]->SetValue(0);
- m_ConfigFrame->m_GaugeGForce[2]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeGForce[0]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeGForce[1]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeGForce[2]->SetValue(0);
- m_ConfigFrame->m_GaugeAccel[0]->SetValue(0);
- m_ConfigFrame->m_GaugeAccel[1]->SetValue(0);
- m_ConfigFrame->m_GaugeAccel[2]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeAccel[0]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeAccel[1]->SetValue(0);
+ m_RecordingConfigFrame->m_GaugeAccel[2]->SetValue(0);
- m_ConfigFrame->m_TextIR->SetLabel(wxT("Cursor:\nDistance:"));
+ m_RecordingConfigFrame->m_TextIR->SetLabel(wxT("Cursor:\nDistance:"));
}
#endif
}
@@ -384,4 +383,3 @@ void ReadWiimote()
}; // end of namespace
-
diff --git a/Source/Plugins/Plugin_Wiimote/Src/SConscript b/Source/Plugins/Plugin_Wiimote/Src/SConscript
index a596bbe597..67a572e221 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/SConscript
+++ b/Source/Plugins/Plugin_Wiimote/Src/SConscript
@@ -19,7 +19,9 @@ files = [
]
if wmenv['HAVE_WX']:
files += [
- "ConfigDlg.cpp",
+ "ConfigBasicDlg.cpp",
+ "ConfigPadDlg.cpp",
+ "ConfigRecordingDlg.cpp",
"ConfigGamepad.cpp",
"ConfigRecording.cpp",
"Logging.cpp",
diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp
index 2930fae7f4..d79747fbd8 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -16,10 +16,8 @@
// http://code.google.com/p/dolphin-emu/
-//////////////////////////////////////////////////////////////////////////////////////////
// Current issues
-/* ŻŻŻŻŻŻŻŻŻŻŻŻŻ
-
+/*
The real Wiimote fails to answer the core correctly sometmes. Leading to an unwanted disconnection. And
there is currenty no functions to reconnect with the game. There are two ways to solve this:
1. Make a reconnect function in the IOS emulation
@@ -27,14 +25,8 @@ there is currenty no functions to reconnect with the game. There are two ways to
The first solution seems easier, if I knew a little better how the /dev/usb/oh1 and Wiimote functions
worked.
+*/
-/////////////////////////////////////////////*/
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include "Common.h" // Common
#include "StringUtil.h"
#include "Timer.h"
@@ -43,10 +35,14 @@ worked.
#include "EmuDefinitions.h" // Local
#include "wiimote_hid.h"
#include "main.h"
-#include "Logging.h"
#if defined(HAVE_WX) && HAVE_WX
- #include "ConfigDlg.h"
- WiimoteConfigDialog *m_ConfigFrame = NULL;
+ #include "ConfigPadDlg.h"
+ #include "ConfigRecordingDlg.h"
+ #include "ConfigBasicDlg.h"
+
+ WiimotePadConfigDialog *m_PadConfigFrame = NULL;
+ WiimoteRecordingConfigDialog *m_RecordingConfigFrame = NULL;
+ WiimoteBasicConfigDialog *m_BasicConfigFrame = NULL;
#endif
#include "Config.h"
#include "pluginspecs_wiimote.h"
@@ -54,12 +50,7 @@ worked.
#if HAVE_WIIUSE
#include "wiimote_real.h"
#endif
-///////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Declarations and definitions
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
SWiimoteInitialize g_WiimoteInitialize;
PLUGIN_GLOBALS* globals = NULL;
@@ -191,16 +182,16 @@ void DllConfig(HWND _hParent)
DoInitialize();
- if (!m_ConfigFrame)
- m_ConfigFrame = new WiimoteConfigDialog(GetParentedWxWindow(_hParent));
- else if (!m_ConfigFrame->GetParent()->IsShown())
- m_ConfigFrame->Close(true);
+ if (!m_BasicConfigFrame)
+ m_BasicConfigFrame = new WiimoteBasicConfigDialog(GetParentedWxWindow(_hParent));
+ else if (!m_BasicConfigFrame->GetParent()->IsShown())
+ m_BasicConfigFrame->Close(true);
// Only allow one open at a time
- if (!m_ConfigFrame->IsShown())
- m_ConfigFrame->ShowModal();
+ if (!m_BasicConfigFrame->IsShown())
+ m_BasicConfigFrame->ShowModal();
else
- m_ConfigFrame->Hide();
+ m_BasicConfigFrame->Hide();
#endif
}
@@ -222,7 +213,7 @@ void Initialize(void *init)
g_ISOId = g_WiimoteInitialize.ISOId;
// Load the settings
g_Config.Load();
- if(m_ConfigFrame) m_ConfigFrame->UpdateGUI();
+ if(m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
}
#endif
@@ -247,7 +238,7 @@ void Shutdown(void)
if (g_FrameOpen)
{
#if defined(HAVE_WX) && HAVE_WX
- if(m_ConfigFrame) m_ConfigFrame->UpdateGUI();
+ if(m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif
// Reset the variables
@@ -341,7 +332,7 @@ void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
g_EmulatorRunning = false;
g_WiimoteUnexpectedDisconnect = true;
#if defined(HAVE_WX) && HAVE_WX
- if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
+ if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif
return;
}
@@ -374,12 +365,12 @@ void Wiimote_Update()
{
// Tell us about the update rate, but only about once every second to avoid a major slowdown
#if defined(HAVE_WX) && HAVE_WX
- if (m_ConfigFrame)
+ if (m_RecordingConfigFrame)
{
GetUpdateRate();
if (g_UpdateWriteScreen > g_UpdateRate)
{
- m_ConfigFrame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate));
+ m_RecordingConfigFrame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate));
g_UpdateWriteScreen = 0;
}
g_UpdateWriteScreen++;
@@ -472,7 +463,9 @@ bool IsFocus()
HWND Parent = GetParent(RenderingWindow);
HWND TopLevel = GetParent(Parent);
// Allow updates when the config window is in focus to
- HWND Config = NULL; if (m_ConfigFrame) Config = (HWND)m_ConfigFrame->GetHWND();
+ HWND Config = NULL;
+ if (m_BasicConfigFrame)
+ Config = (HWND)m_BasicConfigFrame->GetHWND();
// Support both rendering to main window and not
if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config)
return true;
@@ -486,12 +479,7 @@ bool IsFocus()
// Turn off all extensions
void DisableExtensions()
{
- //g_Config.bMotionPlus = false;
- g_Config.bNunchuckConnected = false;
- g_Config.bClassicControllerConnected = false;
- //g_Config.bBalanceBoard = false;
- g_Config.bGuitarConnected = false;
- //g_Config.bDrums = false;
+ g_Config.iExtensionConnected = EXT_NONE;
}
@@ -539,7 +527,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
{
DisableExtensions();
#if defined(HAVE_WX) && HAVE_WX
- if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
+ if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif
}
}
@@ -574,12 +562,14 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
if(data[4] == 0x10)
{
if (!Emu) DisableExtensions();
- if (!Emu && data[7] == 0x00 && data[8] == 0x00) g_Config.bNunchuckConnected = true;
- if (!Emu && data[7] == 0x01 && data[8] == 0x01) g_Config.bClassicControllerConnected = true;
+ if (!Emu && data[7] == 0x00 && data[8] == 0x00)
+ g_Config.iExtensionConnected = EXT_NUNCHUCK;
+ if (!Emu && data[7] == 0x01 && data[8] == 0x01)
+ g_Config.iExtensionConnected = EXT_CLASSIC_CONTROLLER;
g_Config.Save();
WiiMoteEmu::UpdateEeprom();
#if defined(HAVE_WX) && HAVE_WX
- if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
+ if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif
INFO_LOG(CONSOLE, "%s", TmpData.c_str());
INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x\n\n", data[7], data[8]);
@@ -587,12 +577,14 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
else if(data[4] == 0x50)
{
if (!Emu) DisableExtensions();
- if (!Emu && data[11] == 0x00 && data[12] == 0x00) g_Config.bNunchuckConnected = true;
- if (!Emu && data[11] == 0x01 && data[12] == 0x01) g_Config.bClassicControllerConnected = true;
+ if (!Emu && data[11] == 0x00 && data[12] == 0x00)
+ g_Config.iExtensionConnected = EXT_NUNCHUCK;
+ if (!Emu && data[11] == 0x01 && data[12] == 0x01)
+ g_Config.iExtensionConnected = EXT_CLASSIC_CONTROLLER;
g_Config.Save();
WiiMoteEmu::UpdateEeprom();
#if defined(HAVE_WX) && HAVE_WX
- if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
+ if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif
INFO_LOG(CONSOLE, "%s", TmpData.c_str());
INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x\n\n", data[7], data[8], data[9], data[10], data[11], data[12]);
@@ -632,7 +624,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
if(WiiMoteEmu::g_Encryption)
wiimote_decrypt(&WiiMoteEmu::g_ExtKey, &data[0x07], 0x00, (data[4] >> 0x04) + 1);
- if (g_Config.bNunchuckConnected)
+ if (g_Config.iExtensionConnected == EXT_NUNCHUCK)
{
INFO_LOG(CONSOLE, "\nGame got the Nunchuck calibration:\n");
INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 0]);
@@ -1044,9 +1036,9 @@ double GetDoubleTime()
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp
- /* Remove a few years. We only really want enough seconds to make sure that we are
- detecting actual actions, perhaps 60 seconds is enough really, but I leave a
- year of seconds anyway, in case the user's clock is incorrect or something like that */
+ // Remove a few years. We only really want enough seconds to make sure that we are
+ // detecting actual actions, perhaps 60 seconds is enough really, but I leave a
+ // year of seconds anyway, in case the user's clock is incorrect or something like that
TmpSeconds = TmpSeconds - (38 * 365 * 24 * 60 * 60);
//if (TmpSeconds < 0) return 0; // Check the the user's clock is working somewhat
diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.h b/Source/Plugins/Plugin_Wiimote/Src/main.h
index a6d49b8dc5..e01f235540 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/main.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/main.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h
index 51a31b5ca6..62e4e220ea 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp
index a4df007d4c..f4ff5aeb54 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp
+++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include // System
#include
@@ -37,12 +34,8 @@
#include "EmuDefinitions.h"
#define EXCLUDE_H // Avoid certain declarations in wiimote_real.h
#include "wiimote_real.h"
-#if defined(HAVE_WX) && HAVE_WX
- #include "ConfigDlg.h"
-#endif
extern SWiimoteInitialize g_WiimoteInitialize;
-////////////////////////////////////////
namespace WiiMoteReal
diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h
index 6cb76bd29c..fd3215c7e8 100644
--- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h
+++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// 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
@@ -20,12 +20,8 @@
#define WIIMOTE_REAL_H
-//////////////////////////////////////////////////////////////////////////////////////////
-// Includes
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻ
#include "wiiuse.h"
#include "ChunkFile.h"
-///////////////////////////////////
namespace WiiMoteReal