diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 00c6a7225c..69405bcfd1 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -815,8 +815,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _ AddEventToQueue(Event); // Log - LOG(WII_IPC_WIIMOTE, "Event: SendEventAuthenticationCompleted"); - LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted->Connection_Handle); + LOGV(WII_IPC_WIIMOTE, 1, "Event: SendEventAuthenticationCompleted"); + LOGV(WII_IPC_WIIMOTE, 1, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted->Connection_Handle); return true; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index a8d9c514be..c2ce1f2f2c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -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) { + LOGV(WII_IPC_WIIMOTE, 1, "======================================================="); u32 Offset = 0; 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)); SChannel& rChannel = m_Channel[pCommandConfigReq->dcid]; - LOG(WII_IPC_WIIMOTE, " CommandCofigurationReq"); - LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident); - LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandConfigReq->dcid); - LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", pCommandConfigReq->flags); + LOGV(WII_IPC_WIIMOTE, 1, " CommandCofigurationReq"); + LOGV(WII_IPC_WIIMOTE, 1, " Ident: 0x%02x", _Ident); + LOGV(WII_IPC_WIIMOTE, 1, " DCID: 0x%04x", pCommandConfigReq->dcid); + LOGV(WII_IPC_WIIMOTE, 1, " Flags: 0x%04x", pCommandConfigReq->flags); 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); SL2CAP_OptionsMTU* pMTU = (SL2CAP_OptionsMTU*)&_pData[Offset]; 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; @@ -506,7 +507,7 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si _dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == 2); SL2CAP_OptionsFlushTimeOut* pFlushTimeOut = (SL2CAP_OptionsFlushTimeOut*)&_pData[Offset]; 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; @@ -523,6 +524,7 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si } SendCommandToACL(_Ident, L2CAP_CONF_RSP, RespLen, TempBuffer); + LOGV(WII_IPC_WIIMOTE, 1, "======================================================="); } void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size) diff --git a/Source/Core/Core/Src/LogManager.cpp b/Source/Core/Core/Src/LogManager.cpp index 6c36c177e4..0f06dd070f 100644 --- a/Source/Core/Core/Src/LogManager.cpp +++ b/Source/Core/Core/Src/LogManager.cpp @@ -281,7 +281,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...) id = i*100 + type; // 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 diff --git a/Source/Core/Core/Src/LogManager.h b/Source/Core/Core/Src/LogManager.h index 1fbe2bdc57..ac6fc36fc1 100644 --- a/Source/Core/Core/Src/LogManager.h +++ b/Source/Core/Core/Src/LogManager.h @@ -52,7 +52,7 @@ struct CDebugger_LogSettings { int m_iVerbosity; // verbosity level 0 - 2 bool bResolve; - bool bWriteMaster; + bool bWriteMaster; // constructor CDebugger_LogSettings(); @@ -72,6 +72,7 @@ public: { bool m_bInUse; LogTypes::LOG_TYPE m_type; + int m_verbosity; char m_szMessage[MAX_MSGLEN]; int m_dwMsgLen; @@ -81,7 +82,7 @@ public: {} // 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); m_szMessage[MAX_MSGLEN-1] = 0; @@ -95,6 +96,7 @@ public: m_szMessage[m_dwMsgLen] = 0; m_type = _type; + m_verbosity = _verbosity; m_bInUse = true; // turn on this message line } // diff --git a/Source/Core/DebuggerWX/Src/LogWindow.cpp b/Source/Core/DebuggerWX/Src/LogWindow.cpp index e139fe81cd..e9c35063af 100644 --- a/Source/Core/DebuggerWX/Src/LogWindow.cpp +++ b/Source/Core/DebuggerWX/Src/LogWindow.cpp @@ -64,6 +64,7 @@ CLogWindow::CLogWindow(wxWindow* parent) 0, NULL, wxNO_BORDER); m_options->Append(wxT("Resolve symbols")); m_options->Append(wxT("Write master")); + m_options->Append(wxT("Show unique")); m_optionsSizer->Add(m_options, 0, 0, 0); // 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 _IniFile.Get("LogWindow", "ResolveSymbols", &LogManager::m_LogSettings->bResolve, 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(1, LogManager::m_LogSettings->bWriteMaster); + m_options->Check(2, bOnlyUnique); } 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) { @@ -247,8 +250,10 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event) ini.Load(DEBUGGER_CONFIG_FILE); LogManager::m_LogSettings->bResolve = m_options->IsChecked(0); LogManager::m_LogSettings->bWriteMaster = m_options->IsChecked(1); + bOnlyUnique = m_options->IsChecked(2); ini.Set("LogWindow", "ResolveSymbols", m_options->IsChecked(0)); ini.Set("LogWindow", "WriteMaster", m_options->IsChecked(1)); + ini.Set("LogWindow", "OnlyUnique", m_options->IsChecked(2)); ini.Save(DEBUGGER_CONFIG_FILE); if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog(); } @@ -369,9 +374,22 @@ void CLogWindow::UpdateLog() // only show checkboxed logs if (LogManager::m_Log[message.m_type]->m_bShowInLog) { - // memcpy is faster than strcpy - memcpy(p, message.m_szMessage, len); - p += len; + if(bOnlyUnique) /* don't show lower level messages that have fallen through + to this higher level */ + { + 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 diff --git a/Source/Core/DebuggerWX/Src/LogWindow.h b/Source/Core/DebuggerWX/Src/LogWindow.h index cd1ead4719..e05c377fbd 100644 --- a/Source/Core/DebuggerWX/Src/LogWindow.h +++ b/Source/Core/DebuggerWX/Src/LogWindow.h @@ -42,6 +42,8 @@ class CLogWindow wxCheckListBox* m_options; wxRadioBox *m_RadioBox[1]; // radio boxes bool m_bCheckDirty; + bool bOnlyUnique; + DECLARE_EVENT_TABLE() void OnSubmit(wxCommandEvent& event); diff --git a/Source/Plugins/Plugin_Wiimote_Test/Plugin_Wiimote_Test.vcproj b/Source/Plugins/Plugin_Wiimote_Test/Plugin_Wiimote_Test.vcproj index 33bbf935cb..6e72131c87 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Plugin_Wiimote_Test.vcproj +++ b/Source/Plugins/Plugin_Wiimote_Test/Plugin_Wiimote_Test.vcproj @@ -536,14 +536,6 @@ - - - - @@ -560,6 +552,14 @@ RelativePath=".\Src\EmuMain.h" > + + + + diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/Config.cpp index 6dd5007318..442a05a9e4 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/Config.cpp @@ -37,6 +37,8 @@ void Config::Load() iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, 0); // Hardware iniFile.Get("Settings", "WideScreen", &bWideScreen, 0); + iniFile.Get("Settings", "ExtensionConnected", &bExtensionConnected, 0); + } void Config::Save() @@ -45,6 +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.Save(FULL_CONFIG_DIR "Wiimote.ini"); } diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/Config.h b/Source/Plugins/Plugin_Wiimote_Test/Src/Config.h index cb72bb04d2..0366f896bf 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/Config.h @@ -33,6 +33,7 @@ struct Config // General bool bSidewaysDPad; bool bWideScreen; + bool bExtensionConnected; }; extern Config g_Config; diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.cpp index 97e79a3261..3d0f1ed362 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.cpp @@ -26,6 +26,7 @@ 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) END_EVENT_TABLE() 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_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); // ---------------------------------------------------------------------- @@ -81,6 +84,7 @@ 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); sbBasic->Add(sBasic); sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5); @@ -122,5 +126,8 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) case ID_WIDESCREEN: g_Config.bWideScreen = m_WideScreen->IsChecked(); break; + case ID_EXTENSIONCONNECTED: + g_Config.bExtensionConnected = m_ExtensionConnected->IsChecked(); + break; } } \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.h b/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.h index 5925b6a688..9b68936349 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/ConfigDlg.h @@ -59,6 +59,7 @@ class ConfigDialog : public wxDialog wxCheckBox *m_SidewaysDPad; // general settings wxCheckBox *m_WideScreen; + wxCheckBox *m_ExtensionConnected; enum { @@ -70,7 +71,8 @@ class ConfigDialog : public wxDialog ID_PAGEREAL, ID_SIDEWAYSDPAD, - ID_WIDESCREEN + ID_WIDESCREEN, + ID_EXTENSIONCONNECTED }; void OnClose(wxCloseEvent& event); diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/EmuMain.cpp index 0ef81842f3..897df17611 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/EmuMain.cpp @@ -22,9 +22,10 @@ #include #include "Common.h" #include "wiimote_hid.h" -#include "EmuDeclarations.h" +#include "EmuSubroutines.h" #include "EmuDefinitions.h" #include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd +#include "Config.h" // for g_Config extern SWiimoteInitialize g_WiimoteInitialize; //extern void __Log(int log, const char *format, ...); @@ -41,7 +42,7 @@ namespace WiiMoteEmu 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); @@ -86,11 +87,14 @@ void HidOutputReport(u16 _channelID, wm_report* sr) { } void WmLeds(u16 _channelID, wm_leds* leds) { + LOGV(WII_IPC_WIIMOTE, 0, "==========================================================="); + LOG(WII_IPC_WIIMOTE, " Set LEDs"); LOG(WII_IPC_WIIMOTE, " Leds: %x", leds->leds); LOG(WII_IPC_WIIMOTE, " Rumble: %x", leds->rumble); g_Leds = leds->leds; + LOGV(WII_IPC_WIIMOTE, 0, "==========================================================="); } void WmSendAck(u16 _channelID, u8 _reportID) { @@ -121,6 +125,7 @@ void WmSendAck(u16 _channelID, u8 _reportID) 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, " Rumble: %x", dr->rumble); 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); + + LOGV(WII_IPC_WIIMOTE, 0, "==========================================================="); } @@ -214,9 +221,10 @@ void SendReportCoreAccel(u16 _channelID) g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); } + void WmReadData(u16 _channelID, wm_read_data* rd) { - LOGV(WII_IPC_WIIMOTE, 0, ">>>========================================================"); + LOGV(WII_IPC_WIIMOTE, 0, "==========================================================="); u32 address = convert24bit(rd->address); u16 size = convert16bit(rd->size); 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); } - LOGV(WII_IPC_WIIMOTE, 0, ">>>========================================================"); + LOGV(WII_IPC_WIIMOTE, 0, "==========================================================="); } + void WmWriteData(u16 _channelID, wm_write_data* wd) { + LOGV(WII_IPC_WIIMOTE, 0, "========================================================"); u32 address = convert24bit(wd->address); LOG(WII_IPC_WIIMOTE, " Write data"); 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, " Rumble: %x", wd->rumble); + // Write to EEPROM if(wd->size <= 16 && wd->space == WM_SPACE_EEPROM) { if(address + wd->size > WIIMOTE_EEPROM_SIZE) { @@ -294,32 +305,37 @@ void WmWriteData(u16 _channelID, wm_write_data* wd) // WmSendAck(_channelID, WM_WRITE_DATA); } + // Write to registers else if(wd->size <= 16 && (wd->space == WM_SPACE_REGS1 || wd->space == WM_SPACE_REGS2)) { u8* block; u32 blockSize; - switch((address >> 16) & 0xFE) { - case 0xA2: - block = g_RegSpeaker; - blockSize = WIIMOTE_REG_SPEAKER_SIZE; - break; - case 0xA4: - block = g_RegExt; - blockSize = WIIMOTE_REG_EXT_SIZE; - break; - case 0xB0: - block = g_RegIr; - blockSize = WIIMOTE_REG_IR_SIZE; - break; - default: - PanicAlert("WmWriteData: bad register block!"); - return; + switch((address >> 16) & 0xFE) + { + case 0xA2: + block = g_RegSpeaker; + blockSize = WIIMOTE_REG_SPEAKER_SIZE; + break; + case 0xA4: + block = g_RegExt; // Extension Controller register + blockSize = WIIMOTE_REG_EXT_SIZE; + LOGV(WII_IPC_WIIMOTE, 0, " Case 0xA4: Write g_RegExt *********************************"); + PanicAlert(" Case 0xA4: Write g_RegExt"); + break; + case 0xB0: + block = g_RegIr; + blockSize = WIIMOTE_REG_IR_SIZE; + break; + default: + PanicAlert("WmWriteData: bad register block!"); + return; } address &= 0xFFFF; if(address + wd->size > blockSize) { PanicAlert("WmWriteData: address + size out of bounds!"); return; } + // finally write the registers to memory memcpy(wd->data, block + address, wd->size); } else { @@ -328,6 +344,7 @@ void WmWriteData(u16 _channelID, wm_write_data* wd) // just added for home brew.... hmmmm WmSendAck(_channelID, WM_WRITE_DATA); + LOGV(WII_IPC_WIIMOTE, 0, "=========================================================="); } int WriteWmReport(u8* dst, u8 channel) { @@ -346,9 +363,9 @@ int WriteWmReport(u8* dst, u8 channel) { void WmRequestStatus(u16 _channelID, wm_request_status* rs) { //PanicAlert("WmRequestStatus"); - LOGV(WII_IPC_WIIMOTE, 0, ">>>======================================"); + LOGV(WII_IPC_WIIMOTE, 0, "================================================"); 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(); u8 DataFrame[1024]; @@ -362,19 +379,23 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs) pStatus->battery = 0x4F; //arbitrary number // 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, " Flags: 0x%02x", pStatus->padding1[2]); + LOGV(WII_IPC_WIIMOTE, 0, " Extension: %x", pStatus->extension); + 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); 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) { - LOGV(WII_IPC_WIIMOTE, 0, ">>>======================================"); + LOGV(WII_IPC_WIIMOTE, 0, "========================================="); int dataOffset = 0; while (_Size > 0) { diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/EmuDeclarations.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/EmuSubroutines.cpp similarity index 87% rename from Source/Plugins/Plugin_Wiimote_Test/Src/EmuDeclarations.cpp rename to Source/Plugins/Plugin_Wiimote_Test/Src/EmuSubroutines.cpp index 2b8c643eec..bff0d8b1f9 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/EmuDeclarations.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/EmuSubroutines.cpp @@ -22,7 +22,7 @@ #include #include "Common.h" #include "wiimote_hid.h" -#include "EmuDeclarations.h" +#include "EmuSubroutines.h" #include "EmuDefinitions.h" #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; CryptBuffer((u8*)&cryptedValue, sizeof(u16)); *(u16*)(_baseBlock + _address) = cryptedValue; + //PanicAlert("Converted %04x to %04x", _value, cryptedValue); } void Initialize() @@ -94,12 +95,14 @@ void Initialize() g_ReportingMode = 0; - - WriteCryped16(g_RegExt, 0xfe, 0x0000); + // Write 0x0000 in encrypted form (0xfefe) to 0xfe in the extension register + WriteCrypted16(g_RegExt, 0xfe, 0x0000); // Fully inserted Nunchuk + // g_RegExt[0xfd] = 0x1e; // g_RegExt[0xfc] = 0x9a; + } void DoState(void* ptr, int mode) @@ -113,7 +116,7 @@ void Shutdown(void) void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) { - + LOGV(WII_IPC_WIIMOTE, 0, "============================================================="); const u8* data = (const u8*)_pData; // 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); break; } + LOGV(WII_IPC_WIIMOTE, 0, "============================================================="); } void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) @@ -228,4 +232,4 @@ void Update() // g_ReportingMode = 0; } -} \ No newline at end of file +} diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/EmuDeclarations.h b/Source/Plugins/Plugin_Wiimote_Test/Src/EmuSubroutines.h similarity index 100% rename from Source/Plugins/Plugin_Wiimote_Test/Src/EmuDeclarations.h rename to Source/Plugins/Plugin_Wiimote_Test/Src/EmuSubroutines.h diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/FillReport.cpp index a203956949..05f6a09e97 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/FillReport.cpp @@ -24,7 +24,7 @@ #include #include "Common.h" #include "wiimote_hid.h" -#include "EmuDeclarations.h" +#include "EmuSubroutines.h" #include "EmuDefinitions.h" #include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd #include "Config.h" // for g_Config diff --git a/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp b/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp index 3284a9e734..b242e007ca 100644 --- a/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote_Test/Src/main.cpp @@ -157,6 +157,7 @@ extern "C" void Wiimote_Shutdown(void) extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) { + LOGV(WII_IPC_WIIMOTE, 0, "============================================================="); const u8* data = (const u8*)_pData; // dump raw data @@ -176,7 +177,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 WiiMoteReal::InterruptChannel(_channelID, _pData, _Size); else WiiMoteEmu::InterruptChannel(_channelID, _pData, _Size); - + LOGV(WII_IPC_WIIMOTE, 0, "============================================================="); } extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)