Added option for emulated Classic Controller, Mario Kart Wii recognize it but the controls doesn't work yet
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1319 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
1bc53f87dc
commit
95153abe6c
|
@ -35,10 +35,10 @@ void Config::Load()
|
||||||
|
|
||||||
// get resolution
|
// get resolution
|
||||||
|
|
||||||
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, 0); // Hardware
|
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false); // Hardware
|
||||||
iniFile.Get("Settings", "WideScreen", &bWideScreen, 0);
|
iniFile.Get("Settings", "WideScreen", &bWideScreen, false);
|
||||||
iniFile.Get("Settings", "ExtensionConnected", &bExtensionConnected, 0);
|
iniFile.Get("Settings", "NunchuckConnected", &bNunchuckConnected, false);
|
||||||
|
iniFile.Get("Settings", "ClassicControllerConnected", &bClassicControllerConnected, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Save()
|
void Config::Save()
|
||||||
|
@ -47,7 +47,8 @@ void Config::Save()
|
||||||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||||
iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad);
|
iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad);
|
||||||
iniFile.Set("Settings", "WideScreen", bWideScreen);
|
iniFile.Set("Settings", "WideScreen", bWideScreen);
|
||||||
iniFile.Set("Settings", "ExtensionConnected", bExtensionConnected);
|
iniFile.Set("Settings", "NunchuckConnected", bNunchuckConnected);
|
||||||
|
iniFile.Set("Settings", "ClassicControllerConnected", bClassicControllerConnected);
|
||||||
|
|
||||||
|
|
||||||
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct Config
|
||||||
// General
|
// General
|
||||||
bool bSidewaysDPad;
|
bool bSidewaysDPad;
|
||||||
bool bWideScreen;
|
bool bWideScreen;
|
||||||
bool bExtensionConnected;
|
bool bNunchuckConnected, bClassicControllerConnected;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Config g_Config;
|
extern Config g_Config;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
//#include "Common.h" // for u16
|
//#include "Common.h" // for u16
|
||||||
#include "ConfigDlg.h"
|
#include "ConfigDlg.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "EmuSubroutines.h" // for WmRequestStatus_
|
#include "EmuSubroutines.h" // for WmRequestStatus
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||||
|
@ -27,7 +27,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||||
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick)
|
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick)
|
||||||
EVT_CHECKBOX(ID_SIDEWAYSDPAD, ConfigDialog::GeneralSettingsChanged)
|
EVT_CHECKBOX(ID_SIDEWAYSDPAD, ConfigDialog::GeneralSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_WIDESCREEN, ConfigDialog::GeneralSettingsChanged)
|
EVT_CHECKBOX(ID_WIDESCREEN, ConfigDialog::GeneralSettingsChanged)
|
||||||
EVT_CHECKBOX(ID_EXTENSIONCONNECTED, ConfigDialog::GeneralSettingsChanged)
|
EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, ConfigDialog::GeneralSettingsChanged)
|
||||||
|
EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, ConfigDialog::GeneralSettingsChanged)
|
||||||
END_EVENT_TABLE()
|
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)
|
||||||
|
@ -73,8 +74,10 @@ void ConfigDialog::CreateGUIControls()
|
||||||
m_SidewaysDPad->SetValue(g_Config.bSidewaysDPad);
|
m_SidewaysDPad->SetValue(g_Config.bSidewaysDPad);
|
||||||
m_WideScreen = new wxCheckBox(m_PageEmu, ID_WIDESCREEN, wxT("WideScreen Mode (for correct aiming)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_WideScreen = new wxCheckBox(m_PageEmu, ID_WIDESCREEN, wxT("WideScreen Mode (for correct aiming)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
m_WideScreen->SetValue(g_Config.bWideScreen);
|
m_WideScreen->SetValue(g_Config.bWideScreen);
|
||||||
m_ExtensionConnected = new wxCheckBox(m_PageEmu, ID_EXTENSIONCONNECTED, wxT("Extension connected"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_NunchuckConnected = new wxCheckBox(m_PageEmu, ID_NUNCHUCKCONNECTED, wxT("Nunchuck connected"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
m_ExtensionConnected->SetValue(g_Config.bExtensionConnected);
|
m_NunchuckConnected->SetValue(g_Config.bNunchuckConnected);
|
||||||
|
m_ClassicControllerConnected = new wxCheckBox(m_PageEmu, ID_CLASSICCONTROLLERCONNECTED, wxT("Classic Controller connected"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
m_ClassicControllerConnected->SetValue(g_Config.bClassicControllerConnected);
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -85,7 +88,8 @@ void ConfigDialog::CreateGUIControls()
|
||||||
sBasic = new wxGridBagSizer(0, 0);
|
sBasic = new wxGridBagSizer(0, 0);
|
||||||
sBasic->Add(m_SidewaysDPad, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
sBasic->Add(m_SidewaysDPad, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||||
sBasic->Add(m_WideScreen, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
sBasic->Add(m_WideScreen, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||||
sBasic->Add(m_ExtensionConnected, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
sBasic->Add(m_NunchuckConnected, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||||
|
sBasic->Add(m_ClassicControllerConnected, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||||
sbBasic->Add(sBasic);
|
sbBasic->Add(sBasic);
|
||||||
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
|
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
|
||||||
|
|
||||||
|
@ -117,6 +121,15 @@ void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::DoExtensionConnectedDisconnected()
|
||||||
|
{
|
||||||
|
// generate connect/disconnect status event
|
||||||
|
u8 DataFrame[8]; // make a blank report for it
|
||||||
|
wm_request_status *rs = (wm_request_status*)DataFrame;
|
||||||
|
if(WiiMoteEmu::g_ReportingChannel > 0)
|
||||||
|
WiiMoteEmu::WmRequestStatus(WiiMoteEmu::g_ReportingChannel, rs);
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
|
@ -124,17 +137,23 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||||
case ID_SIDEWAYSDPAD:
|
case ID_SIDEWAYSDPAD:
|
||||||
g_Config.bSidewaysDPad = m_SidewaysDPad->IsChecked();
|
g_Config.bSidewaysDPad = m_SidewaysDPad->IsChecked();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_WIDESCREEN:
|
case ID_WIDESCREEN:
|
||||||
g_Config.bWideScreen = m_WideScreen->IsChecked();
|
g_Config.bWideScreen = m_WideScreen->IsChecked();
|
||||||
break;
|
break;
|
||||||
case ID_EXTENSIONCONNECTED:
|
|
||||||
g_Config.bExtensionConnected = m_ExtensionConnected->IsChecked();
|
|
||||||
|
|
||||||
|
case ID_NUNCHUCKCONNECTED:
|
||||||
|
g_Config.bNunchuckConnected = m_NunchuckConnected->IsChecked();
|
||||||
// generate connect/disconnect status event
|
// generate connect/disconnect status event
|
||||||
u8 DataFrame[8]; // make a blank report for it
|
memcpy(WiiMoteEmu::g_RegExt + 0xfa, WiiMoteEmu::nunchuck_id, sizeof(WiiMoteEmu::nunchuck_id));
|
||||||
wm_request_status *rs = (wm_request_status*)DataFrame;
|
DoExtensionConnectedDisconnected();
|
||||||
if(WiiMoteEmu::g_ReportingChannel > 0)
|
break;
|
||||||
WiiMoteEmu::WmRequestStatus(WiiMoteEmu::g_ReportingChannel, rs);
|
|
||||||
|
case ID_CLASSICCONTROLLERCONNECTED:
|
||||||
|
g_Config.bClassicControllerConnected = m_ClassicControllerConnected->IsChecked();
|
||||||
|
// generate connect/disconnect status event
|
||||||
|
memcpy(WiiMoteEmu::g_RegExt + 0xfa, WiiMoteEmu::classic_id, sizeof(WiiMoteEmu::classic_id));
|
||||||
|
DoExtensionConnectedDisconnected();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,7 +59,7 @@ class ConfigDialog : public wxDialog
|
||||||
|
|
||||||
wxCheckBox *m_SidewaysDPad; // general settings
|
wxCheckBox *m_SidewaysDPad; // general settings
|
||||||
wxCheckBox *m_WideScreen;
|
wxCheckBox *m_WideScreen;
|
||||||
wxCheckBox *m_ExtensionConnected;
|
wxCheckBox *m_NunchuckConnected, *m_ClassicControllerConnected;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -72,13 +72,14 @@ class ConfigDialog : public wxDialog
|
||||||
|
|
||||||
ID_SIDEWAYSDPAD,
|
ID_SIDEWAYSDPAD,
|
||||||
ID_WIDESCREEN,
|
ID_WIDESCREEN,
|
||||||
ID_EXTENSIONCONNECTED
|
ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED
|
||||||
};
|
};
|
||||||
|
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
void CreateGUIControls();
|
void CreateGUIControls();
|
||||||
|
|
||||||
void AboutClick(wxCommandEvent& event);
|
void AboutClick(wxCommandEvent& event);
|
||||||
|
void DoExtensionConnectedDisconnected();
|
||||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
||||||
pStatus->battery = 0x5f; // fully charged
|
pStatus->battery = 0x5f; // fully charged
|
||||||
|
|
||||||
// Read config value for this one
|
// Read config value for this one
|
||||||
if(g_Config.bExtensionConnected)
|
if(g_Config.bNunchuckConnected || g_Config.bClassicControllerConnected)
|
||||||
pStatus->extension = 1;
|
pStatus->extension = 1;
|
||||||
else
|
else
|
||||||
pStatus->extension = 0;
|
pStatus->extension = 0;
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "EmuSubroutines.h"
|
#include "EmuSubroutines.h"
|
||||||
#include "EmuDefinitions.h"
|
#include "EmuDefinitions.h"
|
||||||
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
||||||
|
#include "Config.h" // for g_Config
|
||||||
|
|
||||||
extern SWiimoteInitialize g_WiimoteInitialize;
|
extern SWiimoteInitialize g_WiimoteInitialize;
|
||||||
|
|
||||||
|
@ -132,9 +133,16 @@ void Initialize()
|
||||||
//WriteCrypted16(g_RegExt, 0xfe, 0x0000); // Fully inserted Nunchuk
|
//WriteCrypted16(g_RegExt, 0xfe, 0x0000); // Fully inserted Nunchuk
|
||||||
|
|
||||||
|
|
||||||
// Copy nuncuck id and calibration to its register
|
// Copy extension id and calibration to its register
|
||||||
memcpy(g_RegExt + 0x20, nunchuck_calibration, sizeof(nunchuck_calibration));
|
memcpy(g_RegExt + 0x20, nunchuck_calibration, sizeof(nunchuck_calibration));
|
||||||
|
if(g_Config.bNunchuckConnected)
|
||||||
|
{
|
||||||
memcpy(g_RegExt + 0xfa, nunchuck_id, sizeof(nunchuck_id));
|
memcpy(g_RegExt + 0xfa, nunchuck_id, sizeof(nunchuck_id));
|
||||||
|
}
|
||||||
|
else if(g_Config.bClassicControllerConnected)
|
||||||
|
{
|
||||||
|
memcpy(g_RegExt + 0xfa, classic_id, sizeof(classic_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// g_RegExt[0xfd] = 0x1e;
|
// g_RegExt[0xfd] = 0x1e;
|
||||||
|
|
|
@ -84,13 +84,20 @@ static const u8 nunchuck_calibration[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* The nunchuck id. It should be written to the last bytes of the
|
/* The Nunchuck id. It should be written to the last bytes of the
|
||||||
extension register */
|
extension register */
|
||||||
static const u8 nunchuck_id[] =
|
static const u8 nunchuck_id[] =
|
||||||
{
|
{
|
||||||
0x00, 0x00, 0xa4, 0x20, 0x00, 0x00
|
0x00, 0x00, 0xa4, 0x20, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* The Classic Controller id. It should be written to the last bytes of the
|
||||||
|
extension register */
|
||||||
|
static const u8 classic_id[] =
|
||||||
|
{
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x01, 0x01
|
||||||
|
};
|
||||||
|
|
||||||
/* The id for nothing inserted */
|
/* The id for nothing inserted */
|
||||||
static const u8 nothing_id[] =
|
static const u8 nothing_id[] =
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue