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
|
||||
|
||||
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, 0); // Hardware
|
||||
iniFile.Get("Settings", "WideScreen", &bWideScreen, 0);
|
||||
iniFile.Get("Settings", "ExtensionConnected", &bExtensionConnected, 0);
|
||||
|
||||
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false); // Hardware
|
||||
iniFile.Get("Settings", "WideScreen", &bWideScreen, false);
|
||||
iniFile.Get("Settings", "NunchuckConnected", &bNunchuckConnected, false);
|
||||
iniFile.Get("Settings", "ClassicControllerConnected", &bClassicControllerConnected, false);
|
||||
}
|
||||
|
||||
void Config::Save()
|
||||
|
@ -47,7 +47,8 @@ void Config::Save()
|
|||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad);
|
||||
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");
|
||||
|
|
|
@ -33,7 +33,7 @@ struct Config
|
|||
// General
|
||||
bool bSidewaysDPad;
|
||||
bool bWideScreen;
|
||||
bool bExtensionConnected;
|
||||
bool bNunchuckConnected, bClassicControllerConnected;
|
||||
};
|
||||
|
||||
extern Config g_Config;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
//#include "Common.h" // for u16
|
||||
#include "ConfigDlg.h"
|
||||
#include "Config.h"
|
||||
#include "EmuSubroutines.h" // for WmRequestStatus_
|
||||
#include "EmuSubroutines.h" // for WmRequestStatus
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
|
@ -27,7 +27,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
|||
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick)
|
||||
EVT_CHECKBOX(ID_SIDEWAYSDPAD, 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()
|
||||
|
||||
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_WideScreen = new wxCheckBox(m_PageEmu, ID_WIDESCREEN, wxT("WideScreen Mode (for correct aiming)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_WideScreen->SetValue(g_Config.bWideScreen);
|
||||
m_ExtensionConnected = new wxCheckBox(m_PageEmu, ID_EXTENSIONCONNECTED, wxT("Extension connected"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ExtensionConnected->SetValue(g_Config.bExtensionConnected);
|
||||
m_NunchuckConnected = new wxCheckBox(m_PageEmu, ID_NUNCHUCKCONNECTED, wxT("Nunchuck connected"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
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->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_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);
|
||||
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)
|
||||
{
|
||||
switch (event.GetId())
|
||||
|
@ -124,17 +137,23 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
case ID_SIDEWAYSDPAD:
|
||||
g_Config.bSidewaysDPad = m_SidewaysDPad->IsChecked();
|
||||
break;
|
||||
|
||||
case ID_WIDESCREEN:
|
||||
g_Config.bWideScreen = m_WideScreen->IsChecked();
|
||||
break;
|
||||
case ID_EXTENSIONCONNECTED:
|
||||
g_Config.bExtensionConnected = m_ExtensionConnected->IsChecked();
|
||||
|
||||
// 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);
|
||||
break;
|
||||
case ID_NUNCHUCKCONNECTED:
|
||||
g_Config.bNunchuckConnected = m_NunchuckConnected->IsChecked();
|
||||
// generate connect/disconnect status event
|
||||
memcpy(WiiMoteEmu::g_RegExt + 0xfa, WiiMoteEmu::nunchuck_id, sizeof(WiiMoteEmu::nunchuck_id));
|
||||
DoExtensionConnectedDisconnected();
|
||||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ class ConfigDialog : public wxDialog
|
|||
|
||||
wxCheckBox *m_SidewaysDPad; // general settings
|
||||
wxCheckBox *m_WideScreen;
|
||||
wxCheckBox *m_ExtensionConnected;
|
||||
wxCheckBox *m_NunchuckConnected, *m_ClassicControllerConnected;
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -72,13 +72,14 @@ class ConfigDialog : public wxDialog
|
|||
|
||||
ID_SIDEWAYSDPAD,
|
||||
ID_WIDESCREEN,
|
||||
ID_EXTENSIONCONNECTED
|
||||
ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED
|
||||
};
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
|
||||
void AboutClick(wxCommandEvent& event);
|
||||
void DoExtensionConnectedDisconnected();
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
|
|
|
@ -490,7 +490,7 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
|||
pStatus->battery = 0x5f; // fully charged
|
||||
|
||||
// Read config value for this one
|
||||
if(g_Config.bExtensionConnected)
|
||||
if(g_Config.bNunchuckConnected || g_Config.bClassicControllerConnected)
|
||||
pStatus->extension = 1;
|
||||
else
|
||||
pStatus->extension = 0;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "EmuSubroutines.h"
|
||||
#include "EmuDefinitions.h"
|
||||
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
||||
#include "Config.h" // for g_Config
|
||||
|
||||
extern SWiimoteInitialize g_WiimoteInitialize;
|
||||
|
||||
|
@ -132,9 +133,16 @@ void Initialize()
|
|||
//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 + 0xfa, nunchuck_id, sizeof(nunchuck_id));
|
||||
if(g_Config.bNunchuckConnected)
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -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 */
|
||||
static const u8 nunchuck_id[] =
|
||||
{
|
||||
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 */
|
||||
static const u8 nothing_id[] =
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue