diff --git a/SConstruct b/SConstruct
index d13dee7ba7..9e2995af67 100644
--- a/SConstruct
+++ b/SConstruct
@@ -66,6 +66,7 @@ dirs = [
'Source/Plugins/Plugin_DSP_LLE/Src',
'Source/Plugins/Plugin_DSP_NULL/Src',
'Source/Plugins/Plugin_PadSimple/Src',
+ 'Source/Plugins/Plugin_PadSimpleEvnt/Src',
'Source/Plugins/Plugin_nJoy_SDL/Src',
'Source/Plugins/Plugin_nJoy_Testing/Src',
'Source/Plugins/Plugin_Wiimote/Src',
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimple.vcproj b/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimple.vcproj
new file mode 100644
index 0000000000..8e3e8453ef
--- /dev/null
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimple.vcproj
@@ -0,0 +1,832 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp
new file mode 100644
index 0000000000..95882a560f
--- /dev/null
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp
@@ -0,0 +1,339 @@
+// 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/
+
+
+#include "ConfigDlg.h"
+#include "../PadSimple.h"
+
+#ifdef _WIN32
+#include "XInput.h"
+#include "../DirectInputBase.h"
+
+DInput m_dinput;
+#endif
+
+BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
+ EVT_CLOSE(ConfigDialog::OnClose)
+ EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick)
+ EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout)
+ EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged)
+ EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged)
+ EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged)
+ EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged)
+ EVT_CHECKBOX(ID_DISABLE,ConfigDialog::ControllerSettingsChanged)
+ EVT_BUTTON(CTL_A,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_B,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_X,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_Y,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_Z,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_START,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_L,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_R,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_MAINUP,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_MAINDOWN,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_MAINLEFT,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_MAINRIGHT,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_SUBUP,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_SUBDOWN,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_SUBLEFT,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_SUBRIGHT,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_DPADUP,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_DPADDOWN,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_DPADLEFT,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_DPADRIGHT,ConfigDialog::OnButtonClick)
+ EVT_BUTTON(CTL_HALFPRESS,ConfigDialog::OnButtonClick)
+END_EVENT_TABLE()
+
+ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
+: wxDialog(parent, id, title, position, size, style)
+{
+#ifdef _WIN32
+ m_dinput.Init((HWND)parent);
+#endif
+ clickedButton = NULL;
+ CreateGUIControls();
+ Fit();
+}
+
+ConfigDialog::~ConfigDialog()
+{
+}
+
+inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
+ const char *name, int ctl, int controller)
+{
+ wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
+ char keyStr[10] = {0};
+
+ hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
+ wxDefaultPosition, wxDefaultSize), 0,
+ wxALIGN_CENTER_VERTICAL|wxALL);
+#ifdef _WIN32
+ DInput::DIKToString(pad[controller].keyForControl[ctl], keyStr);
+#else
+ XKeyToString(pad[controller].keyForControl[ctl], keyStr);
+#endif
+
+ *button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
+ wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
+
+ hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL);
+
+ sizer->Add(hButton, 0, wxALIGN_RIGHT|wxALL);
+}
+
+void ConfigDialog::CreateGUIControls()
+{
+ // Notebook
+ m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
+
+ // Controller pages
+ m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
+ m_Notebook->AddPage(m_Controller[0], wxT("Controller 1"));
+ m_Controller[1] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE2, wxDefaultPosition, wxDefaultSize);
+ m_Notebook->AddPage(m_Controller[1], wxT("Controller 2"));
+ m_Controller[2] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE3, wxDefaultPosition, wxDefaultSize);
+ m_Notebook->AddPage(m_Controller[2], wxT("Controller 3"));
+ m_Controller[3] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE4, wxDefaultPosition, wxDefaultSize);
+ m_Notebook->AddPage(m_Controller[3], wxT("Controller 4"));
+
+ // Standard buttons
+ m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_About = new wxButton(this, ID_PAD_ABOUT, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+
+ // Put notebook and standard buttons in sizers
+ wxBoxSizer* sSButtons;
+ sSButtons = new wxBoxSizer(wxHORIZONTAL);
+ sSButtons->Add(m_About,0,wxALL, 5);
+ sSButtons->Add(0, 0, 1, wxEXPAND, 5);
+ sSButtons->Add(m_Close, 0, wxALL, 5);
+
+ wxBoxSizer* sMain;
+ sMain = new wxBoxSizer(wxVERTICAL);
+ sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
+ sMain->Add(sSButtons, 0, wxEXPAND, 5);
+
+ this->SetSizer(sMain);
+ this->Layout();
+
+#ifdef _WIN32
+ // Add connected XPads
+ for (int x = 0; x < 4; x++)
+ {
+ XINPUT_STATE xstate;
+ DWORD xresult = XInputGetState(x, &xstate);
+
+ if (xresult == ERROR_SUCCESS)
+ {
+ arrayStringFor_X360Pad.Add(wxString::Format("%i", x+1));
+ }
+ }
+#endif
+
+ for(int i = 0; i < 4; i++)
+ {
+ sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
+ sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
+ m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+#ifdef _WIN32
+ m_X360Pad[i] = new wxCheckBox(m_Controller[i], ID_X360PAD, wxT("Enable X360Pad"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_X360PadC[i] = new wxChoice(m_Controller[i], ID_X360PAD_CHOICE, wxDefaultPosition, wxDefaultSize, arrayStringFor_X360Pad, 0, wxDefaultValidator);
+ m_Rumble[i] = new wxCheckBox(m_Controller[i], ID_RUMBLE, wxT("Enable rumble"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+#endif
+ m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Attached[i]->SetValue(pad[i].bAttached);
+#ifdef _WIN32
+ if (arrayStringFor_X360Pad.IsEmpty())
+ {
+ m_X360Pad[i]->SetLabel(wxT("Enable X360Pad - No pad connected"));
+ m_X360Pad[i]->SetValue(false);
+ m_X360Pad[i]->Enable(false);
+ pad[i].bEnableXPad = false;
+ m_X360PadC[i]->Hide();
+ m_Rumble[i]->Hide();
+ }
+ else
+ {
+ m_X360Pad[i]->SetValue(pad[i].bEnableXPad);
+ m_X360PadC[i]->SetSelection(pad[i].XPadPlayer);
+ m_X360PadC[i]->Enable(m_X360Pad[i]->IsChecked());
+ m_Rumble[i]->SetValue(pad[i].bRumble);
+ m_Rumble[i]->Enable(m_X360Pad[i]->IsChecked());
+ }
+#endif
+ m_Disable[i]->SetValue(pad[i].bDisable);
+
+ sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
+ sDevice[i]->AddStretchSpacer();
+#ifdef _WIN32
+ sDevice[i]->Add(m_X360Pad[i], 0, wxEXPAND|wxALL, 1);
+ sDevice[i]->Add(m_X360PadC[i], 0, wxEXPAND|wxALL, 1);
+ sDevice[i]->Add(m_Rumble[i], 0, wxEXPAND|wxALL, 1);
+ sDevice[i]->AddStretchSpacer();
+#endif
+ sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
+ sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
+
+ sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons"));
+
+ AddControl(m_Controller[i], &(m_ButtonA[i]), sButtons[i], "A: ", CTL_A, i);
+ AddControl(m_Controller[i], &(m_ButtonB[i]), sButtons[i], "B: ", CTL_B, i);
+ AddControl(m_Controller[i], &(m_ButtonX[i]), sButtons[i], "X: ", CTL_X, i);
+ AddControl(m_Controller[i], &(m_ButtonY[i]), sButtons[i], "Y: ", CTL_Y, i);
+ AddControl(m_Controller[i], &(m_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i);
+ AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i);
+
+ sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers"));
+
+ AddControl(m_Controller[i], &(m_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i);
+ AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i);
+
+ sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers"));
+
+ AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i);
+
+ sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick"));
+
+ AddControl(m_Controller[i], &(m_StickUp[i]), sStick[i], "Up: ", CTL_MAINUP, i);
+ AddControl(m_Controller[i], &(m_StickDown[i]), sStick[i], "Down: ", CTL_MAINDOWN, i);
+ AddControl(m_Controller[i], &(m_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i);
+ AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, i);
+
+ sDPad[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("D-Pad"));
+
+ AddControl(m_Controller[i], &(m_DPadUp[i]), sDPad[i], "Up: ", CTL_DPADUP, i);
+ AddControl(m_Controller[i], &(m_DPadDown[i]), sDPad[i], "Down: ", CTL_DPADDOWN, i);
+ AddControl(m_Controller[i], &(m_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i);
+ AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, i);
+
+ sCStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("C-Stick"));
+
+ AddControl(m_Controller[i], &(m_CStickUp[i]), sCStick[i], "Up: ", CTL_SUBUP, i);
+ AddControl(m_Controller[i], &(m_CStickDown[i]), sCStick[i], "Down: ", CTL_SUBDOWN, i);
+ AddControl(m_Controller[i], &(m_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i);
+ AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i);
+
+ sPage[i] = new wxGridBagSizer(0, 0);
+ sPage[i]->SetFlexibleDirection(wxBOTH);
+ sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
+ sPage[i]->Add(sbDevice[i], wxGBPosition(0, 0), wxGBSpan(1, 5), wxEXPAND|wxALL, 1);
+ sPage[i]->Add(sButtons[i], wxGBPosition(1, 0), wxGBSpan(2, 1), wxALL, 1);
+ sPage[i]->Add(sTriggers[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 1);
+ sPage[i]->Add(sModifiers[i], wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 1);
+ sPage[i]->Add(sStick[i], wxGBPosition(1, 2), wxGBSpan(2, 1), wxALL, 1);
+ sPage[i]->Add(sDPad[i], wxGBPosition(1, 3), wxGBSpan(2, 1), wxALL, 1);
+ sPage[i]->Add(sCStick[i], wxGBPosition(1, 4), wxGBSpan(2, 1), wxALL, 1);
+ m_Controller[i]->SetSizer(sPage[i]);
+ sPage[i]->Layout();
+ }
+}
+
+void ConfigDialog::OnClose(wxCloseEvent& event)
+{
+#ifdef _WIN32
+ m_dinput.Free();
+#endif
+ EndModal(0);
+}
+
+void ConfigDialog::OnKeyDown(wxKeyEvent& event)
+{
+ if(clickedButton != NULL)
+ {
+ int page = m_Notebook->GetSelection();
+
+#ifdef _WIN32
+ m_dinput.Read();
+ for(int i = 0; i < 255; i++)
+ {
+ if(m_dinput.diks[i])
+ {
+ char keyStr[10] = {0};
+ pad[page].keyForControl[clickedButton->GetId()] = i;
+ DInput::DIKToString(i, keyStr);
+ clickedButton->SetLabel(wxString::FromAscii(keyStr));
+ break;
+ }
+ }
+#else
+ pad[page].keyForControl[clickedButton->GetId()] = wxCharCodeWXToX(event.GetKeyCode());
+ clickedButton->SetLabel(wxString::Format(_T("%c"), event.GetKeyCode()));
+#endif
+ clickedButton->Disconnect();
+ }
+
+ clickedButton = NULL;
+ event.Skip();
+}
+
+void ConfigDialog::OnCloseClick(wxCommandEvent& event)
+{
+ Close();
+}
+
+void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
+{
+ int page = m_Notebook->GetSelection();
+
+ switch (event.GetId())
+ {
+ case ID_ATTACHED:
+ pad[page].bAttached = m_Attached[page]->GetValue();
+ break;
+ case ID_X360PAD:
+ pad[page].bEnableXPad = event.IsChecked();
+ m_Rumble[page]->Enable(event.IsChecked());
+ m_X360PadC[page]->Enable(event.IsChecked());
+ break;
+ case ID_X360PAD_CHOICE:
+ pad[page].XPadPlayer = event.GetSelection();
+ break;
+ case ID_RUMBLE:
+ pad[page].bRumble = m_Rumble[page]->GetValue();
+ break;
+ case ID_DISABLE:
+ pad[page].bDisable = m_Disable[page]->GetValue();
+ break;
+ }
+}
+
+void ConfigDialog::OnButtonClick(wxCommandEvent& event)
+{
+ if(clickedButton)
+ {
+ clickedButton->SetLabel(oldLabel);
+ }
+ clickedButton = (wxButton *)event.GetEventObject();
+ oldLabel = clickedButton->GetLabel();
+ clickedButton->SetLabel(_("Press Key"));
+
+ clickedButton->Connect(wxID_ANY, wxEVT_KEY_DOWN,
+ wxKeyEventHandler(ConfigDialog::OnKeyDown),
+ (wxObject*)NULL, this);
+}
+void ConfigDialog::DllAbout(wxCommandEvent& event)
+{
+ wxString message;
+#ifdef _WIN32
+ message = _("A simple keyboard and XInput plugin for dolphin.");
+#else
+ message = _("A simple keyboard plugin for dolphin.");
+#endif
+
+ wxMessageBox(_T("Dolphin PadSimple Plugin\nBy ector and F|RES\n\n" + message),
+ _T("Dolphin PadSimple"), wxOK, this);
+}
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.h
new file mode 100644
index 0000000000..4161d06e5f
--- /dev/null
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.h
@@ -0,0 +1,123 @@
+// 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 __CONFIGDLG_H__
+#define __CONFIGDLG_H__
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifndef _WIN32
+#include "../XInputBase.h"
+#endif
+
+class ConfigDialog : public wxDialog
+{
+
+
+ public:
+ ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"),
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
+
+ virtual ~ConfigDialog();
+
+ private:
+ DECLARE_EVENT_TABLE();
+ wxNotebook *m_Notebook;
+ wxPanel *m_Controller[4];
+ wxButton *m_About;
+ wxButton *m_Close;
+
+ wxStaticBoxSizer *sbDevice[4];
+ wxBoxSizer *sDevice[4];
+ wxGridBagSizer *sPage[4];
+ wxStaticBoxSizer *sButtons[4];
+ wxStaticBoxSizer *sTriggers[4];
+ wxStaticBoxSizer *sModifiers[4];
+ wxStaticBoxSizer *sStick[4];
+ wxStaticBoxSizer *sCStick[4];
+ wxStaticBoxSizer *sDPad[4];
+
+ wxArrayString arrayStringFor_X360Pad;
+ wxCheckBox *m_X360Pad[4];
+ wxChoice *m_X360PadC[4];
+ wxCheckBox *m_Attached[4];
+ wxCheckBox *m_Disable[4];
+ wxCheckBox *m_Rumble[4];
+
+ wxButton *m_ButtonA[4];
+ wxButton *m_ButtonB[4];
+ wxButton *m_ButtonX[4];
+ wxButton *m_ButtonY[4];
+ wxButton *m_ButtonZ[4];
+ wxButton *m_ButtonStart[4];
+ wxButton *m_ButtonL[4];
+ wxButton *m_ButtonR[4];
+ wxButton *m_HalfPress[4];
+ wxButton *m_StickUp[4];
+ wxButton *m_StickDown[4];
+ wxButton *m_StickLeft[4];
+ wxButton *m_StickRight[4];
+ wxButton *m_CStickUp[4];
+ wxButton *m_CStickDown[4];
+ wxButton *m_CStickLeft[4];
+ wxButton *m_CStickRight[4];
+ wxButton *m_DPadUp[4];
+ wxButton *m_DPadDown[4];
+ wxButton *m_DPadLeft[4];
+ wxButton *m_DPadRight[4];
+
+ enum
+ {
+ ////GUI Enum Control ID Start
+ ID_CLOSE = 1000,
+ ID_NOTEBOOK,
+ ID_CONTROLLERPAGE1,
+ ID_CONTROLLERPAGE2,
+ ID_CONTROLLERPAGE3,
+ ID_CONTROLLERPAGE4,
+
+ ID_X360PAD_CHOICE,
+ ID_X360PAD,
+ ID_ATTACHED,
+ ID_DISABLE,
+ ID_RUMBLE,
+ ID_PAD_ABOUT
+ };
+
+ void OnClose(wxCloseEvent& event);
+ void CreateGUIControls();
+ void OnCloseClick(wxCommandEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+ void ControllerSettingsChanged(wxCommandEvent& event);
+ void OnButtonClick(wxCommandEvent& event);
+ void DllAbout(wxCommandEvent& event);
+
+ int keyPress;
+ wxButton *clickedButton;
+ wxString oldLabel;
+};
+
+#endif
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp
new file mode 100644
index 0000000000..14feeac09d
--- /dev/null
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp
@@ -0,0 +1,678 @@
+// 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/
+
+#include
+#include
+
+#include "Common.h"
+#include "pluginspecs_pad.h"
+#include "PadSimple.h"
+#include "IniFile.h"
+
+// FIXME
+#undef HAVE_WX
+#if defined(HAVE_WX) && HAVE_WX
+#include "GUI/ConfigDlg.h"
+#endif
+
+#ifdef _WIN32
+#include "XInput.h"
+#include "DirectInputBase.h"
+
+DInput dinput;
+//#elif defined(USE_SDL) && USE_SDL
+//#include
+
+#elif defined(HAVE_X11) && HAVE_X11
+
+#include
+#include
+#include
+#include
+
+Display* GXdsp;
+bool KeyStatus[NUMCONTROLS];
+#endif
+
+SPads pad[4];
+
+HINSTANCE g_hInstance;
+SPADInitialize g_PADInitialize;
+
+#define RECORD_SIZE (1024 * 128)
+SPADStatus recordBuffer[RECORD_SIZE];
+int count = 0;
+
+void RecordInput(const SPADStatus& _rPADStatus)
+{
+ if (count >= RECORD_SIZE)
+ {
+ return;
+ }
+
+ recordBuffer[count++] = _rPADStatus;
+}
+
+
+const SPADStatus& PlayRecord()
+{
+ if (count >= RECORD_SIZE){return(recordBuffer[0]);}
+
+ return(recordBuffer[count++]);
+}
+
+
+void LoadRecord()
+{
+ FILE* pStream = fopen("c:\\pad-record.bin", "rb");
+
+ if (pStream != NULL)
+ {
+ fread(recordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
+ fclose(pStream);
+ }
+}
+
+
+void SaveRecord()
+{
+ FILE* pStream = fopen("c:\\pad-record.bin", "wb");
+
+ if (pStream != NULL)
+ {
+ fwrite(recordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
+ fclose(pStream);
+ }
+}
+
+
+#ifdef _WIN32
+
+class wxDLLApp : public wxApp
+{
+ bool OnInit()
+ {
+ return true;
+ }
+};
+IMPLEMENT_APP_NO_MAIN(wxDLLApp)
+
+WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
+
+BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
+ DWORD dwReason, // reason called
+ LPVOID lpvReserved) // reserved
+{
+ switch (dwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ { //use wxInitialize() if you don't want GUI instead of the following 12 lines
+ wxSetInstance((HINSTANCE)hinstDLL);
+ int argc = 0;
+ char **argv = NULL;
+ wxEntryStart(argc, argv);
+ if ( !wxTheApp || !wxTheApp->CallOnInit() )
+ return FALSE;
+ }
+ break;
+
+ case DLL_PROCESS_DETACH:
+ wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
+ break;
+ default:
+ break;
+ }
+
+ g_hInstance = hinstDLL;
+ return(TRUE);
+}
+
+#endif
+
+
+void GetDllInfo(PLUGIN_INFO* _PluginInfo)
+{
+ _PluginInfo->Version = 0x0100;
+ _PluginInfo->Type = PLUGIN_TYPE_PAD;
+
+#ifdef DEBUGFAST
+ sprintf(_PluginInfo->Name, "Dolphin Pad Event (DebugFast)");
+#elif defined _DEBUG
+ sprintf(_PluginInfo->Name, "Dolphin Pad Event");
+#else
+ sprintf(_PluginInfo->Name, "Dolphin Pad Event (Debug)");
+#endif
+}
+
+void DllConfig(HWND _hParent)
+{
+ LoadConfig();
+#ifdef _WIN32
+ wxWindow win;
+ win.SetHWND(_hParent);
+ ConfigDialog frame(&win);
+ frame.ShowModal();
+ win.SetHWND(0);
+#elif defined(HAVE_WX) && HAVE_WX
+ ConfigDialog frame(NULL);
+ frame.ShowModal();
+#endif
+ SaveConfig();
+}
+
+void DllDebugger(HWND _hParent, bool Show) {
+}
+
+void PAD_Initialize(SPADInitialize _PADInitialize)
+{
+#ifdef RECORD_REPLAY
+ LoadRecord();
+#endif
+
+ g_PADInitialize = _PADInitialize;
+#ifdef _WIN32
+ dinput.Init((HWND)g_PADInitialize.hWnd);
+#elif defined(HAVE_X11) && HAVE_X11
+ GXdsp = (Display*)g_PADInitialize.hWnd;
+#endif
+
+ LoadConfig();
+}
+
+
+void PAD_Shutdown()
+{
+#ifdef RECORD_STORE
+ SaveRecord();
+#endif
+#ifdef _WIN32
+ dinput.Free();
+ // Kill xpad rumble
+ XINPUT_VIBRATION vib;
+ vib.wLeftMotorSpeed = 0;
+ vib.wRightMotorSpeed = 0;
+ for (int i = 0; i < 4; i++)
+ if (pad[i].bRumble)
+ XInputSetState(pad[i].XPadPlayer, &vib);
+#endif
+ SaveConfig();
+}
+
+
+const float kDeadZone = 0.1f;
+
+// Implement circular deadzone
+void ScaleStickValues(unsigned char* outx,
+ unsigned char* outy,
+ short inx, short iny)
+{
+ float x = ((float)inx + 0.5f) / 32767.5f;
+ float y = ((float)iny + 0.5f) / 32767.5f;
+
+ if ((x == 0.0f) && (y == 0.0f)) // to be safe
+ {
+ *outx = 0;
+ *outy = 0;
+ return;
+ }
+
+ float magnitude = sqrtf(x * x + y * y);
+ float nx = x / magnitude;
+ float ny = y / magnitude;
+
+ if (magnitude < kDeadZone){magnitude = kDeadZone;}
+
+ magnitude = (magnitude - kDeadZone) / (1.0f - kDeadZone);
+ magnitude *= magnitude; // another power may be more appropriate
+ nx *= magnitude;
+ ny *= magnitude;
+ int ix = (int)(nx * 100);
+ int iy = (int)(ny * 100);
+ *outx = 0x80 + ix;
+ *outy = 0x80 + iy;
+}
+
+
+#ifdef _WIN32
+void DInput_Read(int _numPAD, SPADStatus* _pPADStatus)
+{
+ dinput.Read();
+
+ int stickvalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100;
+ int triggervalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255;
+
+ // get the new keys
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINDOWN]] & 0xFF){_pPADStatus->stickY -= stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINUP]] & 0xFF){_pPADStatus->stickY += stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBLEFT]] & 0xFF){_pPADStatus->substickX -= stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBRIGHT]] & 0xFF){_pPADStatus->substickX += stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBDOWN]] & 0xFF){_pPADStatus->substickY -= stickvalue;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_SUBUP]] & 0xFF){_pPADStatus->substickY += stickvalue;}
+
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_L]] & 0xFF)
+ {
+ _pPADStatus->button |= PAD_TRIGGER_L;
+ _pPADStatus->triggerLeft = triggervalue;
+ }
+
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_R]] & 0xFF)
+ {
+ _pPADStatus->button |= PAD_TRIGGER_R;
+ _pPADStatus->triggerRight = triggervalue;
+ }
+
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_A]] & 0xFF)
+ {
+ _pPADStatus->button |= PAD_BUTTON_A;
+ _pPADStatus->analogA = 255;
+ }
+
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_B]] & 0xFF)
+ {
+ _pPADStatus->button |= PAD_BUTTON_B;
+ _pPADStatus->analogB = 255;
+ }
+
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_X]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_X;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_Y]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_Y;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_Z]] & 0xFF){_pPADStatus->button |= PAD_TRIGGER_Z;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADUP]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_UP;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADDOWN]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_DOWN;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADLEFT]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_LEFT;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_DPADRIGHT]]& 0xFF){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
+ if (dinput.diks[pad[_numPAD].keyForControl[CTL_START]] & 0xFF){_pPADStatus->button |= PAD_BUTTON_START;}
+}
+
+bool XInput_Read(int XPadPlayer, SPADStatus* _pPADStatus)
+{
+ const int base = 0x80;
+ XINPUT_STATE xstate;
+ DWORD xresult = XInputGetState(XPadPlayer, &xstate);
+
+ // Let's .. yes, let's use XINPUT!
+ if (xresult == ERROR_SUCCESS)
+ {
+ const XINPUT_GAMEPAD& xpad = xstate.Gamepad;
+
+ if ((_pPADStatus->stickX == base) && (_pPADStatus->stickY == base))
+ {
+ ScaleStickValues(
+ &_pPADStatus->stickX,
+ &_pPADStatus->stickY,
+ xpad.sThumbLX,
+ xpad.sThumbLY);
+ }
+
+ if ((_pPADStatus->substickX == base) && (_pPADStatus->substickY == base))
+ {
+ ScaleStickValues(
+ &_pPADStatus->substickX,
+ &_pPADStatus->substickY,
+ xpad.sThumbRX,
+ xpad.sThumbRY);
+ }
+
+ _pPADStatus->triggerLeft = xpad.bLeftTrigger;
+ _pPADStatus->triggerRight = xpad.bRightTrigger;
+
+ if (xpad.bLeftTrigger > 200) {_pPADStatus->button |= PAD_TRIGGER_L;}
+ if (xpad.bRightTrigger > 200) {_pPADStatus->button |= PAD_TRIGGER_R;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_A) {_pPADStatus->button |= PAD_BUTTON_A;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_X) {_pPADStatus->button |= PAD_BUTTON_B;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_B) {_pPADStatus->button |= PAD_BUTTON_X;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_Y) {_pPADStatus->button |= PAD_BUTTON_Y;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER){_pPADStatus->button |= PAD_TRIGGER_Z;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_START) {_pPADStatus->button |= PAD_BUTTON_START;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) {_pPADStatus->button |= PAD_BUTTON_LEFT;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) {_pPADStatus->button |= PAD_BUTTON_RIGHT;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_UP) {_pPADStatus->button |= PAD_BUTTON_UP;}
+ if (xpad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) {_pPADStatus->button |= PAD_BUTTON_DOWN;}
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+#endif
+
+#if defined(HAVE_X11) && HAVE_X11
+// The graphics plugin in the PCSX2 design leaves a lot of the window processing to the pad plugin, weirdly enough.
+void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
+{
+ // Do all the stuff we need to do once per frame here
+ if (_numPAD != 0) {
+ return;
+ }
+ // This code is from Zerofrog's pcsx2 pad plugin
+ XEvent E;
+ //int keyPress=0, keyRelease=0;
+ KeySym key;
+
+ // keyboard input
+ int num_events;
+ for (num_events = XPending(GXdsp);num_events > 0;num_events--) {
+ XNextEvent(GXdsp, &E);
+ switch (E.type) {
+ case KeyPress:
+ //_KeyPress(pad, XLookupKeysym((XKeyEvent *)&E, 0)); break;
+
+ key = XLookupKeysym((XKeyEvent*)&E, 0);
+
+ if((key >= XK_F1 && key <= XK_F9) ||
+ key == XK_Shift_L || key == XK_Shift_R ||
+ key == XK_Control_L || key == XK_Control_R) {
+ XPutBackEvent(GXdsp, &E);
+ break;
+ }
+
+ int i;
+ for (i = 0; i < NUMCONTROLS; i++) {
+ if (key == pad[_numPAD].keyForControl[i]) {
+ KeyStatus[i] = true;
+ break;
+ }
+ }
+
+
+ break;
+
+ case KeyRelease:
+
+ key = XLookupKeysym((XKeyEvent*)&E, 0);
+
+ if((key >= XK_F1 && key <= XK_F9) ||
+ key == XK_Shift_L || key == XK_Shift_R ||
+ key == XK_Control_L || key == XK_Control_R) {
+ XPutBackEvent(GXdsp, &E);
+ break;
+ }
+
+ //_KeyRelease(pad, XLookupKeysym((XKeyEvent *)&E, 0));
+ for (i = 0; i < NUMCONTROLS; i++) {
+ if (key == pad[_numPAD].keyForControl[i]) {
+ KeyStatus[i] = false;
+ break;
+ }
+ }
+
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ int stickvalue = (KeyStatus[CTL_HALFPRESS]) ? 40 : 100;
+ int triggervalue = (KeyStatus[CTL_HALFPRESS]) ? 100 : 255;
+
+ if (KeyStatus[CTL_MAINLEFT]){_pPADStatus->stickX -= stickvalue;}
+ if (KeyStatus[CTL_MAINUP]){_pPADStatus->stickY += stickvalue;}
+ if (KeyStatus[CTL_MAINRIGHT]){_pPADStatus->stickX += stickvalue;}
+ if (KeyStatus[CTL_MAINDOWN]){_pPADStatus->stickY -= stickvalue;}
+
+ if (KeyStatus[CTL_SUBLEFT]){_pPADStatus->substickX -= stickvalue;}
+ if (KeyStatus[CTL_SUBUP]){_pPADStatus->substickY += stickvalue;}
+ if (KeyStatus[CTL_SUBRIGHT]){_pPADStatus->substickX += stickvalue;}
+ if (KeyStatus[CTL_SUBDOWN]){_pPADStatus->substickY -= stickvalue;}
+
+ if (KeyStatus[CTL_DPADLEFT]){_pPADStatus->button |= PAD_BUTTON_LEFT;}
+ if (KeyStatus[CTL_DPADUP]){_pPADStatus->button |= PAD_BUTTON_UP;}
+ if (KeyStatus[CTL_DPADRIGHT]){_pPADStatus->button |= PAD_BUTTON_RIGHT;}
+ if (KeyStatus[CTL_DPADDOWN]){_pPADStatus->button |= PAD_BUTTON_DOWN;}
+
+ if (KeyStatus[CTL_A]) {
+ _pPADStatus->button |= PAD_BUTTON_A;
+ _pPADStatus->analogA = 255;
+ }
+
+ if (KeyStatus[CTL_B]) {
+ _pPADStatus->button |= PAD_BUTTON_B;
+ _pPADStatus->analogB = 255;
+ }
+
+ if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;}
+ if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
+ if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
+
+ if (KeyStatus[CTL_L]) {
+ _pPADStatus->button |= PAD_TRIGGER_L;
+ _pPADStatus->triggerLeft = triggervalue;
+ }
+
+ if (KeyStatus[CTL_R]) {
+ _pPADStatus->button |= PAD_TRIGGER_R;
+ _pPADStatus->triggerRight = triggervalue;
+ }
+
+ if (KeyStatus[CTL_START]){_pPADStatus->button |= PAD_BUTTON_START;}
+ if (KeyStatus[CTL_MIC])
+ _pPADStatus->MicButton = true;
+ else
+ _pPADStatus->MicButton = false;
+}
+
+
+#endif
+
+void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
+{
+ // Check if all is okay
+ if ((_pPADStatus == NULL))
+ {
+ return;
+ }
+
+#ifdef RECORD_REPLAY
+ *_pPADStatus = PlayRecord();
+ return;
+#endif
+
+ const int base = 0x80;
+ // Clear pad
+ memset(_pPADStatus, 0, sizeof(SPADStatus));
+
+ _pPADStatus->stickY = base;
+ _pPADStatus->stickX = base;
+ _pPADStatus->substickX = base;
+ _pPADStatus->substickY = base;
+ _pPADStatus->button |= PAD_USE_ORIGIN;
+#ifdef _WIN32
+ // Just update pad on focus
+ // TODO fix g_PADInitialize.hWnd != DolphinWX frame
+ if (pad[_numPAD].bDisable)
+ {
+ if (g_PADInitialize.hWnd != GetForegroundWindow())
+ return;
+ }
+ // Dolphin doesn't really care about the pad error codes anyways...
+ _pPADStatus->err = PAD_ERR_NONE;
+ if (pad[_numPAD].bEnableXPad) XInput_Read(pad[_numPAD].XPadPlayer, _pPADStatus);
+ DInput_Read(_numPAD, _pPADStatus);
+#elif defined(HAVE_X11) && HAVE_X11
+ _pPADStatus->err = PAD_ERR_NONE;
+ X11_Read(_numPAD, _pPADStatus);
+#endif
+
+#ifdef RECORD_STORE
+ RecordInput(*_pPADStatus);
+#endif
+}
+
+
+// Rough approximation of GC behaviour - needs improvement.
+void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
+{
+#ifdef _WIN32
+ if (pad[_numPAD].bEnableXPad)
+ {
+ static int a = 0;
+
+ if ((_uType == 0) || (_uType == 2))
+ {
+ a = 0;
+ }
+ else if (_uType == 1)
+ {
+ a = _uStrength > 2 ? 8000 : 0;
+ }
+
+ a = int ((float)a * 0.96f);
+
+ if (!pad[_numPAD].bRumble)
+ {
+ a = 0;
+ }
+
+ XINPUT_VIBRATION vib;
+ vib.wLeftMotorSpeed = a; //_uStrength*100;
+ vib.wRightMotorSpeed = a; //_uStrength*100;
+ XInputSetState(pad[_numPAD].XPadPlayer, &vib);
+ }
+#endif
+}
+
+unsigned int PAD_GetAttachedPads()
+{
+ unsigned int connected = 0;
+
+ LoadConfig();
+
+ if(pad[0].bAttached)
+ connected |= 1;
+ if(pad[1].bAttached)
+ connected |= 2;
+ if(pad[2].bAttached)
+ connected |= 4;
+ if(pad[3].bAttached)
+ connected |= 8;
+
+ return connected;
+}
+
+
+void LoadConfig()
+{
+ // Initialize first pad to standard controls
+#ifdef _WIN32
+ const int defaultKeyForControl[NUMCONTROLS] =
+ {
+ DIK_X, //A
+ DIK_Z,
+ DIK_S,
+ DIK_C,
+ DIK_D,
+ DIK_RETURN,
+ DIK_Q,
+ DIK_W,
+ DIK_UP, //mainstick
+ DIK_DOWN,
+ DIK_LEFT,
+ DIK_RIGHT,
+ DIK_I, //substick
+ DIK_K,
+ DIK_J,
+ DIK_L,
+ DIK_T, //dpad
+ DIK_G,
+ DIK_F,
+ DIK_H,
+ DIK_LSHIFT
+ };
+#else
+ const int defaultKeyForControl[NUMCONTROLS] =
+ {
+ XK_x, //A
+ XK_z,
+ XK_s,
+ XK_c,
+ XK_d,
+ XK_Return,
+ XK_q,
+ XK_w,
+ XK_Up, //mainstick
+ XK_Down,
+ XK_Left,
+ XK_Right,
+ XK_i, //substick
+ XK_K,
+ XK_j,
+ XK_l,
+ XK_t, //dpad
+ XK_g,
+ XK_f,
+ XK_h,
+ XK_Shift_L, //halfpress
+ XK_p
+ };
+#endif
+ IniFile file;
+ file.Load(FULL_CONFIG_DIR "pad.ini");
+
+ for(int i = 0; i < 4; i++)
+ {
+ char SectionName[32];
+ sprintf(SectionName, "PAD%i", i+1);
+
+ file.Get(SectionName, "UseXPad", &pad[i].bEnableXPad, i==0);
+ file.Get(SectionName, "Attached", &pad[i].bAttached, i==0);
+ file.Get(SectionName, "DisableOnBackground", &pad[i].bDisable, false);
+ file.Get(SectionName, "Rumble", &pad[i].bRumble, true);
+ file.Get(SectionName, "XPad#", &pad[i].XPadPlayer);
+
+ for (int x = 0; x < NUMCONTROLS; x++)
+ {
+ file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x],
+ (i==0)?defaultKeyForControl[x]:0);
+#if defined(HAVE_X11) && HAVE_X11
+ // In linux we have a problem assigning the upper case of the
+ // keys because they're not being recognized
+ pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]);
+#endif
+ }
+ }
+}
+
+
+void SaveConfig()
+{
+ IniFile file;
+ file.Load(FULL_CONFIG_DIR "pad.ini");
+
+ for(int i = 0; i < 4; i++)
+ {
+ char SectionName[32];
+ sprintf(SectionName, "PAD%i", i+1);
+
+ file.Set(SectionName, "UseXPad", pad[i].bEnableXPad);
+ file.Set(SectionName, "Attached", pad[i].bAttached);
+ file.Set(SectionName, "DisableOnBackground", pad[i].bDisable);
+ file.Set(SectionName, "Rumble", pad[i].bRumble);
+ file.Set(SectionName, "XPad#", pad[i].XPadPlayer);
+
+ for (int x = 0; x < NUMCONTROLS; x++)
+ {
+ file.Set(SectionName, controlNames[x], pad[i].keyForControl[x]);
+ }
+ }
+ file.Save(FULL_CONFIG_DIR "pad.ini");
+}
+
+
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h
new file mode 100644
index 0000000000..8644217420
--- /dev/null
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h
@@ -0,0 +1,90 @@
+// 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 __PADSIMPLE_H__
+#define __PADSIMPLE_H__
+
+// Controls
+enum
+{
+ CTL_A = 0,
+ CTL_B,
+ CTL_X,
+ CTL_Y,
+ CTL_Z,
+ CTL_START,
+ CTL_L,
+ CTL_R,
+ CTL_MAINUP,
+ CTL_MAINDOWN,
+ CTL_MAINLEFT,
+ CTL_MAINRIGHT,
+ CTL_SUBUP,
+ CTL_SUBDOWN,
+ CTL_SUBLEFT,
+ CTL_SUBRIGHT,
+ CTL_DPADUP,
+ CTL_DPADDOWN,
+ CTL_DPADLEFT,
+ CTL_DPADRIGHT,
+ CTL_HALFPRESS,
+ CTL_MIC,
+ NUMCONTROLS
+};
+
+// Control names
+static const char* controlNames[] =
+{
+ "A_button",
+ "B_button",
+ "X_button",
+ "Y_button",
+ "Z_trigger",
+ "Start",
+ "L_button",
+ "R_button",
+ "Main_stick_up",
+ "Main_stick_down",
+ "Main_stick_left",
+ "Main_stick_right",
+ "Sub_stick_up",
+ "Sub_stick_down",
+ "Sub_stick_left",
+ "Sub_stick_right",
+ "D-Pad_up",
+ "D-Pad_down",
+ "D-Pad_left",
+ "D-Pad_right",
+ "half_press_toggle",
+ "Mic-button",
+};
+
+struct SPads {
+ bool bEnableXPad; // Use an XPad in addition to the keyboard?
+ bool bAttached; // Pad is "attached" to the gamecube/wii
+ bool bDisable; // Disabled when dolphin isn't in focus
+ bool bRumble; // Rumble for xpad
+ int XPadPlayer; // Player# of the xpad
+ unsigned int keyForControl[NUMCONTROLS];// Keyboard mapping
+};
+
+extern SPads pad[];
+
+void LoadConfig();
+void SaveConfig();
+
+#endif
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript b/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript
new file mode 100644
index 0000000000..ddb1ec2d6c
--- /dev/null
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript
@@ -0,0 +1,24 @@
+# -*- python -*-
+
+Import('env')
+import sys
+
+name = "Plugin_PadSimpleEvnt"
+
+if not env['GLTEST']:
+ print name + " Doesn't work without testgl"
+ Return()
+
+files = [
+ "PadSimple.cpp",
+ ]
+padenv = env.Clone()
+
+if padenv['HAVE_WX']:
+ files += [
+# "GUI/ConfigDlg.cpp",
+ ]
+
+padenv.Append(LIBS = [ 'common' ])
+
+padenv.SharedLibrary(env['plugin_dir']+name, files)
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp b/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp
index 48a83984cc..4723b58e53 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp
@@ -146,8 +146,9 @@ void Video_DoState(unsigned char **ptr, int mode) {
void Video_Prepare(void)
{
OpenGL_MakeCurrent();
- if (!Renderer::Create2()) {
- g_VideoInitialize.pLog("Renderer::Create2 failed\n", TRUE);
+
+ if (!Renderer::Init()) {
+ g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
PanicAlert("Can't create opengl renderer. You might be missing some required opengl extensions, check the logs for more info");
exit(1);
}
diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp
index 24c7b10910..e737a82cc7 100644
--- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp
+++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp
@@ -50,6 +50,10 @@ CONTROLLER_MAPPING joysticks[4];
bool emulator_running = FALSE;
HWND m_hWnd; // Handle to window
+// TODO: fix this dirty hack to stop missing symbols
+void __Log(int log, const char *format, ...) {}
+void __Logv(int log, int v, const char *format, ...) {}
+
// Rumble
#ifdef _WIN32