add wxw modalness to both njoys and fix a bug where calling DllConfig from different parent HWNDs would stop the config dialog from appearing.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3656 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
1cb3fe7521
commit
518d3854ba
|
@ -172,6 +172,8 @@ void DllConfig(HWND _hParent)
|
|||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new DSPConfigDialogHLE(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
// add backends
|
||||
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
||||
|
|
|
@ -142,6 +142,8 @@ void DllConfig(HWND _hParent)
|
|||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new DSPConfigDialogLLE(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
// add backends
|
||||
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
||||
|
|
|
@ -634,6 +634,8 @@ void DllConfig(HWND _hParent)
|
|||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new PADConfigDialogSimple(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
// Only allow one open at a time
|
||||
if (!m_ConfigFrame->IsShown())
|
||||
|
|
|
@ -167,6 +167,8 @@ void DllConfig(HWND _hParent)
|
|||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new GFXConfigDialogOGL(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
|
|
@ -192,6 +192,8 @@ void DllConfig(HWND _hParent)
|
|||
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new WiimoteConfigDialog(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
// Only allow one open at a time
|
||||
if (!m_ConfigFrame->IsShown())
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
Config g_Config;
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
extern ConfigBox* m_frame;
|
||||
extern PADConfigDialognJoy* m_ConfigFrame;
|
||||
#endif
|
||||
//////////////////////////////////
|
||||
|
||||
|
@ -179,7 +179,7 @@ void Config::Save(int Slot)
|
|||
// ======================================
|
||||
|
||||
// Debugging
|
||||
//if(m_frame) m_frame->LogMsg("Saved: %s %i\n", SectionName.c_str(), PadMapping[i].triggertype);
|
||||
//if(m_ConfigFrame) m_ConfigFrame->LogMsg("Saved: %s %i\n", SectionName.c_str(), PadMapping[i].triggertype);
|
||||
}
|
||||
|
||||
INFO_LOG(CONSOLE, "%i: Save: %i\n", 0, PadMapping[0].halfpress);
|
||||
|
@ -221,7 +221,7 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
|
|||
{
|
||||
std::string SectionName = StringFromFormat("PAD%i", i+1);
|
||||
|
||||
// Don't update this when we are loading settings from the ConfigBox
|
||||
// Don't update this when we are loading settings from the PADConfigDialognJoy
|
||||
if(!ChangePad)
|
||||
{
|
||||
file.Get(SectionName.c_str(), "joy_id", &PadMapping[i].ID, 0);
|
||||
|
@ -273,7 +273,7 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
|
|||
// =============================
|
||||
|
||||
// Debugging
|
||||
//if(m_frame) m_frame->LogMsg("%i: Enabled: %i\n", i, PadMapping[i].buttons[CTL_X_BUTTON]);
|
||||
//if(m_ConfigFrame) m_ConfigFrame->LogMsg("%i: Enabled: %i\n", i, PadMapping[i].buttons[CTL_X_BUTTON]);
|
||||
}
|
||||
|
||||
INFO_LOG(CONSOLE, "%i: Load: %i\n", 0, PadMapping[0].halfpress);
|
||||
|
|
|
@ -46,7 +46,7 @@ bool StrangeHack = true;
|
|||
|
||||
// Set PAD status
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::PadGetStatus()
|
||||
void PADConfigDialognJoy::PadGetStatus()
|
||||
{
|
||||
/* Return if it's not detected. The ID should never be less than zero here, it can only be that
|
||||
because of a manual ini file change, but we make that check anway. */
|
||||
|
@ -248,7 +248,7 @@ std::string ShowStatus(int VirtualController)
|
|||
|
||||
// Populate the advanced tab
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::Update()
|
||||
void PADConfigDialognJoy::Update()
|
||||
{
|
||||
// Check that Dolphin is in focus, otherwise don't update the pad status
|
||||
/* If the emulator is running and unpaused GetJoyState() is run a little more often than needed,
|
||||
|
@ -276,7 +276,7 @@ void ConfigBox::Update()
|
|||
|
||||
// Populate the advanced tab
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::CreateAdvancedControls(int i)
|
||||
void PADConfigDialognJoy::CreateAdvancedControls(int i)
|
||||
{
|
||||
m_TStatusIn[i] = new wxStaticText(m_Controller[i], IDT_STATUS_IN, wxT("In"));
|
||||
m_TStatusOut[i] = new wxStaticText(m_Controller[i], IDT_STATUS_OUT, wxT("Out"));
|
||||
|
@ -342,7 +342,7 @@ void ConfigBox::CreateAdvancedControls(int i)
|
|||
}
|
||||
|
||||
|
||||
wxBitmap ConfigBox::CreateBitmap() // Create box
|
||||
wxBitmap PADConfigDialognJoy::CreateBitmap() // Create box
|
||||
{
|
||||
BoxW = 70, BoxH = 70;
|
||||
wxBitmap bitmap(BoxW, BoxH);
|
||||
|
@ -363,7 +363,7 @@ wxBitmap ConfigBox::CreateBitmap() // Create box
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
wxBitmap ConfigBox::CreateBitmapDot() // Create dot
|
||||
wxBitmap PADConfigDialognJoy::CreateBitmapDot() // Create dot
|
||||
{
|
||||
int w = 2, h = 2;
|
||||
wxBitmap bitmap(w, h);
|
||||
|
|
|
@ -60,65 +60,65 @@ static const char* TriggerType[] =
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The wxWidgets class
|
||||
// ¯¯¯¯¯¯¯
|
||||
BEGIN_EVENT_TABLE(ConfigBox,wxDialog)
|
||||
EVT_CLOSE(ConfigBox::OnClose)
|
||||
EVT_BUTTON(ID_ABOUT, ConfigBox::AboutClick)
|
||||
EVT_BUTTON(ID_OK, ConfigBox::OKClick)
|
||||
EVT_BUTTON(ID_CANCEL, ConfigBox::CancelClick)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, ConfigBox::NotebookPageChanged)
|
||||
BEGIN_EVENT_TABLE(PADConfigDialognJoy,wxDialog)
|
||||
EVT_CLOSE(PADConfigDialognJoy::OnClose)
|
||||
EVT_BUTTON(ID_ABOUT, PADConfigDialognJoy::AboutClick)
|
||||
EVT_BUTTON(ID_OK, PADConfigDialognJoy::OKClick)
|
||||
EVT_BUTTON(ID_CANCEL, PADConfigDialognJoy::CancelClick)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, PADConfigDialognJoy::NotebookPageChanged)
|
||||
|
||||
// Change and enable or disable gamepad
|
||||
EVT_COMBOBOX(IDC_JOYNAME, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_JOYATTACH, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_JOYNAME, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_JOYATTACH, PADConfigDialognJoy::ChangeSettings)
|
||||
|
||||
// Other settings
|
||||
EVT_CHECKBOX(IDC_SAVEBYID, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_SHOWADVANCED, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDCB_CHECKFOCUS, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_CONTROLTYPE, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_TRIGGERTYPE, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_DEADZONE, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_SAVEBYID, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_SHOWADVANCED, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(IDCB_CHECKFOCUS, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_CONTROLTYPE, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_TRIGGERTYPE, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_DEADZONE, PADConfigDialognJoy::ChangeSettings)
|
||||
|
||||
// Rumble settings
|
||||
EVT_CHECKBOX(IDC_ENABLERUMBLE, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_RUMBLESTRENGTH, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDC_ENABLERUMBLE, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_COMBOBOX(IDC_RUMBLESTRENGTH, PADConfigDialognJoy::ChangeSettings)
|
||||
|
||||
// Advanced settings
|
||||
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(IDCB_FILTER_SETTINGS, ConfigBox::ChangeSettings)
|
||||
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(IDCB_FILTER_SETTINGS, PADConfigDialognJoy::ChangeSettings)
|
||||
#ifdef RERECORDING
|
||||
EVT_CHECKBOX(ID_RECORDING, ConfigBox::ChangeSettings)
|
||||
EVT_CHECKBOX(ID_PLAYBACK, ConfigBox::ChangeSettings)
|
||||
EVT_BUTTON(ID_SAVE_RECORDING, ConfigBox::GetButtons)
|
||||
EVT_CHECKBOX(ID_RECORDING, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_CHECKBOX(ID_PLAYBACK, PADConfigDialognJoy::ChangeSettings)
|
||||
EVT_BUTTON(ID_SAVE_RECORDING, PADConfigDialognJoy::GetButtons)
|
||||
#endif
|
||||
|
||||
EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_A, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_B, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_X, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_Y, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_Z, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTONSTART, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTONHALFPRESS, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_UP, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_DOWN, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_LEFT, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_RIGHT, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_X, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_Y, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_X, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_Y, ConfigBox::GetButtons)
|
||||
EVT_BUTTON(IDB_SHOULDER_L, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_SHOULDER_R, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_A, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_B, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_X, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_Y, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTON_Z, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTONSTART, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_BUTTONHALFPRESS, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_UP, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_DOWN, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_LEFT, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_DPAD_RIGHT, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_X, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_Y, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_X, PADConfigDialognJoy::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_Y, PADConfigDialognJoy::GetButtons)
|
||||
|
||||
#if wxUSE_TIMER
|
||||
EVT_TIMER(IDTM_CONSTANT, ConfigBox::OnTimer)
|
||||
EVT_TIMER(IDTM_BUTTON, ConfigBox::OnButtonTimer)
|
||||
EVT_TIMER(IDTM_CONSTANT, PADConfigDialognJoy::OnTimer)
|
||||
EVT_TIMER(IDTM_BUTTON, PADConfigDialognJoy::OnButtonTimer)
|
||||
#endif
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ConfigBox::ConfigBox(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
PADConfigDialognJoy::PADConfigDialognJoy(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
|
@ -146,11 +146,11 @@ ConfigBox::ConfigBox(wxWindow *parent, wxWindowID id, const wxString &title,
|
|||
|
||||
// wxEVT_KEY_DOWN is blocked for enter, tab and the directional keys
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP,
|
||||
wxKeyEventHandler(ConfigBox::OnKeyDown),
|
||||
wxKeyEventHandler(PADConfigDialognJoy::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
}
|
||||
|
||||
ConfigBox::~ConfigBox()
|
||||
PADConfigDialognJoy::~PADConfigDialognJoy()
|
||||
{
|
||||
// The statbar sample has this so I add this to
|
||||
#if wxUSE_TIMER
|
||||
|
@ -158,7 +158,7 @@ ConfigBox::~ConfigBox()
|
|||
#endif
|
||||
}
|
||||
|
||||
void ConfigBox::OnKeyDown(wxKeyEvent& event)
|
||||
void PADConfigDialognJoy::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
/*m_pStatusBar->SetLabel(wxString::Format(
|
||||
"Key: %i", event.GetKeyCode()
|
||||
|
@ -168,7 +168,7 @@ void ConfigBox::OnKeyDown(wxKeyEvent& event)
|
|||
|
||||
// Close window
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::OnClose(wxCloseEvent& event)
|
||||
void PADConfigDialognJoy::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
// Allow wxWidgets to close the window
|
||||
event.Skip();
|
||||
|
@ -182,7 +182,7 @@ void ConfigBox::OnClose(wxCloseEvent& event)
|
|||
|
||||
// Call about dialog
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::AboutClick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy::AboutClick(wxCommandEvent& event)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wxWindow win;
|
||||
|
@ -202,7 +202,7 @@ void ConfigBox::AboutClick(wxCommandEvent& event)
|
|||
|
||||
// Click OK
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::OKClick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy::OKClick(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == ID_OK)
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ void ConfigBox::OKClick(wxCommandEvent& event)
|
|||
|
||||
// Click Cancel
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::CancelClick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy::CancelClick(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == ID_CANCEL)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ void ConfigBox::CancelClick(wxCommandEvent& event)
|
|||
|
||||
// Debugging
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::LogMsg(const char* format, ...)
|
||||
void PADConfigDialognJoy::LogMsg(const char* format, ...)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if(Debugging)
|
||||
|
@ -262,7 +262,7 @@ void ConfigBox::LogMsg(const char* format, ...)
|
|||
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 ConfigBox::DoSave(bool ChangePad, int Slot)
|
||||
void PADConfigDialognJoy::DoSave(bool ChangePad, int Slot)
|
||||
{
|
||||
// Replace "" with "-1" before we are saving
|
||||
ToBlank(false);
|
||||
|
@ -289,7 +289,7 @@ void ConfigBox::DoSave(bool ChangePad, int Slot)
|
|||
|
||||
// On changing the SaveById option we update all pages
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::OnSaveById()
|
||||
void PADConfigDialognJoy::OnSaveById()
|
||||
{
|
||||
// Save current settings
|
||||
DoSave(false, notebookpage);
|
||||
|
@ -307,7 +307,7 @@ void ConfigBox::OnSaveById()
|
|||
/* 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 ConfigBox::DoChangeJoystick()
|
||||
void PADConfigDialognJoy::DoChangeJoystick()
|
||||
{
|
||||
// Close the current pad, unless it's used by another slot
|
||||
//if (PadMapping[notebookpage].enabled) PadClose(notebookpage);
|
||||
|
@ -322,7 +322,7 @@ void ConfigBox::DoChangeJoystick()
|
|||
// Open the new pad
|
||||
if (PadMapping[notebookpage].enabled) PadOpen(notebookpage);
|
||||
}
|
||||
void ConfigBox::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
|
||||
void PADConfigDialognJoy::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
|
||||
{
|
||||
// Check that we got a good pad
|
||||
if (!joyinfo.at(PadMapping[Open].ID).Good)
|
||||
|
@ -333,7 +333,7 @@ void ConfigBox::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
|
|||
|
||||
PadState[Open].joy = SDL_JoystickOpen(PadMapping[Open].ID);
|
||||
}
|
||||
void ConfigBox::PadClose(int Close) // Close for slot 1, 2, 3 or 4
|
||||
void PADConfigDialognJoy::PadClose(int Close) // Close for slot 1, 2, 3 or 4
|
||||
{
|
||||
if (SDL_JoystickOpened(PadMapping[Close].ID)) SDL_JoystickClose(PadState[Close].joy);
|
||||
PadState[Close].joy = NULL;
|
||||
|
@ -341,7 +341,7 @@ void ConfigBox::PadClose(int Close) // Close for slot 1, 2, 3 or 4
|
|||
|
||||
// Notebook page changed
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::NotebookPageChanged(wxNotebookEvent& event)
|
||||
void PADConfigDialognJoy::NotebookPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
// Save current settings now, don't wait for OK
|
||||
if(ControlsCreated && !g_Config.bSaveByID) DoSave(false, notebookpage);
|
||||
|
@ -355,7 +355,7 @@ void ConfigBox::NotebookPageChanged(wxNotebookEvent& event)
|
|||
|
||||
// Replace the harder to understand -1 with "" for the sake of user friendliness
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::ToBlank(bool ToBlank)
|
||||
void PADConfigDialognJoy::ToBlank(bool ToBlank)
|
||||
{
|
||||
if (!ControlsCreated) return;
|
||||
|
||||
|
@ -383,7 +383,7 @@ void ConfigBox::ToBlank(bool ToBlank)
|
|||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Change settings
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::SetButtonTextAll(int id, const char *text)
|
||||
void PADConfigDialognJoy::SetButtonTextAll(int id, const char *text)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ void ConfigBox::SetButtonTextAll(int id, const char *text)
|
|||
};
|
||||
}
|
||||
|
||||
void ConfigBox::SaveButtonMappingAll(int Slot)
|
||||
void PADConfigDialognJoy::SaveButtonMappingAll(int Slot)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -405,7 +405,7 @@ void ConfigBox::SaveButtonMappingAll(int Slot)
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigBox::UpdateGUIAll(int Slot)
|
||||
void PADConfigDialognJoy::UpdateGUIAll(int Slot)
|
||||
{
|
||||
if(Slot == -1)
|
||||
{
|
||||
|
@ -423,7 +423,7 @@ void ConfigBox::UpdateGUIAll(int Slot)
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigBox::ChangeSettings( wxCommandEvent& event )
|
||||
void PADConfigDialognJoy::ChangeSettings( wxCommandEvent& event )
|
||||
{
|
||||
switch(event.GetId())
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
|
|||
// Update GUI
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
// Called from: CreateGUIControls(), ChangeControllertype()
|
||||
void ConfigBox::UpdateGUI(int _notebookpage)
|
||||
void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
|
||||
{
|
||||
// If there are no good pads disable the entire notebook
|
||||
if (NumGoodPads == 0)
|
||||
|
@ -597,7 +597,7 @@ void ConfigBox::UpdateGUI(int _notebookpage)
|
|||
|
||||
// Paint the background
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::OnPaint(wxPaintEvent &event)
|
||||
void PADConfigDialognJoy::OnPaint(wxPaintEvent &event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
|
@ -611,7 +611,7 @@ void ConfigBox::OnPaint(wxPaintEvent &event)
|
|||
|
||||
// Populate the config window
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::CreateGUIControls()
|
||||
void PADConfigDialognJoy::CreateGUIControls()
|
||||
{
|
||||
INFO_LOG(CONSOLE, "CreateGUIControls()\n");
|
||||
|
||||
|
@ -739,7 +739,7 @@ void ConfigBox::CreateGUIControls()
|
|||
|
||||
// Paint background. This allows objects to be visible on top of the picture
|
||||
m_pKeys[i]->Connect(wxID_ANY, wxEVT_PAINT,
|
||||
wxPaintEventHandler(ConfigBox::OnPaint),
|
||||
wxPaintEventHandler(PADConfigDialognJoy::OnPaint),
|
||||
(wxObject*)0, this);
|
||||
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ void ConfigBox::CreateGUIControls()
|
|||
ToBlank();
|
||||
}
|
||||
|
||||
void ConfigBox::SizeWindow()
|
||||
void PADConfigDialognJoy::SizeWindow()
|
||||
{
|
||||
SetClientSize(m_MainSizer->GetMinSize().GetWidth(), m_MainSizer->GetMinSize().GetHeight());
|
||||
}
|
||||
|
|
|
@ -50,17 +50,17 @@
|
|||
|
||||
#include "../nJoy.h"
|
||||
|
||||
class ConfigBox : public wxDialog
|
||||
class PADConfigDialognJoy : public wxDialog
|
||||
{
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
ConfigBox(wxWindow *parent, wxWindowID id = 1,
|
||||
PADConfigDialognJoy(wxWindow *parent, wxWindowID id = 1,
|
||||
const wxString &title = wxT("Configure: nJoy Input Plugin"),
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE);
|
||||
virtual ~ConfigBox();
|
||||
virtual ~PADConfigDialognJoy();
|
||||
|
||||
#if wxUSE_TIMER
|
||||
void OnTimer(wxTimerEvent& WXUNUSED(event)) { Update(); }
|
||||
|
|
|
@ -45,7 +45,7 @@ extern bool g_EmulatorRunning;
|
|||
|
||||
// Set dialog items from saved values
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::UpdateGUIButtonMapping(int controller)
|
||||
void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
|
||||
{
|
||||
// http://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString
|
||||
wxString tmp;
|
||||
|
@ -105,7 +105,7 @@ void ConfigBox::UpdateGUIButtonMapping(int controller)
|
|||
/* Populate the PadMapping array with the dialog items settings (for example
|
||||
selected joystick, enabled or disabled status and so on) */
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
|
||||
void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
|
||||
{
|
||||
// Temporary storage
|
||||
wxString tmp;
|
||||
|
@ -169,7 +169,7 @@ void ConfigBox::SaveButtonMapping(int controller, bool DontChangeId, int FromSlo
|
|||
|
||||
// Update the textbox for the buttons
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::SetButtonText(int id, const char *text, int Page)
|
||||
void PADConfigDialognJoy::SetButtonText(int id, const char *text, int Page)
|
||||
{
|
||||
// Set controller value
|
||||
int controller;
|
||||
|
@ -204,7 +204,7 @@ void ConfigBox::SetButtonText(int id, const char *text, int Page)
|
|||
|
||||
// Get the text in the textbox for the buttons
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
wxString ConfigBox::GetButtonText(int id, int Page)
|
||||
wxString PADConfigDialognJoy::GetButtonText(int id, int Page)
|
||||
{
|
||||
// Set controller value
|
||||
int controller;
|
||||
|
@ -255,12 +255,12 @@ wxString ConfigBox::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 ConfigBox::GetButtons(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy::GetButtons(wxCommandEvent& event)
|
||||
{
|
||||
DoGetButtons(event.GetId());
|
||||
}
|
||||
|
||||
void ConfigBox::DoGetButtons(int GetId)
|
||||
void PADConfigDialognJoy::DoGetButtons(int GetId)
|
||||
{
|
||||
// =============================================
|
||||
// Collect the starting values
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
controllers. Joysticks[].ID will have the number of the physical input device mapped to that
|
||||
controller (this value range between 0 and the total number of connected physical devices). The
|
||||
mapping of a certain physical device to PadState[].joy is initially done by Initialize(), but
|
||||
for the configuration we can remap that, like in ConfigBox::ChangeJoystick().
|
||||
for the configuration we can remap that, like in PADConfigDialognJoy::ChangeJoystick().
|
||||
|
||||
The joyinfo[] array holds the physical gamepad info for a certain physical device. It's therefore
|
||||
used as joyinfo[PadMapping[controller].ID] if we want to get the joyinfo for a certain joystick.
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
// Declare config window so that we can write debugging info to it from functions in this file
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
ConfigBox* m_frame;
|
||||
PADConfigDialognJoy* m_ConfigFrame = NULL;
|
||||
#endif
|
||||
/////////////////////////
|
||||
|
||||
|
@ -83,7 +83,6 @@
|
|||
|
||||
#define _EXCLUDE_MAIN_ // Avoid certain declarations in nJoy.h
|
||||
FILE *pFile;
|
||||
HINSTANCE nJoy_hInst = NULL;
|
||||
std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
|
||||
InputCommon::CONTROLLER_STATE PadState[4];
|
||||
InputCommon::CONTROLLER_MAPPING PadMapping[4];
|
||||
|
@ -100,28 +99,23 @@ PLUGIN_GLOBALS* globals = NULL;
|
|||
extern int fd;
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// wxWidgets
|
||||
// ¯¯¯¯¯¯¯¯¯
|
||||
// Standard crap to make wxWidgets happy
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
class wxDLLApp : public wxApp
|
||||
{
|
||||
class wxDLLApp : public wxApp
|
||||
{
|
||||
bool OnInit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
};
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DllMain
|
||||
// ¯¯¯¯¯¯¯
|
||||
#ifdef _WIN32
|
||||
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
|
@ -129,30 +123,46 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
|||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
//use wxInitialize() if you don't want GUI instead of the following 12 lines
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxSetInstance((HINSTANCE)hinstDLL);
|
||||
int argc = 0;
|
||||
char **argv = NULL;
|
||||
wxEntryStart(argc, argv);
|
||||
|
||||
if (!wxTheApp || !wxTheApp->CallOnInit() )
|
||||
if (!wxTheApp || !wxTheApp->CallOnInit())
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxEntryCleanup();
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
nJoy_hInst = hinstDLL;
|
||||
g_hInstance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxWindow* GetParentedWxWindow(HWND Parent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wxSetInstance((HINSTANCE)g_hInstance);
|
||||
#endif
|
||||
wxWindow *win = new wxWindow();
|
||||
#ifdef _WIN32
|
||||
win->SetHWND((WXHWND)Parent);
|
||||
win->AdoptAttributesFromHWND();
|
||||
#endif
|
||||
return win;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Input Plugin Functions (from spec's)
|
||||
|
@ -187,43 +197,41 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
|||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
// Debugging
|
||||
// #ifdef SHOW_PAD_STATUS
|
||||
// Console::Open(100);
|
||||
// m_hConsole = Console::GetHwnd();
|
||||
// #endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
// Start the pads so we can use them in the configuration and advanced controls
|
||||
if(!g_EmulatorRunning)
|
||||
if (!g_EmulatorRunning)
|
||||
{
|
||||
Search_Devices(joyinfo, NumPads, NumGoodPads); // Populate joyinfo for all attached devices
|
||||
|
||||
// Check if a DirectInput error occured
|
||||
if(ReloadDLL())
|
||||
if (ReloadDLL())
|
||||
{
|
||||
PostMessage(_hParent, WM_USER, NJOY_RELOAD, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_frame = new ConfigBox(NULL);
|
||||
m_frame->Show();
|
||||
|
||||
#else
|
||||
#else
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_Config.Load(); // load settings
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
ConfigBox frame(NULL);
|
||||
frame.ShowModal();
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new PADConfigDialognJoy(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
// Only allow one open at a time
|
||||
if (!m_ConfigFrame->IsShown())
|
||||
m_ConfigFrame->ShowModal();
|
||||
else
|
||||
m_ConfigFrame->Hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllDebugger(HWND _hParent, bool Show) {}
|
||||
|
@ -257,7 +265,7 @@ void Initialize(void *init)
|
|||
|
||||
// Populate joyinfo for all attached devices if the configuration window is not already open
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if(!m_frame)
|
||||
if(!m_ConfigFrame)
|
||||
{
|
||||
Search_Devices(joyinfo, NumPads, NumGoodPads);
|
||||
// Check if a DirectInput error occured
|
||||
|
@ -273,7 +281,7 @@ void Initialize(void *init)
|
|||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
/* Information: This function can not be run twice without an Initialize in between. If
|
||||
it's run twice the SDL_...() functions below will cause a crash.
|
||||
Called from: The Dolphin Core, ConfigBox::OnClose() */
|
||||
Called from: The Dolphin Core, PADConfigDialognJoy::OnClose() */
|
||||
void Shutdown()
|
||||
{
|
||||
INFO_LOG(CONSOLE, "Shutdown: %i\n", SDL_WasInit(0));
|
||||
|
@ -297,7 +305,7 @@ void Shutdown()
|
|||
// Don't shutdown the gamepad if the configuration window is still showing
|
||||
// Todo: Coordinate with the Wiimote plugin, SDL_Quit() will remove the pad for it to
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (m_frame) return;
|
||||
if (m_ConfigFrame) return;
|
||||
#endif
|
||||
/* Close all devices carefully. We must check that we are not accessing any undefined
|
||||
vector elements or any bad devices */
|
||||
|
@ -663,7 +671,7 @@ return true;
|
|||
HWND RenderingWindow = NULL; if (g_PADInitialize) RenderingWindow = g_PADInitialize->hWnd;
|
||||
HWND Parent = GetParent(RenderingWindow);
|
||||
HWND TopLevel = GetParent(Parent);
|
||||
HWND Config = NULL; if (m_frame) Config = (HWND)m_frame->GetHWND();
|
||||
HWND Config = NULL; if (m_ConfigFrame) Config = (HWND)m_ConfigFrame->GetHWND();
|
||||
// Support both rendering to main window and not, and the config and eventual console window
|
||||
if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config || GetForegroundWindow() == m_hConsole)
|
||||
return true;
|
||||
|
|
|
@ -45,51 +45,51 @@ static const char* ControllerType[] =
|
|||
// "Keyboard" // Not supported yet, sorry F|RES ;( ...
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(ConfigBox,wxDialog)
|
||||
EVT_CLOSE(ConfigBox::OnClose)
|
||||
EVT_BUTTON(ID_ABOUT, ConfigBox::AboutClick)
|
||||
EVT_BUTTON(ID_OK, ConfigBox::OKClick)
|
||||
EVT_BUTTON(ID_CANCEL, ConfigBox::CancelClick)
|
||||
EVT_COMBOBOX(IDC_JOYNAME, ConfigBox::ChangeJoystick)
|
||||
EVT_COMBOBOX(IDC_CONTROLTYPE, ConfigBox::ChangeControllertype)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, ConfigBox::NotebookPageChanged)
|
||||
BEGIN_EVENT_TABLE(PADConfigDialognJoy4,wxDialog)
|
||||
EVT_CLOSE(PADConfigDialognJoy4::OnClose)
|
||||
EVT_BUTTON(ID_ABOUT, PADConfigDialognJoy4::AboutClick)
|
||||
EVT_BUTTON(ID_OK, PADConfigDialognJoy4::OKClick)
|
||||
EVT_BUTTON(ID_CANCEL, PADConfigDialognJoy4::CancelClick)
|
||||
EVT_COMBOBOX(IDC_JOYNAME, PADConfigDialognJoy4::ChangeJoystick)
|
||||
EVT_COMBOBOX(IDC_CONTROLTYPE, PADConfigDialognJoy4::ChangeControllertype)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, PADConfigDialognJoy4::NotebookPageChanged)
|
||||
|
||||
EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_A, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_B, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_X, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_Y, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_Z, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTONSTART, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(ID_BUTTONCALIBRATE, ConfigBox::Calibrate)
|
||||
EVT_BUTTON(IDB_BUTTONHALFPRESS, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_UP, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_DOWN, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_LEFT, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_RIGHT, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_SHOULDER_L, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_SHOULDER_R, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_A, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_B, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_X, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_Y, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTON_Z, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTONSTART, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(ID_BUTTONCALIBRATE, PADConfigDialognJoy4::Calibrate)
|
||||
EVT_BUTTON(IDB_BUTTONHALFPRESS, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_UP, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_DOWN, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_LEFT, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_DPAD_RIGHT, PADConfigDialognJoy4::GetInputs)
|
||||
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_X, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_Y, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_X, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_Y, ConfigBox::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTONDEBUGSTART,ConfigBox::StartDebug)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_X, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_ANALOG_MAIN_Y, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_X, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_ANALOG_SUB_Y, PADConfigDialognJoy4::GetInputs)
|
||||
EVT_BUTTON(IDB_BUTTONDEBUGSTART,PADConfigDialognJoy4::StartDebug)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ConfigBox::ConfigBox(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
PADConfigDialognJoy4::PADConfigDialognJoy4(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
notebookpage = 0;
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
ConfigBox::~ConfigBox()
|
||||
PADConfigDialognJoy4::~PADConfigDialognJoy4()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// Warning: horrible code below proceed at own risk!
|
||||
void ConfigBox::CreateGUIControls()
|
||||
void PADConfigDialognJoy4::CreateGUIControls()
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
SetTitle(wxT("Configure: nJoy v"INPUT_VERSION" Input Plugin"));
|
||||
|
@ -288,12 +288,12 @@ void ConfigBox::CreateGUIControls()
|
|||
m_bJoyDebug = new wxButton(m_Controller[4], IDB_BUTTONDEBUGSTART, wxT("Start"), wxPoint(297, 385), wxDefaultSize, 0, wxDefaultValidator, wxT("Start"));
|
||||
}
|
||||
|
||||
void ConfigBox::OnClose(wxCloseEvent& /*event*/)
|
||||
void PADConfigDialognJoy4::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
void ConfigBox::AboutClick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::AboutClick(wxCommandEvent& event)
|
||||
{
|
||||
// Call about dialog
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
|
@ -313,7 +313,7 @@ void ConfigBox::AboutClick(wxCommandEvent& event)
|
|||
#endif
|
||||
}
|
||||
|
||||
void ConfigBox::OKClick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::OKClick(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == ID_OK)
|
||||
{
|
||||
|
@ -325,7 +325,7 @@ void ConfigBox::OKClick(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigBox::CancelClick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::CancelClick(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == ID_CANCEL)
|
||||
{
|
||||
|
@ -333,7 +333,7 @@ void ConfigBox::CancelClick(wxCommandEvent& event)
|
|||
Close();
|
||||
}
|
||||
}
|
||||
void ConfigBox::StartDebug(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::StartDebug(wxCommandEvent& event)
|
||||
{
|
||||
SDL_Joystick *joy = SDL_JoystickOpen(joysticks[0].ID);
|
||||
int axes = SDL_JoystickNumAxes(joy);
|
||||
|
@ -356,7 +356,7 @@ void ConfigBox::StartDebug(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
}
|
||||
void ConfigBox::Calibrate(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::Calibrate(wxCommandEvent& event)
|
||||
{
|
||||
int controller = notebookpage;
|
||||
|
||||
|
@ -391,7 +391,7 @@ void ConfigBox::Calibrate(wxCommandEvent& event)
|
|||
}
|
||||
// Set dialog items
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::SetControllerAll(int controller)
|
||||
void PADConfigDialognJoy4::SetControllerAll(int controller)
|
||||
{
|
||||
// http://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString
|
||||
wxString tmp;
|
||||
|
@ -439,7 +439,7 @@ void ConfigBox::SetControllerAll(int controller)
|
|||
|
||||
// Get dialog items
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::GetControllerAll(int controller)
|
||||
void PADConfigDialognJoy4::GetControllerAll(int controller)
|
||||
{
|
||||
wxString tmp;
|
||||
long lvalue;
|
||||
|
@ -481,7 +481,7 @@ void ConfigBox::GetControllerAll(int controller)
|
|||
joysticks[controller].deadzone = m_Deadzone[controller]->GetSelection();
|
||||
}
|
||||
|
||||
void ConfigBox::UpdateVisibleItems(int controller)
|
||||
void PADConfigDialognJoy4::UpdateVisibleItems(int controller)
|
||||
{
|
||||
if(joysticks[controller].controllertype)
|
||||
{
|
||||
|
@ -515,7 +515,7 @@ void ConfigBox::UpdateVisibleItems(int controller)
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigBox::ChangeJoystick(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::ChangeJoystick(wxCommandEvent& event)
|
||||
{
|
||||
joysticks[0].ID = m_Joyname[0]->GetSelection();
|
||||
joysticks[1].ID = m_Joyname[1]->GetSelection();
|
||||
|
@ -523,7 +523,7 @@ void ConfigBox::ChangeJoystick(wxCommandEvent& event)
|
|||
joysticks[3].ID = m_Joyname[3]->GetSelection();
|
||||
}
|
||||
|
||||
void ConfigBox::ChangeControllertype(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::ChangeControllertype(wxCommandEvent& event)
|
||||
{
|
||||
joysticks[0].controllertype = m_Controltype[0]->GetSelection();
|
||||
joysticks[1].controllertype = m_Controltype[1]->GetSelection();
|
||||
|
@ -534,12 +534,12 @@ void ConfigBox::ChangeControllertype(wxCommandEvent& event)
|
|||
UpdateVisibleItems(i);
|
||||
}
|
||||
|
||||
void ConfigBox::NotebookPageChanged(wxNotebookEvent& event)
|
||||
void PADConfigDialognJoy4::NotebookPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
notebookpage = event.GetSelection();
|
||||
}
|
||||
|
||||
void ConfigBox::SetButtonText(int id, char text[128])
|
||||
void PADConfigDialognJoy4::SetButtonText(int id, char text[128])
|
||||
{
|
||||
int controller = notebookpage;
|
||||
|
||||
|
@ -651,7 +651,7 @@ void ConfigBox::SetButtonText(int id, char text[128])
|
|||
break;
|
||||
}
|
||||
}
|
||||
void ConfigBox::GetInputs(wxCommandEvent& event)
|
||||
void PADConfigDialognJoy4::GetInputs(wxCommandEvent& event)
|
||||
{
|
||||
int ID = event.GetId();
|
||||
int controller = notebookpage;
|
||||
|
@ -744,7 +744,7 @@ InputEnd:
|
|||
|
||||
// Wait for D-Pad
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void ConfigBox::GetHats(int ID)
|
||||
void PADConfigDialognJoy4::GetHats(int ID)
|
||||
{
|
||||
int controller = notebookpage;
|
||||
|
||||
|
|
|
@ -47,15 +47,15 @@
|
|||
#include <wx/statbmp.h>
|
||||
|
||||
|
||||
class ConfigBox : public wxDialog
|
||||
class PADConfigDialognJoy4 : public wxDialog
|
||||
{
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"),
|
||||
PADConfigDialognJoy4(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"),
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
|
||||
virtual ~ConfigBox();
|
||||
virtual ~PADConfigDialognJoy4();
|
||||
|
||||
private:
|
||||
wxButton *m_About;
|
||||
|
|
|
@ -52,7 +52,6 @@ bool g_rumbleEnable = FALSE;
|
|||
|
||||
// Rumble in windows
|
||||
#ifdef _WIN32
|
||||
HINSTANCE nJoy_hInst = NULL;
|
||||
#ifdef USE_RUMBLE_DINPUT_HACK
|
||||
LPDIRECTINPUT8 g_pDI = NULL;
|
||||
LPDIRECTINPUTDEVICE8 g_pDevice = NULL;
|
||||
|
@ -77,11 +76,12 @@ HRESULT SetDeviceForcesXY();
|
|||
struct ff_effect effect;
|
||||
bool CanRumble = false;
|
||||
#endif
|
||||
|
||||
// Standard crap to make wxWidgets happy
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// wxWidgets
|
||||
// ¯¯¯¯¯¯¯¯¯
|
||||
class wxDLLApp : public wxApp
|
||||
{
|
||||
bool OnInit()
|
||||
|
@ -89,16 +89,11 @@ class wxDLLApp : public wxApp
|
|||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DllMain
|
||||
// ¯¯¯¯¯¯¯
|
||||
|
||||
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
|
@ -107,13 +102,11 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
|||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
//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() )
|
||||
if (!wxTheApp || !wxTheApp->CallOnInit())
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
@ -121,19 +114,36 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
|||
|
||||
case DLL_PROCESS_DETACH:
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
|
||||
wxEntryCleanup();
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
nJoy_hInst = hinstDLL;
|
||||
g_hInstance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
PADConfigDialognJoy4* m_ConfigFrame = NULL;
|
||||
|
||||
wxWindow* GetParentedWxWindow(HWND Parent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wxSetInstance((HINSTANCE)g_hInstance);
|
||||
#endif
|
||||
wxWindow *win = new wxWindow();
|
||||
#ifdef _WIN32
|
||||
win->SetHWND((WXHWND)Parent);
|
||||
win->AdoptAttributesFromHWND();
|
||||
#endif
|
||||
return win;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Input Plugin Functions (from spec's)
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
|
@ -167,36 +177,34 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
|||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadConfig(); // load settings
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxWindow win;
|
||||
win.SetHWND(_hParent);
|
||||
ConfigBox frame(&win);
|
||||
frame.ShowModal();
|
||||
win.SetHWND(0);
|
||||
#endif
|
||||
#else
|
||||
#else
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
LoadConfig(); // load settings
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
ConfigBox frame(NULL);
|
||||
frame.ShowModal();
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new PADConfigDialognJoy4(GetParentedWxWindow(_hParent));
|
||||
else if (!m_ConfigFrame->GetParent()->IsShown())
|
||||
m_ConfigFrame->Close(true);
|
||||
|
||||
// Only allow one open at a time
|
||||
if (!m_ConfigFrame->IsShown())
|
||||
m_ConfigFrame->ShowModal();
|
||||
else
|
||||
m_ConfigFrame->Hide();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllDebugger(HWND _hParent, bool Show) {
|
||||
|
|
Loading…
Reference in New Issue