mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
More padsimpleevnt work
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1723 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -18,13 +18,7 @@
|
|||||||
|
|
||||||
#include "ConfigDlg.h"
|
#include "ConfigDlg.h"
|
||||||
#include "../PadSimple.h"
|
#include "../PadSimple.h"
|
||||||
|
#include "EventHandler.h"
|
||||||
#ifdef _WIN32
|
|
||||||
#include "XInput.h"
|
|
||||||
#include "../DirectInputBase.h"
|
|
||||||
|
|
||||||
DInput m_dinput;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||||
EVT_CLOSE(ConfigDialog::OnClose)
|
EVT_CLOSE(ConfigDialog::OnClose)
|
||||||
@ -61,9 +55,6 @@ END_EVENT_TABLE()
|
|||||||
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||||
: wxDialog(parent, id, title, position, size, style)
|
: wxDialog(parent, id, title, position, size, style)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
|
||||||
m_dinput.Init((HWND)parent);
|
|
||||||
#endif
|
|
||||||
clickedButton = NULL;
|
clickedButton = NULL;
|
||||||
CreateGUIControls();
|
CreateGUIControls();
|
||||||
Fit();
|
Fit();
|
||||||
@ -82,11 +73,7 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
|
|||||||
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
||||||
wxDefaultPosition, wxDefaultSize), 0,
|
wxDefaultPosition, wxDefaultSize), 0,
|
||||||
wxALIGN_CENTER_VERTICAL|wxALL);
|
wxALIGN_CENTER_VERTICAL|wxALL);
|
||||||
#ifdef _WIN32
|
EventHandler::SFKeyToString(pad[controller].keyForControl[ctl], keyStr);
|
||||||
DInput::DIKToString(pad[controller].keyForControl[ctl], keyStr);
|
|
||||||
#else
|
|
||||||
XKeyToString(pad[controller].keyForControl[ctl], keyStr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
|
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
|
||||||
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
||||||
@ -130,61 +117,17 @@ void ConfigDialog::CreateGUIControls()
|
|||||||
this->SetSizer(sMain);
|
this->SetSizer(sMain);
|
||||||
this->Layout();
|
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++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
|
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
|
||||||
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
|
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
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_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);
|
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);
|
m_Disable[i]->SetValue(pad[i].bDisable);
|
||||||
|
|
||||||
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
||||||
sDevice[i]->AddStretchSpacer();
|
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);
|
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
|
||||||
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
|
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
|
||||||
|
|
||||||
@ -244,9 +187,6 @@ void ConfigDialog::CreateGUIControls()
|
|||||||
|
|
||||||
void ConfigDialog::OnClose(wxCloseEvent& event)
|
void ConfigDialog::OnClose(wxCloseEvent& event)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
|
||||||
m_dinput.Free();
|
|
||||||
#endif
|
|
||||||
EndModal(0);
|
EndModal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,23 +196,9 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
int page = m_Notebook->GetSelection();
|
int page = m_Notebook->GetSelection();
|
||||||
|
|
||||||
#ifdef _WIN32
|
pad[page].keyForControl[clickedButton->GetId()] =
|
||||||
m_dinput.Read();
|
EventHandler::wxCharCodeWXToSF(event.GetKeyCode());
|
||||||
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()));
|
clickedButton->SetLabel(wxString::Format(_T("%c"), event.GetKeyCode()));
|
||||||
#endif
|
|
||||||
clickedButton->Disconnect();
|
clickedButton->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,17 +220,6 @@ void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
|
|||||||
case ID_ATTACHED:
|
case ID_ATTACHED:
|
||||||
pad[page].bAttached = m_Attached[page]->GetValue();
|
pad[page].bAttached = m_Attached[page]->GetValue();
|
||||||
break;
|
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:
|
case ID_DISABLE:
|
||||||
pad[page].bDisable = m_Disable[page]->GetValue();
|
pad[page].bDisable = m_Disable[page]->GetValue();
|
||||||
break;
|
break;
|
||||||
@ -328,12 +243,8 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event)
|
|||||||
void ConfigDialog::DllAbout(wxCommandEvent& event)
|
void ConfigDialog::DllAbout(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxString message;
|
wxString message;
|
||||||
#ifdef _WIN32
|
|
||||||
message = _("A simple keyboard and XInput plugin for dolphin.");
|
|
||||||
#else
|
|
||||||
message = _("A simple keyboard plugin for dolphin.");
|
message = _("A simple keyboard plugin for dolphin.");
|
||||||
#endif
|
|
||||||
|
|
||||||
wxMessageBox(_T("Dolphin PadSimple Plugin\nBy ector and F|RES\n\n" + message),
|
wxMessageBox(_T("Dolphin PadSimple Event Plugin\nBy ector and F|RES\n\n" + message),
|
||||||
_T("Dolphin PadSimple"), wxOK, this);
|
_T("Dolphin PadSimple Event"), wxOK, this);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,33 @@
|
|||||||
#include "GUI/ConfigDlg.h"
|
#include "GUI/ConfigDlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// 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",
|
||||||
|
};
|
||||||
|
|
||||||
SPads pad[4];
|
SPads pad[4];
|
||||||
bool KeyStatus[NUMCONTROLS];
|
bool KeyStatus[NUMCONTROLS];
|
||||||
|
|
||||||
@ -168,9 +195,37 @@ void PAD_Shutdown()
|
|||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ParseKeyEvent(sf::Event ev)
|
||||||
void ParseKeyEvent(SPADStatus* _pPADStatus)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
_pPADStatus->err = PAD_ERR_NONE;
|
||||||
|
|
||||||
int stickvalue = (KeyStatus[CTL_HALFPRESS]) ? 40 : 100;
|
int stickvalue = (KeyStatus[CTL_HALFPRESS]) ? 40 : 100;
|
||||||
int triggervalue = (KeyStatus[CTL_HALFPRESS]) ? 100 : 255;
|
int triggervalue = (KeyStatus[CTL_HALFPRESS]) ? 100 : 255;
|
||||||
|
|
||||||
@ -218,39 +273,16 @@ void ParseKeyEvent(SPADStatus* _pPADStatus)
|
|||||||
_pPADStatus->MicButton = true;
|
_pPADStatus->MicButton = true;
|
||||||
else
|
else
|
||||||
_pPADStatus->MicButton = false;
|
_pPADStatus->MicButton = false;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
_pPADStatus->err = PAD_ERR_NONE;
|
|
||||||
|
|
||||||
#ifdef RECORD_STORE
|
#ifdef RECORD_STORE
|
||||||
RecordInput(*_pPADStatus);
|
RecordInput(*_pPADStatus);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PAD_Input(u8 _Key, u8 _UpDown) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) {
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int PAD_GetAttachedPads()
|
unsigned int PAD_GetAttachedPads()
|
||||||
{
|
{
|
||||||
|
@ -47,32 +47,6 @@ enum
|
|||||||
NUMCONTROLS
|
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 {
|
struct SPads {
|
||||||
bool bAttached; // Pad is "attached" to the gamecube/wii
|
bool bAttached; // Pad is "attached" to the gamecube/wii
|
||||||
|
@ -16,9 +16,9 @@ padeenv = env.Clone()
|
|||||||
|
|
||||||
if padeenv['HAVE_WX']:
|
if padeenv['HAVE_WX']:
|
||||||
files += [
|
files += [
|
||||||
# "GUI/ConfigDlg.cpp",
|
"GUI/ConfigDlg.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
padeenv.Append(LIBS = [ 'common' ])
|
padeenv.Append(LIBS = [ 'common', 'core' ])
|
||||||
|
|
||||||
padeenv.SharedLibrary(env['plugin_dir']+name, files)
|
padeenv.SharedLibrary(env['plugin_dir']+name, files)
|
||||||
|
Reference in New Issue
Block a user