Added extension option to Wiimote settings. It doesn't work currently. Renamed a file. Added log manager option to only show logs unique to that verbosity level.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1197 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d463c3b6f4
commit
816b979128
|
@ -815,8 +815,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _
|
||||||
AddEventToQueue(Event);
|
AddEventToQueue(Event);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
LOG(WII_IPC_WIIMOTE, "Event: SendEventAuthenticationCompleted");
|
LOGV(WII_IPC_WIIMOTE, 1, "Event: SendEventAuthenticationCompleted");
|
||||||
LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted->Connection_Handle);
|
LOGV(WII_IPC_WIIMOTE, 1, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted->Connection_Handle);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,6 +459,7 @@ void CWII_IPC_HLE_WiiMote::CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size)
|
void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 1, "=======================================================");
|
||||||
u32 Offset = 0;
|
u32 Offset = 0;
|
||||||
SL2CAP_CommandConfigurationReq* pCommandConfigReq = (SL2CAP_CommandConfigurationReq*)_pData;
|
SL2CAP_CommandConfigurationReq* pCommandConfigReq = (SL2CAP_CommandConfigurationReq*)_pData;
|
||||||
|
|
||||||
|
@ -467,10 +468,10 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(pCommandConfigReq->dcid));
|
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(pCommandConfigReq->dcid));
|
||||||
SChannel& rChannel = m_Channel[pCommandConfigReq->dcid];
|
SChannel& rChannel = m_Channel[pCommandConfigReq->dcid];
|
||||||
|
|
||||||
LOG(WII_IPC_WIIMOTE, " CommandCofigurationReq");
|
LOGV(WII_IPC_WIIMOTE, 1, " CommandCofigurationReq");
|
||||||
LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
LOGV(WII_IPC_WIIMOTE, 1, " Ident: 0x%02x", _Ident);
|
||||||
LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandConfigReq->dcid);
|
LOGV(WII_IPC_WIIMOTE, 1, " DCID: 0x%04x", pCommandConfigReq->dcid);
|
||||||
LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", pCommandConfigReq->flags);
|
LOGV(WII_IPC_WIIMOTE, 1, " Flags: 0x%04x", pCommandConfigReq->flags);
|
||||||
|
|
||||||
Offset += sizeof(SL2CAP_CommandConfigurationReq);
|
Offset += sizeof(SL2CAP_CommandConfigurationReq);
|
||||||
|
|
||||||
|
@ -497,7 +498,7 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2);
|
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2);
|
||||||
SL2CAP_OptionsMTU* pMTU = (SL2CAP_OptionsMTU*)&_pData[Offset];
|
SL2CAP_OptionsMTU* pMTU = (SL2CAP_OptionsMTU*)&_pData[Offset];
|
||||||
rChannel.MTU = pMTU->MTU;
|
rChannel.MTU = pMTU->MTU;
|
||||||
LOG(WII_IPC_WIIMOTE, " Config MTU: 0x%04x", pMTU->MTU);
|
LOGV(WII_IPC_WIIMOTE, 1, " Config MTU: 0x%04x", pMTU->MTU);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -506,7 +507,7 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2);
|
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2);
|
||||||
SL2CAP_OptionsFlushTimeOut* pFlushTimeOut = (SL2CAP_OptionsFlushTimeOut*)&_pData[Offset];
|
SL2CAP_OptionsFlushTimeOut* pFlushTimeOut = (SL2CAP_OptionsFlushTimeOut*)&_pData[Offset];
|
||||||
rChannel.FlushTimeOut = pFlushTimeOut->TimeOut;
|
rChannel.FlushTimeOut = pFlushTimeOut->TimeOut;
|
||||||
LOG(WII_IPC_WIIMOTE, " Config FlushTimeOut: 0x%04x", pFlushTimeOut->TimeOut);
|
LOGV(WII_IPC_WIIMOTE, 1, " Config FlushTimeOut: 0x%04x", pFlushTimeOut->TimeOut);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -523,6 +524,7 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCommandToACL(_Ident, L2CAP_CONF_RSP, RespLen, TempBuffer);
|
SendCommandToACL(_Ident, L2CAP_CONF_RSP, RespLen, TempBuffer);
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 1, "=======================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size)
|
void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
|
|
|
@ -281,7 +281,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
|
||||||
id = i*100 + type;
|
id = i*100 + type;
|
||||||
|
|
||||||
// write to memory
|
// write to memory
|
||||||
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, Msg2);
|
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, v, Msg2);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
// write to file
|
// write to file
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
{
|
{
|
||||||
bool m_bInUse;
|
bool m_bInUse;
|
||||||
LogTypes::LOG_TYPE m_type;
|
LogTypes::LOG_TYPE m_type;
|
||||||
|
int m_verbosity;
|
||||||
char m_szMessage[MAX_MSGLEN];
|
char m_szMessage[MAX_MSGLEN];
|
||||||
int m_dwMsgLen;
|
int m_dwMsgLen;
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// set
|
// set
|
||||||
void Set(LogTypes::LOG_TYPE _type, char* _szMessage)
|
void Set(LogTypes::LOG_TYPE _type, int _verbosity, char* _szMessage)
|
||||||
{
|
{
|
||||||
strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1);
|
strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1);
|
||||||
m_szMessage[MAX_MSGLEN-1] = 0;
|
m_szMessage[MAX_MSGLEN-1] = 0;
|
||||||
|
@ -95,6 +96,7 @@ public:
|
||||||
m_szMessage[m_dwMsgLen] = 0;
|
m_szMessage[m_dwMsgLen] = 0;
|
||||||
|
|
||||||
m_type = _type;
|
m_type = _type;
|
||||||
|
m_verbosity = _verbosity;
|
||||||
m_bInUse = true; // turn on this message line
|
m_bInUse = true; // turn on this message line
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -64,6 +64,7 @@ CLogWindow::CLogWindow(wxWindow* parent)
|
||||||
0, NULL, wxNO_BORDER);
|
0, NULL, wxNO_BORDER);
|
||||||
m_options->Append(wxT("Resolve symbols"));
|
m_options->Append(wxT("Resolve symbols"));
|
||||||
m_options->Append(wxT("Write master"));
|
m_options->Append(wxT("Write master"));
|
||||||
|
m_options->Append(wxT("Show unique"));
|
||||||
m_optionsSizer->Add(m_options, 0, 0, 0);
|
m_optionsSizer->Add(m_options, 0, 0, 0);
|
||||||
|
|
||||||
// I could not find any transparency setting and it would not automatically space correctly
|
// I could not find any transparency setting and it would not automatically space correctly
|
||||||
|
@ -144,8 +145,10 @@ void CLogWindow::Load(IniFile& _IniFile)
|
||||||
// load options
|
// load options
|
||||||
_IniFile.Get("LogWindow", "ResolveSymbols", &LogManager::m_LogSettings->bResolve, false);
|
_IniFile.Get("LogWindow", "ResolveSymbols", &LogManager::m_LogSettings->bResolve, false);
|
||||||
_IniFile.Get("LogWindow", "WriteMaster", &LogManager::m_LogSettings->bWriteMaster, false);
|
_IniFile.Get("LogWindow", "WriteMaster", &LogManager::m_LogSettings->bWriteMaster, false);
|
||||||
|
_IniFile.Get("LogWindow", "Show unique", &bOnlyUnique, false);
|
||||||
m_options->Check(0, LogManager::m_LogSettings->bResolve);
|
m_options->Check(0, LogManager::m_LogSettings->bResolve);
|
||||||
m_options->Check(1, LogManager::m_LogSettings->bWriteMaster);
|
m_options->Check(1, LogManager::m_LogSettings->bWriteMaster);
|
||||||
|
m_options->Check(2, bOnlyUnique);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogWindow::OnSubmit(wxCommandEvent& event)
|
void CLogWindow::OnSubmit(wxCommandEvent& event)
|
||||||
|
@ -239,7 +242,7 @@ void CLogWindow::UpdateChecks()
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
// When an option is changed
|
// When an option is changed, save the change
|
||||||
// ---------------
|
// ---------------
|
||||||
void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -247,8 +250,10 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
||||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||||
LogManager::m_LogSettings->bResolve = m_options->IsChecked(0);
|
LogManager::m_LogSettings->bResolve = m_options->IsChecked(0);
|
||||||
LogManager::m_LogSettings->bWriteMaster = m_options->IsChecked(1);
|
LogManager::m_LogSettings->bWriteMaster = m_options->IsChecked(1);
|
||||||
|
bOnlyUnique = m_options->IsChecked(2);
|
||||||
ini.Set("LogWindow", "ResolveSymbols", m_options->IsChecked(0));
|
ini.Set("LogWindow", "ResolveSymbols", m_options->IsChecked(0));
|
||||||
ini.Set("LogWindow", "WriteMaster", m_options->IsChecked(1));
|
ini.Set("LogWindow", "WriteMaster", m_options->IsChecked(1));
|
||||||
|
ini.Set("LogWindow", "OnlyUnique", m_options->IsChecked(2));
|
||||||
ini.Save(DEBUGGER_CONFIG_FILE);
|
ini.Save(DEBUGGER_CONFIG_FILE);
|
||||||
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
|
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
|
||||||
}
|
}
|
||||||
|
@ -369,9 +374,22 @@ void CLogWindow::UpdateLog()
|
||||||
// only show checkboxed logs
|
// only show checkboxed logs
|
||||||
if (LogManager::m_Log[message.m_type]->m_bShowInLog)
|
if (LogManager::m_Log[message.m_type]->m_bShowInLog)
|
||||||
{
|
{
|
||||||
// memcpy is faster than strcpy
|
if(bOnlyUnique) /* don't show lower level messages that have fallen through
|
||||||
memcpy(p, message.m_szMessage, len);
|
to this higher level */
|
||||||
p += len;
|
{
|
||||||
|
if(message.m_verbosity == v)
|
||||||
|
{
|
||||||
|
// memcpy is faster than strcpy
|
||||||
|
memcpy(p, message.m_szMessage, len);
|
||||||
|
p += len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// memcpy is faster than strcpy
|
||||||
|
memcpy(p, message.m_szMessage, len);
|
||||||
|
p += len;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,6 +42,8 @@ class CLogWindow
|
||||||
wxCheckListBox* m_options;
|
wxCheckListBox* m_options;
|
||||||
wxRadioBox *m_RadioBox[1]; // radio boxes
|
wxRadioBox *m_RadioBox[1]; // radio boxes
|
||||||
bool m_bCheckDirty;
|
bool m_bCheckDirty;
|
||||||
|
bool bOnlyUnique;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
void OnSubmit(wxCommandEvent& event);
|
void OnSubmit(wxCommandEvent& event);
|
||||||
|
|
|
@ -536,14 +536,6 @@
|
||||||
<Filter
|
<Filter
|
||||||
Name="Emulated Wiimote"
|
Name="Emulated Wiimote"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\EmuDeclarations.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\EmuDeclarations.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\EmuDefinitions.cpp"
|
RelativePath=".\Src\EmuDefinitions.cpp"
|
||||||
>
|
>
|
||||||
|
@ -560,6 +552,14 @@
|
||||||
RelativePath=".\Src\EmuMain.h"
|
RelativePath=".\Src\EmuMain.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\EmuSubroutines.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\EmuSubroutines.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\FillReport.cpp"
|
RelativePath=".\Src\FillReport.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -37,6 +37,8 @@ void Config::Load()
|
||||||
|
|
||||||
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, 0); // Hardware
|
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, 0); // Hardware
|
||||||
iniFile.Get("Settings", "WideScreen", &bWideScreen, 0);
|
iniFile.Get("Settings", "WideScreen", &bWideScreen, 0);
|
||||||
|
iniFile.Get("Settings", "ExtensionConnected", &bExtensionConnected, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Save()
|
void Config::Save()
|
||||||
|
@ -45,6 +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.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct Config
|
||||||
// General
|
// General
|
||||||
bool bSidewaysDPad;
|
bool bSidewaysDPad;
|
||||||
bool bWideScreen;
|
bool bWideScreen;
|
||||||
|
bool bExtensionConnected;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Config g_Config;
|
extern Config g_Config;
|
||||||
|
|
|
@ -26,6 +26,7 @@ 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)
|
||||||
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)
|
||||||
|
@ -71,6 +72,8 @@ 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_ExtensionConnected->SetValue(g_Config.bExtensionConnected);
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -81,6 +84,7 @@ 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);
|
||||||
sbBasic->Add(sBasic);
|
sbBasic->Add(sBasic);
|
||||||
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
|
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
|
||||||
|
|
||||||
|
@ -122,5 +126,8 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||||
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();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,6 +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;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -70,7 +71,8 @@ class ConfigDialog : public wxDialog
|
||||||
ID_PAGEREAL,
|
ID_PAGEREAL,
|
||||||
|
|
||||||
ID_SIDEWAYSDPAD,
|
ID_SIDEWAYSDPAD,
|
||||||
ID_WIDESCREEN
|
ID_WIDESCREEN,
|
||||||
|
ID_EXTENSIONCONNECTED
|
||||||
};
|
};
|
||||||
|
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
|
|
|
@ -22,9 +22,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "wiimote_hid.h"
|
#include "wiimote_hid.h"
|
||||||
#include "EmuDeclarations.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;
|
||||||
//extern void __Log(int log, const char *format, ...);
|
//extern void __Log(int log, const char *format, ...);
|
||||||
|
@ -41,7 +42,7 @@ namespace WiiMoteEmu
|
||||||
|
|
||||||
|
|
||||||
void HidOutputReport(u16 _channelID, wm_report* sr) {
|
void HidOutputReport(u16 _channelID, wm_report* sr) {
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, ">>>========================================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
|
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, "HidOutputReport(0x%02x)", sr->channel);
|
LOGV(WII_IPC_WIIMOTE, 0, "HidOutputReport(0x%02x)", sr->channel);
|
||||||
|
|
||||||
|
@ -86,11 +87,14 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WmLeds(u16 _channelID, wm_leds* leds) {
|
void WmLeds(u16 _channelID, wm_leds* leds) {
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
|
|
||||||
LOG(WII_IPC_WIIMOTE, " Set LEDs");
|
LOG(WII_IPC_WIIMOTE, " Set LEDs");
|
||||||
LOG(WII_IPC_WIIMOTE, " Leds: %x", leds->leds);
|
LOG(WII_IPC_WIIMOTE, " Leds: %x", leds->leds);
|
||||||
LOG(WII_IPC_WIIMOTE, " Rumble: %x", leds->rumble);
|
LOG(WII_IPC_WIIMOTE, " Rumble: %x", leds->rumble);
|
||||||
|
|
||||||
g_Leds = leds->leds;
|
g_Leds = leds->leds;
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
}
|
}
|
||||||
void WmSendAck(u16 _channelID, u8 _reportID)
|
void WmSendAck(u16 _channelID, u8 _reportID)
|
||||||
{
|
{
|
||||||
|
@ -121,6 +125,7 @@ void WmSendAck(u16 _channelID, u8 _reportID)
|
||||||
|
|
||||||
void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
|
void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
|
||||||
{
|
{
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
LOG(WII_IPC_WIIMOTE, " Set Data reporting mode");
|
LOG(WII_IPC_WIIMOTE, " Set Data reporting mode");
|
||||||
LOG(WII_IPC_WIIMOTE, " Rumble: %x", dr->rumble);
|
LOG(WII_IPC_WIIMOTE, " Rumble: %x", dr->rumble);
|
||||||
LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous);
|
LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous);
|
||||||
|
@ -141,6 +146,8 @@ void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WmSendAck(_channelID, WM_DATA_REPORTING);
|
// WmSendAck(_channelID, WM_DATA_REPORTING);
|
||||||
|
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,9 +221,10 @@ void SendReportCoreAccel(u16 _channelID)
|
||||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WmReadData(u16 _channelID, wm_read_data* rd)
|
void WmReadData(u16 _channelID, wm_read_data* rd)
|
||||||
{
|
{
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, ">>>========================================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
u32 address = convert24bit(rd->address);
|
u32 address = convert24bit(rd->address);
|
||||||
u16 size = convert16bit(rd->size);
|
u16 size = convert16bit(rd->size);
|
||||||
LOG(WII_IPC_WIIMOTE, " Read data");
|
LOG(WII_IPC_WIIMOTE, " Read data");
|
||||||
|
@ -272,11 +280,13 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
|
||||||
{
|
{
|
||||||
PanicAlert("WmReadData: unimplemented parameters (size: %i, addr: 0x%x!", size, rd->space);
|
PanicAlert("WmReadData: unimplemented parameters (size: %i, addr: 0x%x!", size, rd->space);
|
||||||
}
|
}
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, ">>>========================================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "===========================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WmWriteData(u16 _channelID, wm_write_data* wd)
|
void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
{
|
{
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "========================================================");
|
||||||
u32 address = convert24bit(wd->address);
|
u32 address = convert24bit(wd->address);
|
||||||
LOG(WII_IPC_WIIMOTE, " Write data");
|
LOG(WII_IPC_WIIMOTE, " Write data");
|
||||||
LOG(WII_IPC_WIIMOTE, " Address space: %x", wd->space);
|
LOG(WII_IPC_WIIMOTE, " Address space: %x", wd->space);
|
||||||
|
@ -284,6 +294,7 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
LOG(WII_IPC_WIIMOTE, " Size: 0x%02x", wd->size);
|
LOG(WII_IPC_WIIMOTE, " Size: 0x%02x", wd->size);
|
||||||
LOG(WII_IPC_WIIMOTE, " Rumble: %x", wd->rumble);
|
LOG(WII_IPC_WIIMOTE, " Rumble: %x", wd->rumble);
|
||||||
|
|
||||||
|
// Write to EEPROM
|
||||||
if(wd->size <= 16 && wd->space == WM_SPACE_EEPROM)
|
if(wd->size <= 16 && wd->space == WM_SPACE_EEPROM)
|
||||||
{
|
{
|
||||||
if(address + wd->size > WIIMOTE_EEPROM_SIZE) {
|
if(address + wd->size > WIIMOTE_EEPROM_SIZE) {
|
||||||
|
@ -294,32 +305,37 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
|
|
||||||
// WmSendAck(_channelID, WM_WRITE_DATA);
|
// WmSendAck(_channelID, WM_WRITE_DATA);
|
||||||
}
|
}
|
||||||
|
// Write to registers
|
||||||
else if(wd->size <= 16 && (wd->space == WM_SPACE_REGS1 || wd->space == WM_SPACE_REGS2))
|
else if(wd->size <= 16 && (wd->space == WM_SPACE_REGS1 || wd->space == WM_SPACE_REGS2))
|
||||||
{
|
{
|
||||||
u8* block;
|
u8* block;
|
||||||
u32 blockSize;
|
u32 blockSize;
|
||||||
switch((address >> 16) & 0xFE) {
|
switch((address >> 16) & 0xFE)
|
||||||
case 0xA2:
|
{
|
||||||
block = g_RegSpeaker;
|
case 0xA2:
|
||||||
blockSize = WIIMOTE_REG_SPEAKER_SIZE;
|
block = g_RegSpeaker;
|
||||||
break;
|
blockSize = WIIMOTE_REG_SPEAKER_SIZE;
|
||||||
case 0xA4:
|
break;
|
||||||
block = g_RegExt;
|
case 0xA4:
|
||||||
blockSize = WIIMOTE_REG_EXT_SIZE;
|
block = g_RegExt; // Extension Controller register
|
||||||
break;
|
blockSize = WIIMOTE_REG_EXT_SIZE;
|
||||||
case 0xB0:
|
LOGV(WII_IPC_WIIMOTE, 0, " Case 0xA4: Write g_RegExt *********************************");
|
||||||
block = g_RegIr;
|
PanicAlert(" Case 0xA4: Write g_RegExt");
|
||||||
blockSize = WIIMOTE_REG_IR_SIZE;
|
break;
|
||||||
break;
|
case 0xB0:
|
||||||
default:
|
block = g_RegIr;
|
||||||
PanicAlert("WmWriteData: bad register block!");
|
blockSize = WIIMOTE_REG_IR_SIZE;
|
||||||
return;
|
break;
|
||||||
|
default:
|
||||||
|
PanicAlert("WmWriteData: bad register block!");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
address &= 0xFFFF;
|
address &= 0xFFFF;
|
||||||
if(address + wd->size > blockSize) {
|
if(address + wd->size > blockSize) {
|
||||||
PanicAlert("WmWriteData: address + size out of bounds!");
|
PanicAlert("WmWriteData: address + size out of bounds!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// finally write the registers to memory
|
||||||
memcpy(wd->data, block + address, wd->size);
|
memcpy(wd->data, block + address, wd->size);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -328,6 +344,7 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
|
||||||
|
|
||||||
// just added for home brew.... hmmmm
|
// just added for home brew.... hmmmm
|
||||||
WmSendAck(_channelID, WM_WRITE_DATA);
|
WmSendAck(_channelID, WM_WRITE_DATA);
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "==========================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
int WriteWmReport(u8* dst, u8 channel) {
|
int WriteWmReport(u8* dst, u8 channel) {
|
||||||
|
@ -346,9 +363,9 @@ int WriteWmReport(u8* dst, u8 channel) {
|
||||||
void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
||||||
{
|
{
|
||||||
//PanicAlert("WmRequestStatus");
|
//PanicAlert("WmRequestStatus");
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, ">>>======================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "================================================");
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Request Status");
|
LOGV(WII_IPC_WIIMOTE, 0, " Request Status");
|
||||||
LOG(WII_IPC_WIIMOTE, " Rumble: %x", rs->rumble);
|
LOGV(WII_IPC_WIIMOTE, 0, " Rumble: %x", rs->rumble);
|
||||||
|
|
||||||
//SendStatusReport();
|
//SendStatusReport();
|
||||||
u8 DataFrame[1024];
|
u8 DataFrame[1024];
|
||||||
|
@ -362,19 +379,23 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs)
|
||||||
pStatus->battery = 0x4F; //arbitrary number
|
pStatus->battery = 0x4F; //arbitrary number
|
||||||
|
|
||||||
// this gets us passed the first error, but later brings up the disconnected error
|
// this gets us passed the first error, but later brings up the disconnected error
|
||||||
pStatus->extension = 0;
|
if(g_Config.bExtensionConnected)
|
||||||
|
pStatus->extension = 1;
|
||||||
|
else
|
||||||
|
pStatus->extension = 0;
|
||||||
|
|
||||||
LOGV(WII_IPC_WIIMOTE, 0," SendStatusReport()");
|
LOGV(WII_IPC_WIIMOTE, 0, " Extension: %x", pStatus->extension);
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Flags: 0x%02x", pStatus->padding1[2]);
|
LOGV(WII_IPC_WIIMOTE, 0, " SendStatusReport()");
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, " Flags: 0x%02x", pStatus->padding1[2]);
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, " Battery: %d", pStatus->battery);
|
LOGV(WII_IPC_WIIMOTE, 0, " Battery: %d", pStatus->battery);
|
||||||
|
|
||||||
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, "==========================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "=================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size)
|
void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size)
|
||||||
{
|
{
|
||||||
LOGV(WII_IPC_WIIMOTE, 0, ">>>======================================");
|
LOGV(WII_IPC_WIIMOTE, 0, "=========================================");
|
||||||
int dataOffset = 0;
|
int dataOffset = 0;
|
||||||
while (_Size > 0)
|
while (_Size > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "wiimote_hid.h"
|
#include "wiimote_hid.h"
|
||||||
#include "EmuDeclarations.h"
|
#include "EmuSubroutines.h"
|
||||||
#include "EmuDefinitions.h"
|
#include "EmuDefinitions.h"
|
||||||
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
|
||||||
|
|
||||||
|
@ -77,12 +77,13 @@ void CryptBuffer(u8* _buffer, u8 _size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteCryped16(u8* _baseBlock, u16 _address, u16 _value)
|
void WriteCrypted16(u8* _baseBlock, u16 _address, u16 _value)
|
||||||
{
|
{
|
||||||
u16 cryptedValue = _value;
|
u16 cryptedValue = _value;
|
||||||
CryptBuffer((u8*)&cryptedValue, sizeof(u16));
|
CryptBuffer((u8*)&cryptedValue, sizeof(u16));
|
||||||
|
|
||||||
*(u16*)(_baseBlock + _address) = cryptedValue;
|
*(u16*)(_baseBlock + _address) = cryptedValue;
|
||||||
|
//PanicAlert("Converted %04x to %04x", _value, cryptedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
|
@ -94,12 +95,14 @@ void Initialize()
|
||||||
g_ReportingMode = 0;
|
g_ReportingMode = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Write 0x0000 in encrypted form (0xfefe) to 0xfe in the extension register
|
||||||
|
WriteCrypted16(g_RegExt, 0xfe, 0x0000); // Fully inserted Nunchuk
|
||||||
|
|
||||||
WriteCryped16(g_RegExt, 0xfe, 0x0000);
|
|
||||||
|
|
||||||
// g_RegExt[0xfd] = 0x1e;
|
// g_RegExt[0xfd] = 0x1e;
|
||||||
// g_RegExt[0xfc] = 0x9a;
|
// g_RegExt[0xfc] = 0x9a;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(void* ptr, int mode)
|
void DoState(void* ptr, int mode)
|
||||||
|
@ -113,7 +116,7 @@ void Shutdown(void)
|
||||||
|
|
||||||
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "=============================================================");
|
||||||
const u8* data = (const u8*)_pData;
|
const u8* data = (const u8*)_pData;
|
||||||
|
|
||||||
// dump raw data
|
// dump raw data
|
||||||
|
@ -155,6 +158,7 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||||
PanicAlert("HidInput: Unknown type 0x%02x and param 0x%02x", hidp->type, hidp->param);
|
PanicAlert("HidInput: Unknown type 0x%02x and param 0x%02x", hidp->type, hidp->param);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "=============================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
|
@ -24,7 +24,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "wiimote_hid.h"
|
#include "wiimote_hid.h"
|
||||||
#include "EmuDeclarations.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
|
#include "Config.h" // for g_Config
|
||||||
|
|
|
@ -157,6 +157,7 @@ extern "C" void Wiimote_Shutdown(void)
|
||||||
|
|
||||||
extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "=============================================================");
|
||||||
const u8* data = (const u8*)_pData;
|
const u8* data = (const u8*)_pData;
|
||||||
|
|
||||||
// dump raw data
|
// dump raw data
|
||||||
|
@ -176,7 +177,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32
|
||||||
WiiMoteReal::InterruptChannel(_channelID, _pData, _Size);
|
WiiMoteReal::InterruptChannel(_channelID, _pData, _Size);
|
||||||
else
|
else
|
||||||
WiiMoteEmu::InterruptChannel(_channelID, _pData, _Size);
|
WiiMoteEmu::InterruptChannel(_channelID, _pData, _Size);
|
||||||
|
LOGV(WII_IPC_WIIMOTE, 0, "=============================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||||
|
|
Loading…
Reference in New Issue