normalize wiimote logging: no more crazy newlines, plugin logs to...wiimote plugin log, ipc wiimote stuff logs to...WII_IPC_WIIMOTE

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4270 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-09-15 02:12:55 +00:00
parent f08c482cc9
commit 65b6b15c6e
21 changed files with 355 additions and 319 deletions

View File

@ -59,7 +59,7 @@ LogManager::LogManager() : logMutex(1) {
m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler"); m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console"); m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport"); m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote"); m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote Plugin");
m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge"); m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC"); m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE"); m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
@ -72,7 +72,7 @@ LogManager::LogManager() : logMutex(1) {
m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE"); m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE");
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay"); m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manger", "MemCard Manger"); m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manger", "MemCard Manger");
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY" , "Netplay"); m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
m_fileLog = new FileLogListener(MAIN_LOG_FILE); m_fileLog = new FileLogListener(MAIN_LOG_FILE);
m_consoleLog = new ConsoleListener(); m_consoleLog = new ConsoleListener();

View File

@ -883,7 +883,7 @@ void Callback_KeyPress(int key, bool shift, bool control)
// //
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v) void Callback_WiimoteLog(const TCHAR* _szMessage, int _v)
{ {
GENERIC_LOG(LogTypes::WII_IPC_WIIMOTE, (LogTypes::LOG_LEVELS)_v, _szMessage); GENERIC_LOG(LogTypes::WIIMOTE, (LogTypes::LOG_LEVELS)_v, _szMessage);
} }
// TODO: Get rid of at some point // TODO: Get rid of at some point

View File

@ -221,6 +221,7 @@ void Config::Load(bool ChangePad)
// General // General
iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false); iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false);
iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE); iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE);
iniFile.Get("Settings", "MotionPlusConnected", &bMotionPlusConnected, false);
// Real Wiimote // Real Wiimote
iniFile.Get("Real", "Connect", &bConnectRealWiimote, true); iniFile.Get("Real", "Connect", &bConnectRealWiimote, true);
@ -312,7 +313,7 @@ void Config::Load(bool ChangePad)
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false); iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
iniFile.Get("Settings", "Crop", &bCrop, false); iniFile.Get("Settings", "Crop", &bCrop, false);
//INFO_LOG(CONSOLE, "Load()\n"); //DEBUG_LOG(WIIMOTE, "Load()");
} }
void Config::Save(int Slot) void Config::Save(int Slot)
@ -321,6 +322,7 @@ void Config::Save(int Slot)
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", "ExtensionConnected", iExtensionConnected); iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected);
iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected);
iniFile.Set("Real", "Connect", bConnectRealWiimote); iniFile.Set("Real", "Connect", bConnectRealWiimote);
iniFile.Set("Real", "Use", bUseRealWiimote); iniFile.Set("Real", "Use", bUseRealWiimote);
@ -407,5 +409,5 @@ void Config::Save(int Slot)
iniFile.Set(TmpSection, "IRHeight", iIRHeight); iniFile.Set(TmpSection, "IRHeight", iIRHeight);
iniFile.Save(FULL_CONFIG_DIR "IR Pointer.ini"); iniFile.Save(FULL_CONFIG_DIR "IR Pointer.ini");
//INFO_LOG(CONSOLE, "Save()\n"); //DEBUG_LOG(WIIMOTE, "Save()");
} }

View File

@ -101,6 +101,7 @@ struct Config
bool bSidewaysDPad; bool bSidewaysDPad;
bool bWideScreen; bool bWideScreen;
int iExtensionConnected; int iExtensionConnected;
bool bMotionPlusConnected;
// Real Wiimote // Real Wiimote
bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote; bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote;

View File

@ -34,7 +34,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteBasicConfigDialog::GeneralSettingsChanged)
//EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
// IR cursor // IR cursor
EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteBasicConfigDialog::IRCursorChanged) EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteBasicConfigDialog::IRCursorChanged)
@ -171,8 +171,9 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_SizeReal[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5); m_SizeReal[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5);
m_SizeReal[i]->Add(m_UseRealWiimote[i], 0, wxEXPAND | wxALL, 5); m_SizeReal[i]->Add(m_UseRealWiimote[i], 0, wxEXPAND | wxALL, 5);
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Wii Motion Plus Connected")); m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], ID_MOTIONPLUSCONNECTED, wxT("Wii Motion Plus Connected"));
m_WiiMotionPlusConnected[0]->Enable(false); m_WiiMotionPlusConnected[i]->SetValue(g_Config.bMotionPlusConnected);
m_WiiMotionPlusConnected[i]->Enable(false);
wxArrayString arrayStringFor_extension; wxArrayString arrayStringFor_extension;
arrayStringFor_extension.Add(wxT("None")); arrayStringFor_extension.Add(wxT("None"));
@ -186,7 +187,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
extensionChoice[i] = new wxChoice(m_Controller[i], ID_EXTCONNECTED, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator); extensionChoice[i] = new wxChoice(m_Controller[i], ID_EXTCONNECTED, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator);
extensionChoice[i]->SetSelection(0); extensionChoice[i]->SetSelection(0);
m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension")); m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension(s)"));
m_SizeExtensions[i]->Add(m_WiiMotionPlusConnected[i], 0, wxEXPAND | wxALL, 5); m_SizeExtensions[i]->Add(m_WiiMotionPlusConnected[i], 0, wxEXPAND | wxALL, 5);
m_SizeExtensions[i]->Add(extensionChoice[i], 0, wxEXPAND | wxALL, 5); m_SizeExtensions[i]->Add(extensionChoice[i], 0, wxEXPAND | wxALL, 5);
@ -320,7 +321,7 @@ void WiimoteBasicConfigDialog::DoConnectReal()
} }
else else
{ {
INFO_LOG(CONSOLE, "Post Message: %i\n", g_RealWiiMoteInitialized); DEBUG_LOG(WIIMOTE, "Post Message: %i", g_RealWiiMoteInitialized);
if (g_RealWiiMoteInitialized) if (g_RealWiiMoteInitialized)
{ {
WiiMoteReal::Shutdown(); WiiMoteReal::Shutdown();
@ -338,11 +339,11 @@ void WiimoteBasicConfigDialog::DoUseReal()
if (g_Config.iExtensionConnected != EXT_NONE) if (g_Config.iExtensionConnected != EXT_NONE)
UsingExtension = true; UsingExtension = true;
INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension); DEBUG_LOG(WIIMOTE, "DoUseReal() Connect extension: %i", !UsingExtension);
DoExtensionConnectedDisconnected(UsingExtension ? 0 : 1); DoExtensionConnectedDisconnected(UsingExtension ? 0 : 1);
UsingExtension = !UsingExtension; UsingExtension = !UsingExtension;
INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension); DEBUG_LOG(WIIMOTE, "DoUseReal() Connect extension: %i", !UsingExtension);
DoExtensionConnectedDisconnected(UsingExtension ? 1 : 0); DoExtensionConnectedDisconnected(UsingExtension ? 1 : 0);
if(g_EmulatorRunning) if(g_EmulatorRunning)
@ -385,7 +386,7 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case ID_USE_REAL: case ID_USE_REAL:
// Enable the Wiimote thread // Enable the Wiimote thread
g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked(); g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked();
if(g_Config.bUseRealWiimote) DoUseReal(); if (g_Config.bUseRealWiimote) DoUseReal();
break; break;
case ID_SIDEWAYSDPAD: case ID_SIDEWAYSDPAD:
@ -393,6 +394,7 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
break; break;
case ID_MOTIONPLUSCONNECTED: case ID_MOTIONPLUSCONNECTED:
g_Config.bMotionPlusConnected = m_WiiMotionPlusConnected[Page]->IsChecked();
break; break;
case ID_EXTCONNECTED: case ID_EXTCONNECTED:
g_Config.iExtensionConnected = EXT_NONE; g_Config.iExtensionConnected = EXT_NONE;
@ -406,7 +408,7 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
g_Config.iExtensionConnected = extensionChoice[Page]->GetSelection(); g_Config.iExtensionConnected = extensionChoice[Page]->GetSelection();
// Copy the calibration data // Copy the calibration data
WiiMoteEmu::SetDefaultExtensionRegistry(); WiiMoteEmu::UpdateExtRegisterBlocks();
// Generate connect/disconnect status event // Generate connect/disconnect status event
DoExtensionConnectedDisconnected(); DoExtensionConnectedDisconnected();

View File

@ -48,12 +48,12 @@ void WiimotePadConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
// Check that we got a good pad // Check that we got a good pad
if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good) if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good)
{ {
INFO_LOG(CONSOLE, "A bad pad was selected\n"); DEBUG_LOG(WIIMOTE, "A bad pad was selected");
WiiMoteEmu::PadState[Open].joy = NULL; WiiMoteEmu::PadState[Open].joy = NULL;
return; return;
} }
INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID); DEBUG_LOG(WIIMOTE, "Update the Slot %i handle to Id %i", Page, WiiMoteEmu::PadMapping[Open].ID);
WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID); WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID);
} }
void WiimotePadConfigDialog::PadClose(int _Close) // Close for slot 1, 2, 3 or 4 void WiimotePadConfigDialog::PadClose(int _Close) // Close for slot 1, 2, 3 or 4
@ -196,7 +196,7 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller)
} }
} }
#endif #endif
//INFO_LOG(CONSOLE, "m_bWmA[%i] = %i = %s\n", controller, WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0], InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0]).c_str()); //DEBUG_LOG(WIIMOTE, "m_bWmA[%i] = %i = %s", controller, WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0], InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[0]).c_str());
} }
/* Populate the PadMapping array with the dialog items settings (for example /* Populate the PadMapping array with the dialog items settings (for example
@ -242,7 +242,7 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId
m_AnalogTriggerL[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tl = value; m_AnalogTriggerL[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tl = value;
m_AnalogTriggerR[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tr = value; m_AnalogTriggerR[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tr = value;
//INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i\n", //DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i",
// controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection()); // controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection());
// Replace "-1" with "" // Replace "-1" with ""
@ -268,7 +268,7 @@ void WiimotePadConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key
{ {
WiiMoteEmu::PadMapping[Controller].GH3c.keyForControls[Id - IDB_GH3_GREEN] = Key; WiiMoteEmu::PadMapping[Controller].GH3c.keyForControls[Id - IDB_GH3_GREEN] = Key;
} }
//INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].Wm.A = %i", Controller, WiiMoteEmu::PadMapping[Controller].Wm.A); //DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].Wm.A = %i", Controller, WiiMoteEmu::PadMapping[Controller].Wm.A);
} }
// Replace the harder to understand -1 with "" for the sake of user friendliness // Replace the harder to understand -1 with "" for the sake of user friendliness
@ -324,13 +324,13 @@ void WiimotePadConfigDialog::SetButtonText(int id, char text[128], int _Page)
case IDB_TRIGGER_R: m_AnalogTriggerR[controller]->SetValue(wxString::FromAscii(text)); break; case IDB_TRIGGER_R: m_AnalogTriggerR[controller]->SetValue(wxString::FromAscii(text)); break;
default: break; default: break;
} }
//INFO_LOG(CONSOLE, "SetButtonText: %s\n", text); //DEBUG_LOG(WIIMOTE, "SetButtonText: %s", text);
} }
// Get the text in the textbox for the buttons // Get the text in the textbox for the buttons
wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page) wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page)
{ {
//INFO_LOG(CONSOLE, "GetButtonText: %i\n", id); //DEBUG_LOG(WIIMOTE, "GetButtonText: %i", id);
// Set controller value // Set controller value
int controller; int controller;
@ -408,7 +408,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
bool Succeed = false; bool Succeed = false;
bool Stop = false; // Stop the timer bool Stop = false; // Stop the timer
//INFO_LOG(CONSOLE, "Before (%i) Id:%i %i IsRunning:%i\n", //DEBUG_LOG(WIIMOTE, "Before (%i) Id:%i %i IsRunning:%i",
// GetButtonWaitingTimer, GetButtonWaitingID, _GetId, m_ButtonMappingTimer->IsRunning()); // GetButtonWaitingTimer, GetButtonWaitingID, _GetId, m_ButtonMappingTimer->IsRunning());
// If the Id has changed or the timer is not running we should start one // If the Id has changed or the timer is not running we should start one
@ -437,7 +437,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
#if wxUSE_TIMER #if wxUSE_TIMER
m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) ); m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) );
#endif #endif
INFO_LOG(CONSOLE, "Timer Started for Pad:%i _GetId:%i\n" DEBUG_LOG(WIIMOTE, "Timer Started for Pad:%i _GetId:%i"
"Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i\n", "Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i\n",
WiiMoteEmu::PadMapping[Controller].ID, _GetId, WiiMoteEmu::PadMapping[Controller].ID, _GetId,
Axis, LeftRight, XInput, Button, Hat); Axis, LeftRight, XInput, Button, Hat);
@ -470,7 +470,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
SetButtonText(_GetId, format); SetButtonText(_GetId, format);
/* Debug /* Debug
INFO_LOG(CONSOLE, "Keyboard: %i\n", g_Pressed);*/ DEBUG_LOG(WIIMOTE, "Keyboard: %i", g_Pressed);*/
} }
// Time's up // Time's up
@ -504,7 +504,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
disabled slots. */ disabled slots. */
SaveButtonMappingAll(Controller); SaveButtonMappingAll(Controller);
INFO_LOG(CONSOLE, "Timer Stopped for Pad:%i _GetId:%i\n", DEBUG_LOG(WIIMOTE, "Timer Stopped for Pad:%i _GetId:%i",
WiiMoteEmu::PadMapping[Controller].ID, _GetId); WiiMoteEmu::PadMapping[Controller].ID, _GetId);
} }
@ -523,7 +523,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId)
// Debugging // Debugging
/* /*
INFO_LOG(CONSOLE, "Change: %i %i %i %i '%s' '%s' '%s' '%s'\n", DEBUG_LOG(WIIMOTE, "Change: %i %i %i %i '%s' '%s' '%s' '%s'",
WiiMoteEmu::PadMapping[0].halfpress, WiiMoteEmu::PadMapping[1].halfpress, WiiMoteEmu::PadMapping[2].halfpress, WiiMoteEmu::PadMapping[3].halfpress, WiiMoteEmu::PadMapping[0].halfpress, WiiMoteEmu::PadMapping[1].halfpress, WiiMoteEmu::PadMapping[2].halfpress, WiiMoteEmu::PadMapping[3].halfpress,
m_JoyButtonHalfpress[0]->GetValue().c_str(), m_JoyButtonHalfpress[1]->GetValue().c_str(), m_JoyButtonHalfpress[2]->GetValue().c_str(), m_JoyButtonHalfpress[3]->GetValue().c_str() m_JoyButtonHalfpress[0]->GetValue().c_str(), m_JoyButtonHalfpress[1]->GetValue().c_str(), m_JoyButtonHalfpress[2]->GetValue().c_str(), m_JoyButtonHalfpress[3]->GetValue().c_str()
);*/ );*/
@ -545,7 +545,7 @@ void WiimotePadConfigDialog::Convert2Box(int &x)
// Update the input status boxes // Update the input status boxes
void WiimotePadConfigDialog::PadGetStatus() void WiimotePadConfigDialog::PadGetStatus()
{ {
//INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0)); //DEBUG_LOG(WIIMOTE, "SDL_WasInit: %i", SDL_WasInit(0));
/* Return if it's not detected. The ID should never be less than zero here, /* 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 it can only be that because of a manual ini file change, but we make

View File

@ -183,7 +183,7 @@ void WiimotePadConfigDialog::OnKeyDown(wxKeyEvent& event)
// Input button clicked // Input button clicked
void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event) void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event)
{ {
//INFO_LOG(CONSOLE, "OnButtonClick: %i\n", g_Pressed); //DEBUG_LOG(WIIMOTE, "OnButtonClick: %i", g_Pressed);
// Don't allow space to start a new Press Key option, that will interfer with setting a key to space // Don't allow space to start a new Press Key option, that will interfer with setting a key to space
if (g_Pressed == WXK_SPACE) { g_Pressed = 0; return; } if (g_Pressed == WXK_SPACE) { g_Pressed = 0; return; }
@ -252,7 +252,7 @@ void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot)
// Then change it back to "" // Then change it back to ""
ToBlank(); ToBlank();
INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].ID = %i\n", Page, m_Joyname[Page]->GetSelection()); DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].ID = %i", Page, m_Joyname[Page]->GetSelection());
} }
// Bitmap box and dot // Bitmap box and dot

View File

@ -29,7 +29,7 @@
void WiimoteRecordingConfigDialog::LoadFile() void WiimoteRecordingConfigDialog::LoadFile()
{ {
INFO_LOG(CONSOLE, "LoadFile()\n"); DEBUG_LOG(WIIMOTE, "LoadFile()");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
@ -72,7 +72,7 @@ void WiimoteRecordingConfigDialog::LoadFile()
void WiimoteRecordingConfigDialog::SaveFile() void WiimoteRecordingConfigDialog::SaveFile()
{ {
INFO_LOG(CONSOLE, "SaveFile\n"); DEBUG_LOG(WIIMOTE, "SaveFile");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
@ -108,7 +108,7 @@ void WiimoteRecordingConfigDialog::SaveFile()
} }
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
INFO_LOG(CONSOLE, "SaveFile()\n"); DEBUG_LOG(WIIMOTE, "SaveFile()");
} }
void WiimoteRecordingConfigDialog::CreateGUIControlsRecording() void WiimoteRecordingConfigDialog::CreateGUIControlsRecording()
@ -346,7 +346,7 @@ void WiimoteRecordingConfigDialog::ConvertToString()
TmpStr += StringFromFormat("%s", m_vRecording.at(i).z >= 0 ? StringFromFormat("+%03i", m_vRecording.at(i).z).c_str() : StringFromFormat("%04i", m_vRecording.at(i).z).c_str()); TmpStr += StringFromFormat("%s", m_vRecording.at(i).z >= 0 ? StringFromFormat("+%03i", m_vRecording.at(i).z).c_str() : StringFromFormat("%04i", m_vRecording.at(i).z).c_str());
if (i < ((int)m_vRecording.size() - 1)) TmpStr += ","; if (i < ((int)m_vRecording.size() - 1)) TmpStr += ",";
//INFO_LOG(CONSOLE, "%s\n", TmpStr.c_str()); //DEBUG_LOG(WIIMOTE, "%s", TmpStr.c_str());
// Write the IR data // Write the IR data
TmpIR += ArrayToString(m_vRecording.at(i).IR, IRBytes, 0, 30, false); TmpIR += ArrayToString(m_vRecording.at(i).IR, IRBytes, 0, 30, false);
@ -368,7 +368,7 @@ void WiimoteRecordingConfigDialog::ConvertToString()
} }
// Debug // Debug
INFO_LOG(CONSOLE, "Saved: [%i / %i] %03i %03i %03i\n", i, m_vRecording.size(), m_vRecording.at(i).x, m_vRecording.at(i).y, m_vRecording.at(i).z); DEBUG_LOG(WIIMOTE, "Saved: [%i / %i] %03i %03i %03i", i, m_vRecording.size(), m_vRecording.at(i).x, m_vRecording.at(i).y, m_vRecording.at(i).z);
} }
// Recordings per second // Recordings per second
@ -401,7 +401,7 @@ void WiimoteRecordingConfigDialog::ConvertToString()
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
INFO_LOG(CONSOLE, "Save recording to WiimoteMovement.ini\n"); DEBUG_LOG(WIIMOTE, "Save recording to WiimoteMovement.ini");
} }
// Timeout the recording // Timeout the recording
@ -471,7 +471,7 @@ void WiimoteRecordingConfigDialog::DoRecordA(bool Pressed)
else else
{ {
m_RecordButton[m_iRecordTo]->SetLabel(wxT("Done")); m_RecordButton[m_iRecordTo]->SetLabel(wxT("Done"));
INFO_LOG(CONSOLE, "Done: %i %i\n", m_bWaitForRecording, m_bRecording); DEBUG_LOG(WIIMOTE, "Done: %i %i", m_bWaitForRecording, m_bRecording);
//m_bAllowA = true; //m_bAllowA = true;
ConvertToString(); ConvertToString();
} }
@ -482,11 +482,11 @@ void WiimoteRecordingConfigDialog::DoRecordA(bool Pressed)
void WiimoteRecordingConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes) void WiimoteRecordingConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes)
{ {
//std::string Tmp1 = ArrayToString(_IR, 20, 0, 30); //std::string Tmp1 = ArrayToString(_IR, 20, 0, 30);
//INFO_LOG(CONSOLE, "DoRecordMovement: %s\n", Tmp1.c_str()); //DEBUG_LOG(WIIMOTE, "DoRecordMovement: %s", Tmp1.c_str());
if (!m_bRecording) return; if (!m_bRecording) return;
//INFO_LOG(CONSOLE, "DoRecordMovement: %03i %03i %03i\n", _x, _y, _z); //DEBUG_LOG(WIIMOTE, "DoRecordMovement: %03i %03i %03i", _x, _y, _z);
SRecording Tmp; SRecording Tmp;
Tmp.x = _x; Tmp.x = _x;

View File

@ -125,7 +125,7 @@ void WiimoteRecordingConfigDialog::RecordingChanged(wxCommandEvent& event)
if (m_RecordHotKeyNunchuck[i]->GetSelection() == m_RecordHotKeyNunchuck[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyNunchuck[i]->SetSelection(10); if (m_RecordHotKeyNunchuck[i]->GetSelection() == m_RecordHotKeyNunchuck[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyNunchuck[i]->SetSelection(10);
if (m_RecordHotKeyIR[i]->GetSelection() == m_RecordHotKeyIR[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyIR[i]->SetSelection(10); if (m_RecordHotKeyIR[i]->GetSelection() == m_RecordHotKeyIR[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyIR[i]->SetSelection(10);
//INFO_LOG(CONSOLE, "HotKey: %i %i\n", //DEBUG_LOG(WIIMOTE, "HotKey: %i %i",
// m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection()); // m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection());
} }
break; break;

View File

@ -71,16 +71,16 @@ namespace WiiMoteEmu
void WmDataReporting(u16 _channelID, wm_data_reporting* dr) void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
{ {
DEBUG_LOG(WII_IPC_WIIMOTE, " Set Data reporting mode"); DEBUG_LOG(WIIMOTE, " Set Data reporting mode");
DEBUG_LOG(WII_IPC_WIIMOTE, " Rumble: %x", dr->rumble); DEBUG_LOG(WIIMOTE, " Rumble: %x", dr->rumble);
DEBUG_LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous); DEBUG_LOG(WIIMOTE, " Continuous: %x", dr->continuous);
DEBUG_LOG(WII_IPC_WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time); DEBUG_LOG(WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time);
DEBUG_LOG(WII_IPC_WIIMOTE, " Mode: 0x%02x", dr->mode); DEBUG_LOG(WIIMOTE, " Mode: 0x%02x", dr->mode);
INFO_LOG(CONSOLE, "Data reporting:\n"); DEBUG_LOG(WIIMOTE, "Data reporting:");
INFO_LOG(CONSOLE, " Continuous: %x\n", dr->continuous); DEBUG_LOG(WIIMOTE, " Continuous: %x", dr->continuous);
INFO_LOG(CONSOLE, " All The Time: %x (not only on data change)\n", dr->all_the_time); DEBUG_LOG(WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time);
INFO_LOG(CONSOLE, " Mode: 0x%02x\n", dr->mode); DEBUG_LOG(WIIMOTE, " Mode: 0x%02x", dr->mode);
INFO_LOG(CONSOLE, " Channel: 0x%04x\n", _channelID); DEBUG_LOG(WIIMOTE, " Channel: 0x%04x", _channelID);
g_ReportingMode = dr->mode; g_ReportingMode = dr->mode;
g_ReportingChannel = _channelID; g_ReportingChannel = _channelID;
@ -115,7 +115,7 @@ void SendReportCore(u16 _channelID)
FillReportInfo(pReport->c); FillReportInfo(pReport->c);
#endif #endif
INFO_LOG(WII_IPC_WIIMOTE, " SendReportCore()"); INFO_LOG(WIIMOTE, " SendReportCore()");
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@ -139,9 +139,9 @@ void SendReportCoreAccel(u16 _channelID)
FillReportAcc(pReport->a); FillReportAcc(pReport->a);
#endif #endif
INFO_LOG(WII_IPC_WIIMOTE, " SendReportCoreAccel (0x31)"); INFO_LOG(WIIMOTE, " SendReportCoreAccel (0x31)");
INFO_LOG(WII_IPC_WIIMOTE, " Channel: %04x", _channelID); INFO_LOG(WIIMOTE, " Channel: %04x", _channelID);
INFO_LOG(WII_IPC_WIIMOTE, " Offset: %08x", Offset); INFO_LOG(WIIMOTE, " Offset: %08x", Offset);
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@ -169,8 +169,8 @@ void SendReportCoreAccelIr12(u16 _channelID) {
memset(&pReport->ir[2], 0xff, sizeof(wm_ir_extended)); memset(&pReport->ir[2], 0xff, sizeof(wm_ir_extended));
memset(&pReport->ir[3], 0xff, sizeof(wm_ir_extended)); memset(&pReport->ir[3], 0xff, sizeof(wm_ir_extended));
INFO_LOG(WII_IPC_WIIMOTE, " SendReportCoreAccelIr12()"); INFO_LOG(WIIMOTE, " SendReportCoreAccelIr12()");
INFO_LOG(WII_IPC_WIIMOTE, " Offset: %08x", Offset); INFO_LOG(WIIMOTE, " Offset: %08x", Offset);
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@ -213,9 +213,9 @@ void SendReportCoreAccelExt16(u16 _channelID)
memcpy(&pReport->ext, &_ext, sizeof(_ext)); memcpy(&pReport->ext, &_ext, sizeof(_ext));
} }
INFO_LOG(WII_IPC_WIIMOTE, " SendReportCoreAccelExt16 (0x35)"); INFO_LOG(WIIMOTE, " SendReportCoreAccelExt16 (0x35)");
INFO_LOG(WII_IPC_WIIMOTE, " Channel: %04x", _channelID); INFO_LOG(WIIMOTE, " Channel: %04x", _channelID);
INFO_LOG(WII_IPC_WIIMOTE, " Offset: %08x", Offset); INFO_LOG(WIIMOTE, " Offset: %08x", Offset);
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@ -267,7 +267,7 @@ void SendReportCoreAccelIr10Ext(u16 _channelID)
memcpy(&pReport->ext, &_GH3_ext, sizeof(_GH3_ext)); memcpy(&pReport->ext, &_GH3_ext, sizeof(_GH3_ext));
} }
INFO_LOG(WII_IPC_WIIMOTE, " SendReportCoreAccelIr10Ext()"); INFO_LOG(WIIMOTE, " SendReportCoreAccelIr10Ext()");
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);

View File

@ -43,6 +43,7 @@ u8 g_IR;
u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
//u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE];
u8 g_RegExt[WIIMOTE_REG_EXT_SIZE]; u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE]; u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
u8 g_RegIr[WIIMOTE_REG_IR_SIZE]; u8 g_RegIr[WIIMOTE_REG_IR_SIZE];

View File

@ -75,6 +75,7 @@ extern u8 g_IR;
extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
//extern u8 g_RegMotionPlus[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE]; extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE]; extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE]; extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE];

View File

@ -59,7 +59,7 @@ void TiltTest(u8 x, u8 y, u8 z)
std::string To = StringFromFormat("%s\nTo: X:%i Y:%i Z:%i Roll:%s Pitch:%s", From.c_str(), x, y, z, std::string To = StringFromFormat("%s\nTo: X:%i Y:%i Z:%i Roll:%s Pitch:%s", From.c_str(), x, y, z,
(_Roll >= 0) ? StringFromFormat(" %03i", (int)_Roll).c_str() : StringFromFormat("%04i", (int)_Roll).c_str(), (_Roll >= 0) ? StringFromFormat(" %03i", (int)_Roll).c_str() : StringFromFormat("%04i", (int)_Roll).c_str(),
(_Pitch >= 0) ? StringFromFormat(" %03i", (int)_Pitch).c_str() : StringFromFormat("%04i", (int)_Pitch).c_str()); (_Pitch >= 0) ? StringFromFormat(" %03i", (int)_Pitch).c_str() : StringFromFormat("%04i", (int)_Pitch).c_str());
INFO_LOG(CONSOLE, "%s\n", To.c_str()); DEBUG_LOG(WIIMOTE, "%s", To.c_str());
} }

View File

@ -102,8 +102,8 @@ void GetMousePos(float& x, float& y)
YOffset = YOffset - PictureHeight / 2.0f; YOffset = YOffset - PictureHeight / 2.0f;
} }
/* /*
INFO_LOG(WII_IPC_WIIMOTE, "Screen Width:%4.0f Height:%4.0f Ratio:%1.2f\n", WinWidth, WinHeight, Ratio); INFO_LOG(WIIMOTE, "Screen Width:%4.0f Height:%4.0f Ratio:%1.2f", WinWidth, WinHeight, Ratio);
INFO_LOG(WII_IPC_WIIMOTE, "Picture Width:%4.1f Height:%4.1f YOffset:%4.0f XOffset:%4.0f\n", PictureWidth, PictureHeight, YOffset, XOffset); INFO_LOG(WIIMOTE, "Picture Width:%4.1f Height:%4.1f YOffset:%4.0f XOffset:%4.0f", PictureWidth, PictureHeight, YOffset, XOffset);
*/ */
} }
@ -126,8 +126,8 @@ void GetMousePos(float& x, float& y)
YOffset = float(YOffset - (IncreasedHeight / 2.0)); YOffset = float(YOffset - (IncreasedHeight / 2.0));
/* /*
INFO_LOG(WII_IPC_WIIMOTE, "Crop Ratio:%1.2f IncrWidth:%3.0f IncrHeight:%3.0f\n", Ratio, IncreasedWidth, IncreasedHeight); INFO_LOG(WIIMOTE, "Crop Ratio:%1.2f IncrWidth:%3.0f IncrHeight:%3.0f", Ratio, IncreasedWidth, IncreasedHeight);
INFO_LOG(WII_IPC_WIIMOTE, "Picture Width:%4.1f Height:%4.1f YOffset:%4.0f XOffset:%4.0f\n", PictureWidth, PictureHeight, YOffset, XOffset); INFO_LOG(WIIMOTE, "Picture Width:%4.1f Height:%4.1f YOffset:%4.0f XOffset:%4.0f", PictureWidth, PictureHeight, YOffset, XOffset);
*/ */
} }
@ -136,9 +136,9 @@ void GetMousePos(float& x, float& y)
y = ((float)point.y - YOffset) / PictureHeight; y = ((float)point.y - YOffset) / PictureHeight;
/* /*
INFO_LOG(WII_IPC_WIIMOTE, "GetCursorPos: %i %i\n", point.x, point.y); INFO_LOG(WIIMOTE, "GetCursorPos: %i %i", point.x, point.y);
INFO_LOG(WII_IPC_WIIMOTE, "GetClientRect: %i %i %i %i\n", Rect.left, Rect.right, Rect.top, Rect.bottom); INFO_LOG(WIIMOTE, "GetClientRect: %i %i %i %i", Rect.left, Rect.right, Rect.top, Rect.bottom);
INFO_LOG(WII_IPC_WIIMOTE, "Position X:%1.2f Y:%1.2f\n", x, y); INFO_LOG(WIIMOTE, "Position X:%1.2f Y:%1.2f", x, y);
*/ */
#else #else
@ -176,21 +176,21 @@ void GetCalibrationChecksum()
for (u32 i = 0; i < sizeof(nunchuck_calibration) - 2; i++) for (u32 i = 0; i < sizeof(nunchuck_calibration) - 2; i++)
sum += nunchuck_calibration[i]; sum += nunchuck_calibration[i];
INFO_LOG(WII_IPC_WIIMOTE, "0x%02x 0x%02x", (sum + 0x55), (sum + 0xaa)); INFO_LOG(WIIMOTE, "0x%02x 0x%02x", (sum + 0x55), (sum + 0xaa));
} }
/* Load pre-recorded movements */ /* Load pre-recorded movements */
void LoadRecordedMovements() void LoadRecordedMovements()
{ {
INFO_LOG(WII_IPC_WIIMOTE, "LoadRecordedMovements()\n"); INFO_LOG(WIIMOTE, "LoadRecordedMovements()");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
for(int i = 0; i < RECORDING_ROWS; i++) for(int i = 0; i < RECORDING_ROWS; i++)
{ {
//INFO_LOG(WII_IPC_WIIMOTE, "Recording%i ", i + 1); //INFO_LOG(WIIMOTE, "Recording%i ", i + 1);
// Temporary storage // Temporary storage
int iTmp; int iTmp;
@ -258,10 +258,10 @@ void LoadRecordedMovements()
VRecording.at(i).Recording.push_back(Tmp); VRecording.at(i).Recording.push_back(Tmp);
// Log results // Log results
/*INFO_LOG(WII_IPC_WIIMOTE, "Time:%f\n", Tmp.Time); /*INFO_LOG(WIIMOTE, "Time:%f", Tmp.Time);
std::string TmpIRLog = ArrayToString(Tmp.IR, TmpIRBytes, 0, 30); std::string TmpIRLog = ArrayToString(Tmp.IR, TmpIRBytes, 0, 30);
INFO_LOG(WII_IPC_WIIMOTE, "IR: %s\n", TmpIRLog.c_str()); INFO_LOG(WIIMOTE, "IR: %s", TmpIRLog.c_str());
INFO_LOG(WII_IPC_WIIMOTE, "\n");*/ INFO_LOG(WIIMOTE, "");*/
} }
// Get HotKey // Get HotKey
@ -281,7 +281,7 @@ void LoadRecordedMovements()
else else
TmpIRLog = ""; TmpIRLog = "";
INFO_LOG(WII_IPC_WIIMOTE, "Size:%i HotKey:%i PlSpeed:%i IR:%s X:%i Y:%i Z:%i\n", INFO_LOG(WIIMOTE, "Size:%i HotKey:%i PlSpeed:%i IR:%s X:%i Y:%i Z:%i",
VRecording.at(i).Recording.size(), VRecording.at(i).HotKeyWiimote, VRecording.at(i).PlaybackSpeed, VRecording.at(i).Recording.size(), VRecording.at(i).HotKeyWiimote, VRecording.at(i).PlaybackSpeed,
TmpIRLog.c_str(), TmpIRLog.c_str(),
VRecording.at(i).Recording.at(0).x, VRecording.at(i).Recording.at(0).y, VRecording.at(i).Recording.at(0).z VRecording.at(i).Recording.at(0).x, VRecording.at(i).Recording.at(0).y, VRecording.at(i).Recording.at(0).z
@ -299,7 +299,7 @@ void UpdateEeprom()
g_wm.cal_g.y = g_Eeprom[27] - g_Eeprom[24]; g_wm.cal_g.y = g_Eeprom[27] - g_Eeprom[24];
g_wm.cal_g.z = g_Eeprom[28] - g_Eeprom[24]; g_wm.cal_g.z = g_Eeprom[28] - g_Eeprom[24];
INFO_LOG(WII_IPC_WIIMOTE, "\nUpdateEeprom: %i %i %i\n", INFO_LOG(WIIMOTE, "UpdateEeprom: %i %i %i",
WiiMoteEmu::g_Eeprom[22], WiiMoteEmu::g_Eeprom[23], WiiMoteEmu::g_Eeprom[28]); WiiMoteEmu::g_Eeprom[22], WiiMoteEmu::g_Eeprom[23], WiiMoteEmu::g_Eeprom[28]);
if(g_Config.iExtensionConnected == EXT_NUNCHUCK) if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
@ -317,7 +317,7 @@ void UpdateEeprom()
g_nu.jy.min = g_RegExt[0x2c]; g_nu.jy.min = g_RegExt[0x2c];
g_nu.jy.center = g_RegExt[0x2d]; g_nu.jy.center = g_RegExt[0x2d];
INFO_LOG(WII_IPC_WIIMOTE, "UpdateNunchuck: %i %i %i %i %i\n\n", INFO_LOG(WIIMOTE, "UpdateNunchuck: %i %i %i %i %i",
WiiMoteEmu::g_RegExt[0x2a], WiiMoteEmu::g_RegExt[0x2d], WiiMoteEmu::g_RegExt[0x2a], WiiMoteEmu::g_RegExt[0x2d],
WiiMoteEmu::g_RegExt[0x20], WiiMoteEmu::g_RegExt[0x21], WiiMoteEmu::g_RegExt[0x26]); WiiMoteEmu::g_RegExt[0x20], WiiMoteEmu::g_RegExt[0x21], WiiMoteEmu::g_RegExt[0x26]);
} }
@ -340,11 +340,11 @@ void UpdateEeprom()
g_ClassicContCalibration.Tl.neutral = g_RegExt[0x2c]; g_ClassicContCalibration.Tl.neutral = g_RegExt[0x2c];
g_ClassicContCalibration.Tr.neutral = g_RegExt[0x2d]; g_ClassicContCalibration.Tr.neutral = g_RegExt[0x2d];
INFO_LOG(WII_IPC_WIIMOTE, "UpdateCC: %i %i %i %i %i\n\n", INFO_LOG(WIIMOTE, "UpdateCC: %i %i %i %i %i",
WiiMoteEmu::g_RegExt[0x2a], WiiMoteEmu::g_RegExt[0x2d], WiiMoteEmu::g_RegExt[0x2a], WiiMoteEmu::g_RegExt[0x2d],
WiiMoteEmu::g_RegExt[0x20], WiiMoteEmu::g_RegExt[0x21], WiiMoteEmu::g_RegExt[0x26]); WiiMoteEmu::g_RegExt[0x20], WiiMoteEmu::g_RegExt[0x21], WiiMoteEmu::g_RegExt[0x26]);
} }
else if(g_Config.iExtensionConnected == EXT_GUITARHERO3_CONTROLLER) else if(g_Config.iExtensionConnected == EXT_GUITARHERO3_CONTROLLER)
{ {
// TODO get the correct values here // TODO get the correct values here
g_GH3Calibration.Lx.max = g_RegExt[0x20]; g_GH3Calibration.Lx.max = g_RegExt[0x20];
@ -364,7 +364,7 @@ void ExtensionChecksum(u8 * Calibration)
for (u32 i = 0; i < sizeof(Calibration) - 2; i++) for (u32 i = 0; i < sizeof(Calibration) - 2; i++)
{ {
sum += Calibration[i]; sum += Calibration[i];
printf("Plus 0x%02x\n", Calibration[i]); //INFO_LOG(WIIMOTE, "Plus 0x%02x", Calibration[i]);
} }
// Byte15 = sum + 0x55; // Byte 15 // Byte15 = sum + 0x55; // Byte 15
// Byte16 = sum + 0xaa; // Byte 16 // Byte16 = sum + 0xaa; // Byte 16
@ -392,7 +392,7 @@ void ResetVariables()
} }
// Update the extension calibration values with our default values // Update the extension calibration values with our default values
void SetDefaultExtensionRegistry() void UpdateExtRegisterBlocks()
{ {
// Copy extension id and calibration to its register // Copy extension id and calibration to its register
if(g_Config.iExtensionConnected == EXT_NUNCHUCK) if(g_Config.iExtensionConnected == EXT_NUNCHUCK)
@ -415,7 +415,7 @@ void SetDefaultExtensionRegistry()
memcpy(g_RegExt + 0xfa, gh3glp_id, sizeof(gh3glp_id)); memcpy(g_RegExt + 0xfa, gh3glp_id, sizeof(gh3glp_id));
} }
INFO_LOG(WII_IPC_WIIMOTE, "\nSetDefaultExtensionRegistry()\n\n"); INFO_LOG(WIIMOTE, "UpdateExtRegisterBlocks()");
UpdateEeprom(); UpdateEeprom();
} }
@ -444,7 +444,7 @@ void Initialize()
} }
// Copy extension id and calibration to its register, g_Config.Load() is needed before this // Copy extension id and calibration to its register, g_Config.Load() is needed before this
SetDefaultExtensionRegistry(); UpdateExtRegisterBlocks();
// The emulated Wiimote is initialized // The emulated Wiimote is initialized
g_EmulatedWiiMoteInitialized = true; g_EmulatedWiiMoteInitialized = true;
@ -500,7 +500,7 @@ void DoState(PointerWrap &p)
not called we need to reset these variables. */ not called we need to reset these variables. */
void Shutdown(void) void Shutdown(void)
{ {
INFO_LOG(WII_IPC_WIIMOTE, "ShutDown\n"); INFO_LOG(WIIMOTE, "ShutDown");
ResetVariables(); ResetVariables();
@ -511,7 +511,7 @@ void Shutdown(void)
if (PadMapping[i].enabled && joyinfo.size() > (u32)PadMapping[i].ID) if (PadMapping[i].enabled && joyinfo.size() > (u32)PadMapping[i].ID)
if (joyinfo.at(PadMapping[i].ID).Good) if (joyinfo.at(PadMapping[i].ID).Good)
{ {
INFO_LOG(WII_IPC_WIIMOTE, "ShutDown: %i\n", PadState[i].joy); INFO_LOG(WIIMOTE, "ShutDown: %i", PadState[i].joy);
/* SDL_JoystickClose() crashes for some reason so I avoid this /* SDL_JoystickClose() crashes for some reason so I avoid this
for now, SDL_Quit() should close the pads to I think */ for now, SDL_Quit() should close the pads to I think */
//if(SDL_JoystickOpened(PadMapping[i].ID)) SDL_JoystickClose(PadState[i].joy); //if(SDL_JoystickOpened(PadMapping[i].ID)) SDL_JoystickClose(PadState[i].joy);
@ -563,7 +563,7 @@ void CheckAckDelay()
} }
AckDelay.at(i).Delay--; AckDelay.at(i).Delay--;
//INFO_LOG(WII_IPC_WIIMOTE, "%i 0x%04x 0x%02x", i, AckDelay.at(i).ChannelID, AckDelay.at(i).ReportID); //INFO_LOG(WIIMOTE, "%i 0x%04x 0x%02x", i, AckDelay.at(i).ChannelID, AckDelay.at(i).ReportID);
} }
} }
} }
@ -573,9 +573,9 @@ void CheckAckDelay()
response to Output from the Wii. */ response to Output from the Wii. */
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
//INFO_LOG(WII_IPC_WIIMOTE, "Emu InterruptChannel\n"); //INFO_LOG(WIIMOTE, "Emu InterruptChannel");
DEBUG_LOG(WII_IPC_WIIMOTE, "Wiimote_Input"); DEBUG_LOG(WIIMOTE, "Wiimote_Input");
const u8* data = (const u8*)_pData; const u8* data = (const u8*)_pData;
/* Debugging. We have not yet decided how much of 'data' we will use, it's /* Debugging. We have not yet decided how much of 'data' we will use, it's
@ -636,14 +636,14 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
//INFO_LOG(WII_IPC_WIIMOTE, "Emu ControlChannel\n"); //INFO_LOG(WIIMOTE, "Emu ControlChannel");
const u8* data = (const u8*)_pData; const u8* data = (const u8*)_pData;
// Dump raw data // Dump raw data
{ {
INFO_LOG(WII_IPC_WIIMOTE, "Wiimote_ControlChannel"); INFO_LOG(WIIMOTE, "Wiimote_ControlChannel");
std::string Temp = ArrayToString(data, 0, _Size); std::string Temp = ArrayToString(data, 0, _Size);
DEBUG_LOG(WII_IPC_WIIMOTE, " Data: %s", Temp.c_str()); DEBUG_LOG(WIIMOTE, " Data: %s", Temp.c_str());
} }
hid_packet* hidp = (hid_packet*) data; hid_packet* hidp = (hid_packet*) data;
@ -694,8 +694,8 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
void Update() void Update()
{ {
readKeyboard(); readKeyboard();
//LOG(WII_IPC_WIIMOTE, "Wiimote_Update"); //LOG(WIIMOTE, "Wiimote_Update");
//INFO_LOG(WII_IPC_WIIMOTE, "Emu Update: %i\n", g_ReportingMode); //INFO_LOG(WIIMOTE, "Emu Update: %i", g_ReportingMode);
// Check if the pad state should be updated // Check if the pad state should be updated
if ((g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2 if ((g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2

View File

@ -49,7 +49,7 @@ void LoadRecordedMovements();
// Registers and calibration values // Registers and calibration values
void ResetVariables(); void ResetVariables();
void UpdateEeprom(); void UpdateEeprom();
void SetDefaultExtensionRegistry(); void UpdateExtRegisterBlocks();
// Gamepad // Gamepad
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads); bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);

View File

@ -66,7 +66,7 @@ namespace WiiMoteEmu
0x6 = Enable 0x6 = Enable
*/ */
void HidOutputReport(u16 _channelID, wm_report* sr) { void HidOutputReport(u16 _channelID, wm_report* sr) {
INFO_LOG(WII_IPC_WIIMOTE, "HidOutputReport (0x%02x)", sr->channel); INFO_LOG(WIIMOTE, "HidOutputReport (0x%02x)", sr->channel);
std::string Temp; std::string Temp;
switch(sr->channel) switch(sr->channel)
@ -83,7 +83,7 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
case WM_REQUEST_STATUS: // 0x15 case WM_REQUEST_STATUS: // 0x15
if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent) WmRequestStatus(_channelID, (wm_request_status*)sr->data); if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent) WmRequestStatus(_channelID, (wm_request_status*)sr->data);
//Temp = ArrayToString(sr->data, sizeof(wm_request_status), 0); //Temp = ArrayToString(sr->data, sizeof(wm_request_status), 0);
//INFO_LOG(CONSOLE, "\n%s: InterruptChannel: %s\n", Tm().c_str(), Temp.c_str()); //DEBUG_LOG(WIIMOTE, "%s: InterruptChannel: %s", Tm().c_str(), Temp.c_str());
break; break;
case WM_READ_DATA: // 0x17 case WM_READ_DATA: // 0x17
if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent) WmReadData(_channelID, (wm_read_data*)sr->data); if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent) WmReadData(_channelID, (wm_read_data*)sr->data);
@ -93,8 +93,8 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
g_IR so that WmRequestStatus() knows about it */ g_IR so that WmRequestStatus() knows about it */
case WM_IR_PIXEL_CLOCK: // 0x13 case WM_IR_PIXEL_CLOCK: // 0x13
case WM_IR_LOGIC: // 0x1a case WM_IR_LOGIC: // 0x1a
WARN_LOG(WII_IPC_WIIMOTE, " IR Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]); WARN_LOG(WIIMOTE, " IR Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
INFO_LOG(CONSOLE, "IR Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]); DEBUG_LOG(WIIMOTE, "IR Enable/Disable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
if(sr->data[0] == 0x02) g_IR = 0; if(sr->data[0] == 0x02) g_IR = 0;
else if(sr->data[0] == 0x06) g_IR = 1; else if(sr->data[0] == 0x06) g_IR = 1;
break; break;
@ -104,14 +104,14 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
break; break;
case WM_SPEAKER_ENABLE: // 0x14 case WM_SPEAKER_ENABLE: // 0x14
INFO_LOG(WII_IPC_WIIMOTE, " WM Speaker Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]); INFO_LOG(WIIMOTE, " WM Speaker Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
//INFO_LOG(CONSOLE, "Speaker Enable/Disable 0x%02x: 0x%02x\n", sr->channel, sr->data[0]); //DEBUG_LOG(WIIMOTE, "Speaker Enable/Disable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
if(sr->data[0] == 0x02) g_Speaker = 0; if(sr->data[0] == 0x02) g_Speaker = 0;
else if(sr->data[0] == 0x06) g_Speaker = 1; else if(sr->data[0] == 0x06) g_Speaker = 1;
break; break;
case WM_SPEAKER_MUTE: // 0x19 case WM_SPEAKER_MUTE: // 0x19
INFO_LOG(WII_IPC_WIIMOTE, " WM Mute Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]); INFO_LOG(WIIMOTE, " WM Mute Enable 0x%02x: 0x%02x", sr->channel, sr->data[0]);
//INFO_LOG(CONSOLE, "Speaker Mute/Unmute 0x%02x: 0x%02x\n", sr->channel, sr->data[0]); //DEBUG_LOG(WIIMOTE, "Speaker Mute/Unmute 0x%02x: 0x%02x", sr->channel, sr->data[0]);
if(sr->data[0] == 0x02) g_SpeakerVoice = 0; // g_SpeakerVoice if(sr->data[0] == 0x02) g_SpeakerVoice = 0; // g_SpeakerVoice
else if(sr->data[0] == 0x06) g_SpeakerVoice = 1; else if(sr->data[0] == 0x06) g_SpeakerVoice = 1;
break; break;
@ -147,7 +147,7 @@ int WriteWmReport(u8* dst, u8 channel)
/* LED (blue lights) report. */ /* LED (blue lights) report. */
void WmLeds(u16 _channelID, wm_leds* leds) { void WmLeds(u16 _channelID, wm_leds* leds) {
INFO_LOG(WII_IPC_WIIMOTE, " Set LEDs Leds: %x Rumble: %x", leds->leds, leds->rumble); INFO_LOG(WIIMOTE, " Set LEDs Leds: %x Rumble: %x", leds->leds, leds->rumble);
g_Leds = leds->leds; g_Leds = leds->leds;
} }
@ -176,17 +176,17 @@ void WmSendAck(u16 _channelID, u8 _reportID, u32 address)
pData->errorID = 0; pData->errorID = 0;
Offset += sizeof(wm_acknowledge); Offset += sizeof(wm_acknowledge);
INFO_LOG(WII_IPC_WIIMOTE, " WMSendAck()"); INFO_LOG(WIIMOTE, " WMSendAck()");
INFO_LOG(WII_IPC_WIIMOTE, " Report ID: %02x", _reportID); INFO_LOG(WIIMOTE, " Report ID: %02x", _reportID);
//std::string Temp = ArrayToString(DataFrame, Offset, 0); //std::string Temp = ArrayToString(DataFrame, Offset, 0);
//LOGV(WII_IPC_WIIMOTE, 2, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 2, " Data: %s", Temp.c_str());
//INFO_LOG(CONSOLE, "%s: WMSendAck: %s\n", Tm(true).c_str(), Temp.c_str()); //DEBUG_LOG(WIIMOTE, "%s: WMSendAck: %s", Tm(true).c_str(), Temp.c_str());
/* Debug. Write the report for extension registry writes. /* Debug. Write the report for extension registry writes.
if((_reportID == 0x16 || _reportID == 0x17) && ((address >> 16) & 0xfe) == 0xa4) if((_reportID == 0x16 || _reportID == 0x17) && ((address >> 16) & 0xfe) == 0xa4)
{ {
INFO_LOG(CONSOLE, "\nWMSendAck Report ID: %02x Encryption: %02x\n", _reportID, g_RegExt[0xf0]); DEBUG_LOG(WIIMOTE, "WMSendAck Report ID: %02x Encryption: %02x", _reportID, g_RegExt[0xf0]);
INFO_LOG(CONSOLE, "Data: %s\n", Temp.c_str()); DEBUG_LOG(WIIMOTE, "Data: %s", Temp.c_str());
}*/ }*/
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@ -202,10 +202,10 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
u32 address = convert24bit(rd->address); u32 address = convert24bit(rd->address);
u16 size = convert16bit(rd->size); u16 size = convert16bit(rd->size);
std::string Temp; std::string Temp;
INFO_LOG(WII_IPC_WIIMOTE, "Read data Address space: %x", rd->space); INFO_LOG(WIIMOTE, "Read data Address space: %x", rd->space);
INFO_LOG(WII_IPC_WIIMOTE, "Read data Address: 0x%06x", address); INFO_LOG(WIIMOTE, "Read data Address: 0x%06x", address);
INFO_LOG(WII_IPC_WIIMOTE, "Read data Size: 0x%04x", size); INFO_LOG(WIIMOTE, "Read data Size: 0x%04x", size);
INFO_LOG(WII_IPC_WIIMOTE, "Read data Rumble: %x", rd->rumble); INFO_LOG(WIIMOTE, "Read data Rumble: %x", rd->rumble);
//u32 _address = address; //u32 _address = address;
std::string Tmp; // Debugging std::string Tmp; // Debugging
@ -220,7 +220,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
return; return;
} }
SendReadDataReply(_channelID, g_Eeprom + address, address, (u8)size); SendReadDataReply(_channelID, g_Eeprom + address, address, (u8)size);
/*INFO_LOG(CONSOLE, "Read RegEeprom: Size: %i, Address: %08x, Offset: %08x\n", /*DEBUG_LOG(WIIMOTE, "Read RegEeprom: Size: %i, Address: %08x, Offset: %08x",
size, address, (address & 0xffff));*/ size, address, (address & 0xffff));*/
} }
else if(rd->space == WM_SPACE_REGS1 || rd->space == WM_SPACE_REGS2) else if(rd->space == WM_SPACE_REGS1 || rd->space == WM_SPACE_REGS2)
@ -232,32 +232,47 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
case 0xA2: case 0xA2:
block = g_RegSpeaker; block = g_RegSpeaker;
blockSize = WIIMOTE_REG_SPEAKER_SIZE; blockSize = WIIMOTE_REG_SPEAKER_SIZE;
INFO_LOG(WII_IPC_WIIMOTE, " Case 0xa2: g_RegSpeaker"); INFO_LOG(WIIMOTE, " Case 0xa2: g_RegSpeaker");
/*Tmp = ArrayToString(g_RegSpeaker, size, (address & 0xffff)); /*Tmp = ArrayToString(g_RegSpeaker, size, (address & 0xffff));
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 0, " Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "Read RegSpkr: Size %i Address %08x Offset %08x\nData %s\n", DEBUG_LOG(WIIMOTE, "Read RegSpkr: Size %i Address %08x Offset %08x\nData %s",
size, address, (address & 0xffff), Tmp.c_str());*/ size, address, (address & 0xffff), Tmp.c_str());*/
break; break;
case 0xA4: case 0xA4:
block = g_RegExt; block = g_RegExt;
blockSize = WIIMOTE_REG_EXT_SIZE; blockSize = WIIMOTE_REG_EXT_SIZE;
INFO_LOG(WII_IPC_WIIMOTE, " Case 0xa4: Read ExtReg"); INFO_LOG(WIIMOTE, " Case 0xa4: Read ExtReg");
/*Tmp = ArrayToString(g_RegExt, size, (address & 0xffff), 40); /*Tmp = ArrayToString(g_RegExt, size, (address & 0xffff), 40);
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 0, " Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "Read RegExt: Size %i Address %08x Offset %08x\nData %s\n", DEBUG_LOG(WIIMOTE, "Read RegExt: Size %i Address %08x Offset %08x\nData %s",
size, address, (address & 0xffff), Tmp.c_str());*/ size, address, (address & 0xffff), Tmp.c_str());*/
break; break;
// case 0xA6:
// block = g_RegMotionPlus;
// block[0xFC] = 0xA6;
// block[0xFD] = 0x20;
// block[0xFE] = 0x00;
// block[0xFF] = 0x05;
// blockSize = WIIMOTE_REG_EXT_SIZE;
// INFO_LOG(WIIMOTE, " Case 0xa6: MotionPlusReg [%x]", address);
/*
Tmp = ArrayToString(block, size, (address & 0xffff));
//LOGV(WIIMOTE, 0, " Data: %s", Temp.c_str());
INFO_LOG(WIIMOTE, "Read MotionPlusReg: Size %i Address %08x Offset %08x\nData %s",
size, address, (address & 0xffff), Tmp.c_str());
*/
// break;
case 0xB0: case 0xB0:
block = g_RegIr; block = g_RegIr;
blockSize = WIIMOTE_REG_IR_SIZE; blockSize = WIIMOTE_REG_IR_SIZE;
INFO_LOG(WII_IPC_WIIMOTE, " Case: 0xb0 g_RegIr"); INFO_LOG(WIIMOTE, " Case: 0xb0 g_RegIr");
/*Tmp = ArrayToString(g_RegIr, size, (address & 0xffff)); /*Tmp = ArrayToString(g_RegIr, size, (address & 0xffff));
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 0, " Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "Read RegIR: Size %i Address %08x Offset %08x\nData %s\n", DEBUG_LOG(WIIMOTE, "Read RegIR: Size %i Address %08x Offset %08x\nData %s",
size, address, (address & 0xffff), Tmp.c_str());*/ size, address, (address & 0xffff), Tmp.c_str());*/
break; break;
default: default:
ERROR_LOG(WII_IPC_WIIMOTE, "WmWriteData: bad register block!"); ERROR_LOG(WIIMOTE, "WmReadData: bad register block!");
return; return;
} }
@ -266,12 +281,12 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
if(((address >> 16) & 0xfe) == 0xa4) if(((address >> 16) & 0xfe) == 0xa4)
{ {
/* Debugging /* Debugging
INFO_LOG(CONSOLE, "\n\nWmReadData Address: %08x Offset: %08x Size: %i byte\n", DEBUG_LOG(WIIMOTE, "WmReadData Address: %08x Offset: %08x Size: %i byte",
address, address & 0xffff, (u8)size); address, address & 0xffff, (u8)size);
// Debugging // Debugging
u32 offset = address & 0xffff; u32 offset = address & 0xffff;
std::string Temp = ArrayToString(g_RegExt, size, offset); std::string Temp = ArrayToString(g_RegExt, size, offset);
INFO_LOG(CONSOLE, "Unencrypted data:\n%s\n", Temp.c_str());*/ DEBUG_LOG(WIIMOTE, "Unencrypted data:\n%s", Temp.c_str());*/
// Check if encrypted reads is on // Check if encrypted reads is on
if(g_RegExt[0xf0] == 0xaa) if(g_RegExt[0xf0] == 0xaa)
@ -288,14 +303,14 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
/* Debugging: Show the encrypted data /* Debugging: Show the encrypted data
std::string Temp = ArrayToString(g_RegExtTmp, size, offset); std::string Temp = ArrayToString(g_RegExtTmp, size, offset);
INFO_LOG(CONSOLE, "Encrypted data:\n%s\n", Temp.c_str());*/ DEBUG_LOG(WIIMOTE, "Encrypted data:\n%s", Temp.c_str());*/
} }
} }
//------------- //-------------
address &= 0xFFFF; address &= 0xFFFF;
if(address + size > blockSize) { if(address + size > blockSize) {
PanicAlert("WmReadData: address + size out of bounds!"); PanicAlert("WmReadData: address + size out of bounds! [%d %d %d]", address, size, blockSize);
return; return;
} }
@ -304,7 +319,7 @@ void WmReadData(u16 _channelID, wm_read_data* rd)
} }
else else
{ {
PanicAlert("WmReadData: unimplemented parameters (size: %i, addr: 0x%x!", size, rd->space); PanicAlert("WmReadData: unimplemented parameters (size: %i, addr: 0x%x)!", size, rd->space);
} }
} }
@ -367,19 +382,19 @@ void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size)
} }
// Logging // Logging
INFO_LOG(WII_IPC_WIIMOTE, " SendReadDataReply()"); INFO_LOG(WIIMOTE, " SendReadDataReply()");
DEBUG_LOG(WII_IPC_WIIMOTE, " Buttons: 0x%04x", pReply->buttons); DEBUG_LOG(WIIMOTE, " Buttons: 0x%04x", pReply->buttons);
DEBUG_LOG(WII_IPC_WIIMOTE, " Error: 0x%x", pReply->error); DEBUG_LOG(WIIMOTE, " Error: 0x%x", pReply->error);
DEBUG_LOG(WII_IPC_WIIMOTE, " Size: 0x%x", pReply->size); DEBUG_LOG(WIIMOTE, " Size: 0x%x", pReply->size);
DEBUG_LOG(WII_IPC_WIIMOTE, " Address: 0x%04x", pReply->address); DEBUG_LOG(WIIMOTE, " Address: 0x%04x", pReply->address);
/*INFO_LOG(CONSOLE, " SendReadDataReply()\n"); /*DEBUG_LOG(WIIMOTE, " SendReadDataReply()");
INFO_LOG(CONSOLE, " Offset: 0x%x\n", Offset); DEBUG_LOG(WIIMOTE, " Offset: 0x%x", Offset);
INFO_LOG(CONSOLE, " dataOffset: 0x%x\n", dataOffset); DEBUG_LOG(WIIMOTE, " dataOffset: 0x%x", dataOffset);
INFO_LOG(CONSOLE, " copySize: 0x%x\n", copySize); DEBUG_LOG(WIIMOTE, " copySize: 0x%x", copySize);
INFO_LOG(CONSOLE, " Size: 0x%x\n", pReply->size); DEBUG_LOG(WIIMOTE, " Size: 0x%x", pReply->size);
INFO_LOG(CONSOLE, " Address: 0x%04x\n", Common::swap16(pReply->address));*/ DEBUG_LOG(WIIMOTE, " Address: 0x%04x", Common::swap16(pReply->address));*/
//std::string Temp = ArrayToString(data, 0x40); //std::string Temp = ArrayToString(data, 0x40);
//INFO_LOG(CONSOLE, "Data:\n%s\n", Temp.c_str()); //DEBUG_LOG(WIIMOTE, "Data:\n%s", Temp.c_str());
// Send a piece // Send a piece
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);
@ -400,24 +415,24 @@ void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size)
void WmWriteData(u16 _channelID, wm_write_data* wd) void WmWriteData(u16 _channelID, wm_write_data* wd)
{ {
u32 address = convert24bit(wd->address); u32 address = convert24bit(wd->address);
INFO_LOG(WII_IPC_WIIMOTE, "Write data"); INFO_LOG(WIIMOTE, "Write data");
DEBUG_LOG(WII_IPC_WIIMOTE, " Address space: %x", wd->space); DEBUG_LOG(WIIMOTE, " Address space: %x", wd->space);
DEBUG_LOG(WII_IPC_WIIMOTE, " Address: 0x%06x", address); DEBUG_LOG(WIIMOTE, " Address: 0x%06x", address);
DEBUG_LOG(WII_IPC_WIIMOTE, " Size: 0x%02x", wd->size); DEBUG_LOG(WIIMOTE, " Size: 0x%02x", wd->size);
DEBUG_LOG(WII_IPC_WIIMOTE, " Rumble: %x", wd->rumble); DEBUG_LOG(WIIMOTE, " Rumble: %x", wd->rumble);
//std::string Temp = ArrayToString(wd->data, wd->size); //std::string Temp = ArrayToString(wd->data, wd->size);
//LOGV(WII_IPC_WIIMOTE, 0, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 0, " Data: %s", Temp.c_str());
// Write to EEPROM // 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) {
ERROR_LOG(WII_IPC_WIIMOTE, "WmWriteData: address + size out of bounds!"); ERROR_LOG(WIIMOTE, "WmWriteData: address + size out of bounds!");
PanicAlert("WmWriteData: address + size out of bounds!"); PanicAlert("WmWriteData: address + size out of bounds!");
return; return;
} }
memcpy(g_Eeprom + address, wd->data, wd->size); memcpy(g_Eeprom + address, wd->data, wd->size);
/*INFO_LOG(CONSOLE, "Write RegEeprom: Size: %i, Address: %08x, Offset: %08x\n", /*DEBUG_LOG(WIIMOTE, "Write RegEeprom: Size: %i, Address: %08x, Offset: %08x",
wd->size, address, (address & 0xffff));*/ wd->size, address, (address & 0xffff));*/
} }
// Write to registers // Write to registers
@ -430,29 +445,37 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
case 0xA2: case 0xA2:
block = g_RegSpeaker; block = g_RegSpeaker;
blockSize = WIIMOTE_REG_SPEAKER_SIZE; blockSize = WIIMOTE_REG_SPEAKER_SIZE;
INFO_LOG(WII_IPC_WIIMOTE, " Case 0xa2: RegSpeaker"); INFO_LOG(WIIMOTE, " Case 0xa2: RegSpeaker");
/*INFO_LOG(CONSOLE, "Write RegSpeaker: Size: %i, Address: %08x, Offset: %08x\n", /*DEBUG_LOG(WIIMOTE, "Write RegSpeaker: Size: %i, Address: %08x, Offset: %08x",
wd->size, address, (address & 0xffff)); wd->size, address, (address & 0xffff));
INFO_LOG(CONSOLE, "Data: %s\n", Temp.c_str());*/ DEBUG_LOG(WIIMOTE, "Data: %s", Temp.c_str());*/
break; break;
case 0xA4: case 0xA4:
block = g_RegExt; // Extension Controller register block = g_RegExt; // Extension Controller register
blockSize = WIIMOTE_REG_EXT_SIZE; blockSize = WIIMOTE_REG_EXT_SIZE;
INFO_LOG(WII_IPC_WIIMOTE, " Case 0xa4: ExtReg"); INFO_LOG(WIIMOTE, " Case 0xa4: ExtReg");
/*INFO_LOG(CONSOLE, "Write RegExt Size: %i Address: %08x Offset: %08x \n", /*DEBUG_LOG(WIIMOTE, "Write RegExt Size: %i Address: %08x Offset: %08x ",
wd->size, address, (address & 0xffff)); wd->size, address, (address & 0xffff));
INFO_LOG(CONSOLE, "Data: %s\n", Temp.c_str());*/ DEBUG_LOG(WIIMOTE, "Data: %s", Temp.c_str());*/
break; break;
// case 0xA6:
// block = g_RegMotionPlus;
// blockSize = WIIMOTE_REG_EXT_SIZE;
// INFO_LOG(WIIMOTE, " Case 0xa6: MotionPlusReg [%x] Write ", address);
/*INFO_LOG(WIIMOTE, "Write MotionPlusReg Size: %i Address: %08x Offset: %08x ",
wd->size, address, (address & 0xffff));
// INFO_LOG(WIIMOTE, "Data: %s", Temp.c_str());*/
// break;
case 0xB0: case 0xB0:
block = g_RegIr; block = g_RegIr;
blockSize = WIIMOTE_REG_IR_SIZE; blockSize = WIIMOTE_REG_IR_SIZE;
INFO_LOG(WII_IPC_WIIMOTE, " Case 0xb0: RegIr"); INFO_LOG(WIIMOTE, " Case 0xb0: RegIr");
/*INFO_LOG(CONSOLE, "Write RegIR Size: %i Address: %08x Offset: %08x \n", /*DEBUG_LOG(WIIMOTE, "Write RegIR Size: %i Address: %08x Offset: %08x ",
wd->size, address, (address & 0xffff)); wd->size, address, (address & 0xffff));
INFO_LOG(CONSOLE, "Data: %s\n", Temp.c_str());*/ DEBUG_LOG(WIIMOTE, "Data: %s", Temp.c_str());*/
break; break;
default: default:
ERROR_LOG(WII_IPC_WIIMOTE, "WmWriteData: bad register block!"); ERROR_LOG(WIIMOTE, "WmWriteData: bad register block!");
PanicAlert("WmWriteData: bad register block!"); PanicAlert("WmWriteData: bad register block!");
return; return;
} }
@ -474,8 +497,8 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
if(blockSize == WIIMOTE_REG_EXT_SIZE) if(blockSize == WIIMOTE_REG_EXT_SIZE)
{ {
/* Debugging. Write the data. /* Debugging. Write the data.
INFO_LOG(CONSOLE, "Data: %s\n", Temp.c_str()); DEBUG_LOG(WIIMOTE, "Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "Current address: %08x\n", address); */ DEBUG_LOG(WIIMOTE, "Current address: %08x", address); */
/* Run the key generation on all writes in the key area, it doesn't matter /* Run the key generation on all writes in the key area, it doesn't matter
that we send it parts of a key, only the last full key will have an that we send it parts of a key, only the last full key will have an
@ -502,7 +525,7 @@ void WmWriteData(u16 _channelID, wm_write_data* wd)
report. */ report. */
void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension) void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension)
{ {
INFO_LOG(WII_IPC_WIIMOTE, " Request Status: Rumble: %x Channel: %04x", INFO_LOG(WIIMOTE, " Request Status: Rumble: %x Channel: %04x",
rs->rumble, _channelID); rs->rumble, _channelID);
//SendStatusReport(); //SendStatusReport();
@ -542,8 +565,8 @@ void WmRequestStatus(u16 _channelID, wm_request_status* rs, int Extension)
pStatus->extension = 0; pStatus->extension = 0;
} }
INFO_LOG(WII_IPC_WIIMOTE, " Extension: %x", pStatus->extension); INFO_LOG(WIIMOTE, " Extension: %x", pStatus->extension);
INFO_LOG(WII_IPC_WIIMOTE, " SendStatusReport() Flags: 0x%02x Battery: %d" INFO_LOG(WIIMOTE, " SendStatusReport() Flags: 0x%02x Battery: %d"
,pStatus->padding1[2], pStatus->battery); ,pStatus->padding1[2], pStatus->battery);
g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset); g_WiimoteInitialize.pWiimoteInput(_channelID, DataFrame, Offset);

View File

@ -259,8 +259,8 @@ void wiimote_gen_key(wiimote_key *key, u8 *keydata)
for(int i=0;i<6;i++) for(int i=0;i<6;i++)
skey[5-i] = keydata[i+10]; skey[5-i] = keydata[i+10];
INFO_LOG(CONSOLE, "rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]); DEBUG_LOG(WIIMOTE, "rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]);
INFO_LOG(CONSOLE, "key: %02x %02x %02x %02x %02x %02x\n", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]); DEBUG_LOG(WIIMOTE, "key: %02x %02x %02x %02x %02x %02x", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]);
for(idx = 0; idx < 7; idx++) for(idx = 0; idx < 7; idx++)
{ {
@ -269,12 +269,12 @@ void wiimote_gen_key(wiimote_key *key, u8 *keydata)
break; break;
} }
// default case is idx = 7 which is valid (homebrew uses it for the 0x17 case) // default case is idx = 7 which is valid (homebrew uses it for the 0x17 case)
INFO_LOG(CONSOLE, "idx: %d\n", idx); DEBUG_LOG(WIIMOTE, "idx: %d", idx);
gentabs(rand, skey, idx, key->ft, key->sb); gentabs(rand, skey, idx, key->ft, key->sb);
INFO_LOG(CONSOLE, "ft: %02x %02x %02x %02x %02x %02x %02x %02x\n", key->ft[0], key->ft[1], key->ft[2], key->ft[3], key->ft[4], key->ft[5], key->ft[6], key->ft[7]); DEBUG_LOG(WIIMOTE, "ft: %02x %02x %02x %02x %02x %02x %02x %02x", key->ft[0], key->ft[1], key->ft[2], key->ft[3], key->ft[4], key->ft[5], key->ft[6], key->ft[7]);
INFO_LOG(CONSOLE, "sb: %02x %02x %02x %02x %02x %02x %02x %02x\n", key->sb[0], key->sb[1], key->sb[2], key->sb[3], key->sb[4], key->sb[5], key->sb[6], key->sb[7]); DEBUG_LOG(WIIMOTE, "sb: %02x %02x %02x %02x %02x %02x %02x %02x", key->sb[0], key->sb[1], key->sb[2], key->sb[3], key->sb[4], key->sb[5], key->sb[6], key->sb[7]);
// for homebrew, ft and sb are all 0x97 which is equivalent to 0x17 // for homebrew, ft and sb are all 0x97 which is equivalent to 0x17
} }

View File

@ -98,7 +98,7 @@ int G2Accelerometer(int _G, int XYZ, int Wm)
int Return = (int)Accelerometer; int Return = (int)Accelerometer;
// Logging // Logging
//INFO_LOG(CONSOLE, "G2Accelerometer():%f %f %f %f\n", Neutral, OneG, G, Accelerometer); //DEBUG_LOG(WIIMOTE, "G2Accelerometer():%f %f %f %f", Neutral, OneG, G, Accelerometer);
// Boundaries // Boundaries
if (Return > 255) Return = 255; if (Return > 255) Return = 255;
@ -117,14 +117,14 @@ bool RecordingPlayAccIR(u8 &_x, u8 &_y, u8 &_z, IRReportType &_IR, int Wm)
if(VRecording.at(g_RecordingPlaying[Wm]).Recording.size() == 0) if(VRecording.at(g_RecordingPlaying[Wm]).Recording.size() == 0)
{ {
g_RecordingPlaying[Wm] = -1; g_RecordingPlaying[Wm] = -1;
INFO_LOG(CONSOLE, "Empty\n\n"); DEBUG_LOG(WIIMOTE, "Empty");
return false; return false;
} }
// Return if the playback speed is unset // Return if the playback speed is unset
if(VRecording.at(g_RecordingPlaying[Wm]).PlaybackSpeed < 0) if(VRecording.at(g_RecordingPlaying[Wm]).PlaybackSpeed < 0)
{ {
INFO_LOG(CONSOLE, "PlaybackSpeed empty: %i\n\n", g_RecordingPlaying[Wm]); DEBUG_LOG(WIIMOTE, "PlaybackSpeed empty: %i", g_RecordingPlaying[Wm]);
g_RecordingPlaying[Wm] = -1; g_RecordingPlaying[Wm] = -1;
return false; return false;
} }
@ -139,7 +139,7 @@ bool RecordingPlayAccIR(u8 &_x, u8 &_y, u8 &_z, IRReportType &_IR, int Wm)
) )
) )
{ {
INFO_LOG(CONSOLE, "Wrong IR mode: %i\n\n", g_RecordingPlaying[Wm]); DEBUG_LOG(WIIMOTE, "Wrong IR mode: %i", g_RecordingPlaying[Wm]);
g_RecordingPlaying[Wm] = -1; g_RecordingPlaying[Wm] = -1;
return false; return false;
} }
@ -147,7 +147,7 @@ bool RecordingPlayAccIR(u8 &_x, u8 &_y, u8 &_z, IRReportType &_IR, int Wm)
// Get starting time // Get starting time
if(g_RecordingCounter[Wm] == 0) if(g_RecordingCounter[Wm] == 0)
{ {
INFO_LOG(CONSOLE, "\n\nBegin: %i\n", Wm); DEBUG_LOG(WIIMOTE, "Begin: %i", Wm);
g_RecordingStart[Wm] = Common::Timer::GetDoubleTime(); g_RecordingStart[Wm] = Common::Timer::GetDoubleTime();
} }
@ -177,7 +177,7 @@ bool RecordingPlayAccIR(u8 &_x, u8 &_y, u8 &_z, IRReportType &_IR, int Wm)
g_RecordingPlaying[Wm] = -1; g_RecordingPlaying[Wm] = -1;
g_RecordingStart[Wm] = 0; g_RecordingStart[Wm] = 0;
g_RecordingCurrentTime[Wm] = 0; g_RecordingCurrentTime[Wm] = 0;
INFO_LOG(CONSOLE, "End: %i\n\n", Wm); DEBUG_LOG(WIIMOTE, "End: %i", Wm);
return false; return false;
} }
@ -191,13 +191,13 @@ bool RecordingPlayAccIR(u8 &_x, u8 &_y, u8 &_z, IRReportType &_IR, int Wm)
if (g_DebugAccelerometer) if (g_DebugAccelerometer)
{ {
//Console::ClearScreen(); //Console::ClearScreen();
INFO_LOG(CONSOLE, "Current time: [%i / %i] %f %f\n", DEBUG_LOG(WIIMOTE, "Current time: [%i / %i] %f %f",
g_RecordingPoint[Wm], VRecording.at(g_RecordingPlaying[Wm]).Recording.size(), g_RecordingPoint[Wm], VRecording.at(g_RecordingPlaying[Wm]).Recording.size(),
VRecording.at(g_RecordingPlaying[Wm]).Recording.at(g_RecordingPoint[Wm]).Time, g_RecordingCurrentTime[Wm] VRecording.at(g_RecordingPlaying[Wm]).Recording.at(g_RecordingPoint[Wm]).Time, g_RecordingCurrentTime[Wm]
); );
INFO_LOG(CONSOLE, "Accel x, y, z: %03u %03u %03u\n", _x, _y, _z); DEBUG_LOG(WIIMOTE, "Accel x, y, z: %03u %03u %03u", _x, _y, _z);
} }
//INFO_LOG(CONSOLE, "Accel x, y, z: %03u %03u %03u\n", _x, _y, _z); //DEBUG_LOG(WIIMOTE, "Accel x, y, z: %03u %03u %03u", _x, _y, _z);
g_RecordingCounter[Wm]++; g_RecordingCounter[Wm]++;
@ -259,7 +259,7 @@ bool IsSwitchPressed(int _Key)
int RecordingCheckKeys(int WmNuIr) int RecordingCheckKeys(int WmNuIr)
{ {
#ifdef _WIN32 #ifdef _WIN32
//INFO_LOG(CONSOLE, "RecordingCheckKeys: %i\n", Wiimote); //DEBUG_LOG(WIIMOTE, "RecordingCheckKeys: %i", Wiimote);
// Check if we have a HotKey match // Check if we have a HotKey match
bool Match = false; bool Match = false;
@ -274,7 +274,7 @@ int RecordingCheckKeys(int WmNuIr)
|| VRecording.at(i).HotKeyIR == j && WmNuIr == 2 && IsNumericalKeyPressed(j)) || VRecording.at(i).HotKeyIR == j && WmNuIr == 2 && IsNumericalKeyPressed(j))
&& (IsSwitchPressed(VRecording.at(i).HotKeySwitch) || VRecording.at(i).HotKeySwitch == 3)) && (IsSwitchPressed(VRecording.at(i).HotKeySwitch) || VRecording.at(i).HotKeySwitch == 3))
{ {
//INFO_LOG(CONSOLE, "Match: %i %i\n", i, Key); //DEBUG_LOG(WIIMOTE, "Match: %i %i", i, Key);
Match = true; Match = true;
Recording = i; Recording = i;
break; break;
@ -430,7 +430,7 @@ void SingleShake(u8 &_y, u8 &_z, int i)
Shake[i] = -1; Shake[i] = -1;
} }
#endif #endif
//if (Shake[i] > -1) INFO_LOG(CONSOLE, "Shake: %i\n", Shake[i]); //if (Shake[i] > -1) DEBUG_LOG(WIIMOTE, "Shake: %i", Shake[i]);
} }
@ -551,7 +551,7 @@ void TiltWiimoteKeyboard(float &Roll, float &Pitch)
else else
{ {
Pitch = KbDegree; Pitch = KbDegree;
//INFO_LOG(CONSOLE, "Degree: %2.1f\n", KbDegree); //DEBUG_LOG(WIIMOTE, "Degree: %2.1f", KbDegree);
} }
#endif #endif
} }
@ -580,9 +580,9 @@ void Tilt(u8 &_x, u8 &_y, u8 &_z)
if (g_DebugData) if (g_DebugData)
{ {
/*INFO_LOG(CONSOLE, "L:%2.1f R:%2.1f Lx:%2.1f Range:%2.1f Degree:%2.1f L:%i R:%i\n", /*DEBUG_LOG(WIIMOTE, "L:%2.1f R:%2.1f Lx:%2.1f Range:%2.1f Degree:%2.1f L:%i R:%i",
Tl, Tr, Lx, Range, Degree, PadState[Page].Axis.Tl, PadState[Page].Axis.Tr);*/ Tl, Tr, Lx, Range, Degree, PadState[Page].Axis.Tl, PadState[Page].Axis.Tr);*/
/*INFO_LOG(CONSOLE, "Roll:%2.1f Pitch:%2.1f\n", Roll, Pitch);*/ /*DEBUG_LOG(WIIMOTE, "Roll:%2.1f Pitch:%2.1f", Roll, Pitch);*/
} }
} }
@ -598,7 +598,7 @@ void FillReportAcc(wm_accel& _acc)
{ {
// If the recording reached the end or failed somehow we will not return // If the recording reached the end or failed somehow we will not return
if (RecordingPlay(_acc.x, _acc.y, _acc.z, 0)) return; if (RecordingPlay(_acc.x, _acc.y, _acc.z, 0)) return;
//INFO_LOG(CONSOLE, "X, Y, Z: %u %u %u\n", _acc.x, _acc.y, _acc.z); //DEBUG_LOG(WIIMOTE, "X, Y, Z: %u %u %u", _acc.x, _acc.y, _acc.z);
} }
// The default values can change so we need to update them all the time // The default values can change so we need to update them all the time
@ -698,13 +698,13 @@ void FillReportAcc(wm_accel& _acc)
//if(consoleDisplay == 0) //if(consoleDisplay == 0)
INFO_LOG(CONSOLE, "x: %03i | y: %03i | z: %03i | A:%i B:%i C:%i a:%i b:%i c:%i d:%i X:%i Y:%i Z:%i\n", DEBUG_LOG(WIIMOTE, "x: %03i | y: %03i | z: %03i | A:%i B:%i C:%i a:%i b:%i c:%i d:%i X:%i Y:%i Z:%i",
_acc.x, _acc.y, _acc.z, _acc.x, _acc.y, _acc.z,
A, B, C, A, B, C,
a, b, c, d, a, b, c, d,
X, Y, Z X, Y, Z
); );
INFO_LOG(CONSOLE, "x: %03i | y: %03i | z: %03i | X:%i Y:%i Z:%i | AX:%i AY:%i AZ:%i \n", DEBUG_LOG(WIIMOTE, "x: %03i | y: %03i | z: %03i | X:%i Y:%i Z:%i | AX:%i AY:%i AZ:%i ",
_acc.x, _acc.y, _acc.z, _acc.x, _acc.y, _acc.z,
X, Y, Z, X, Y, Z,
AX, AY, AZ AX, AY, AZ
@ -730,7 +730,7 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
} }
else else
{ {
//INFO_LOG(CONSOLE, "X, Y, Z: %u %u %u\n", _acc.x, _acc.y, _acc.z); //DEBUG_LOG(WIIMOTE, "X, Y, Z: %u %u %u", _acc.x, _acc.y, _acc.z);
if (RecordingPlayIR(_ir0)) return; if (RecordingPlayIR(_ir0)) return;
} }
@ -777,7 +777,7 @@ void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1)
//Console::ClearScreen(); //Console::ClearScreen();
//if(consoleDisplay == 1) //if(consoleDisplay == 1)
INFO_LOG(CONSOLE, "x0:%03i x1:%03i y0:%03i y1:%03i | T:%i L:%i R:%i B:%i S:%i\n", DEBUG_LOG(WIIMOTE, "x0:%03i x1:%03i y0:%03i y1:%03i | T:%i L:%i R:%i B:%i S:%i",
x0, x1, y0, y1, Top, Left, Right, Bottom, SensorBarRadius x0, x1, y0, y1, Top, Left, Right, Bottom, SensorBarRadius
);*/ );*/
@ -810,7 +810,7 @@ void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
// We are playing back a recording, we don't accept any manual input this time // We are playing back a recording, we don't accept any manual input this time
else else
{ {
//INFO_LOG(CONSOLE, "X, Y, Z: %u %u %u\n", _acc.x, _acc.y, _acc.z); //DEBUG_LOG(WIIMOTE, "X, Y, Z: %u %u %u", _acc.x, _acc.y, _acc.z);
if (RecordingPlayIR(_ir0)) return; if (RecordingPlayIR(_ir0)) return;
} }
@ -868,11 +868,11 @@ void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1)
//ClearScreen(); //ClearScreen();
//if(consoleDisplay == 1) //if(consoleDisplay == 1)
INFO_LOG(CONSOLE, "x1:%03i x2:%03i y1:%03i y2:%03i irx1:%02x y1:%02x x2:%02x y2:%02x | T:%i L:%i R:%i B:%i S:%i\n", DEBUG_LOG(WIIMOTE, "x1:%03i x2:%03i y1:%03i y2:%03i irx1:%02x y1:%02x x2:%02x y2:%02x | T:%i L:%i R:%i B:%i S:%i",
x1, x2, y1, y2, _ir0.x1, _ir0.y1, _ir1.x2, _ir1.y2, Top, Left, Right, Bottom, SensorBarRadius x1, x2, y1, y2, _ir0.x1, _ir0.y1, _ir1.x2, _ir1.y2, Top, Left, Right, Bottom, SensorBarRadius
); );
INFO_LOG(CONSOLE, "\n"); DEBUG_LOG(WIIMOTE, "");
INFO_LOG(CONSOLE, "ir0.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir0.y1:%02x y1h:%02x y2:%02x y2h:%02x | ir1.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir1.y1:%02x y1h:%02x y2:%02x y2h:%02x\n", DEBUG_LOG(WIIMOTE, "ir0.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir0.y1:%02x y1h:%02x y2:%02x y2h:%02x | ir1.x1:%02x x1h:%02x x2:%02x x2h:%02x | ir1.y1:%02x y1h:%02x y2:%02x y2h:%02x",
_ir0.x1, _ir0.x1Hi, _ir0.x2, _ir0.x2Hi, _ir0.x1, _ir0.x1Hi, _ir0.x2, _ir0.x2Hi,
_ir0.y1, _ir0.y1Hi, _ir0.y2, _ir0.y2Hi, _ir0.y1, _ir0.y1Hi, _ir0.y2, _ir0.y2Hi,
_ir1.x1, _ir1.x1Hi, _ir1.x2, _ir1.x2Hi, _ir1.x1, _ir1.x1Hi, _ir1.x2, _ir1.x2Hi,

View File

@ -45,26 +45,26 @@ int GetReportSize(struct wiimote_t* wm)
void handle_ctrl_status(struct wiimote_t* wm) void handle_ctrl_status(struct wiimote_t* wm)
{ {
INFO_LOG(CONSOLE, "\n\n--- CONTROLLER STATUS [wiimote id %i] ---\n", wm->unid); DEBUG_LOG(WIIMOTE, "--- CONTROLLER STATUS [wiimote id %i] ---", wm->unid);
INFO_LOG(CONSOLE, "attachment: %i\n", wm->exp.type); DEBUG_LOG(WIIMOTE, "attachment: %i", wm->exp.type);
INFO_LOG(CONSOLE, "speaker: %i\n", WIIUSE_USING_SPEAKER(wm)); DEBUG_LOG(WIIMOTE, "speaker: %i", WIIUSE_USING_SPEAKER(wm));
INFO_LOG(CONSOLE, "ir: %i\n", WIIUSE_USING_IR(wm)); DEBUG_LOG(WIIMOTE, "ir: %i", WIIUSE_USING_IR(wm));
INFO_LOG(CONSOLE, "leds: %i %i %i %i\n", WIIUSE_IS_LED_SET(wm, 1), WIIUSE_IS_LED_SET(wm, 2), WIIUSE_IS_LED_SET(wm, 3), WIIUSE_IS_LED_SET(wm, 4)); DEBUG_LOG(WIIMOTE, "leds: %i %i %i %i", WIIUSE_IS_LED_SET(wm, 1), WIIUSE_IS_LED_SET(wm, 2), WIIUSE_IS_LED_SET(wm, 3), WIIUSE_IS_LED_SET(wm, 4));
INFO_LOG(CONSOLE, "battery: %f %%\n", wm->battery_level); DEBUG_LOG(WIIMOTE, "battery: %f %%", wm->battery_level);
} }
bool IRDataOK(struct wiimote_t* wm) bool IRDataOK(struct wiimote_t* wm)
{ {
//INFO_LOG(CONSOLE, "IRDataOK: "); //DEBUG_LOG(WIIMOTE, "IRDataOK: ");
// The report size is 0x33 = 18, 0x37 = 22 withouth the leading (a1) byte // The report size is 0x33 = 18, 0x37 = 22 withouth the leading (a1) byte
int ReportSize = GetReportSize(wm); int ReportSize = GetReportSize(wm);
for(int i = 0; i < ReportSize; i++) for(int i = 0; i < ReportSize; i++)
{ {
//INFO_LOG(CONSOLE, "%02x ", wm->event_buf[i]); //DEBUG_LOG(WIIMOTE, "%02x ", wm->event_buf[i]);
if (wm->event_buf[i] > 0) if (wm->event_buf[i] > 0)
{ {
//INFO_LOG(CONSOLE, "\n"); //DEBUG_LOG(WIIMOTE, "");
return true; return true;
} }
} }
@ -73,21 +73,21 @@ bool IRDataOK(struct wiimote_t* wm)
void handle_event(struct wiimote_t* wm) void handle_event(struct wiimote_t* wm)
{ {
//INFO_LOG(CONSOLE, "\n\n--- EVENT [id %i] ---\n", wm->unid); //DEBUG_LOG(WIIMOTE, "--- EVENT [id %i] ---", wm->unid);
// if a button is pressed, report it // if a button is pressed, report it
if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) INFO_LOG(CONSOLE, "A pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) DEBUG_LOG(WIIMOTE, "A pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_B)) INFO_LOG(CONSOLE, "B pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_B)) DEBUG_LOG(WIIMOTE, "B pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_UP)) INFO_LOG(CONSOLE, "UP pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_UP)) DEBUG_LOG(WIIMOTE, "UP pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_DOWN)) INFO_LOG(CONSOLE, "DOWN pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_DOWN)) DEBUG_LOG(WIIMOTE, "DOWN pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_LEFT)) INFO_LOG(CONSOLE, "LEFT pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_LEFT)) DEBUG_LOG(WIIMOTE, "LEFT pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_RIGHT)) INFO_LOG(CONSOLE, "RIGHT pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_RIGHT)) DEBUG_LOG(WIIMOTE, "RIGHT pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_MINUS)) INFO_LOG(CONSOLE, "MINUS pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_MINUS)) DEBUG_LOG(WIIMOTE, "MINUS pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_PLUS)) INFO_LOG(CONSOLE, "PLUS pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_PLUS)) DEBUG_LOG(WIIMOTE, "PLUS pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_ONE)) INFO_LOG(CONSOLE, "ONE pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_ONE)) DEBUG_LOG(WIIMOTE, "ONE pressed");
//if (IS_PRESSED(wm, WIIMOTE_BUTTON_ONE)) g_Run = false; //if (IS_PRESSED(wm, WIIMOTE_BUTTON_ONE)) g_Run = false;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_TWO)) INFO_LOG(CONSOLE, "TWO pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_TWO)) DEBUG_LOG(WIIMOTE, "TWO pressed");
if (IS_PRESSED(wm, WIIMOTE_BUTTON_HOME)) INFO_LOG(CONSOLE, "HOME pressed\n"); if (IS_PRESSED(wm, WIIMOTE_BUTTON_HOME)) DEBUG_LOG(WIIMOTE, "HOME pressed");
// Pressing minus will tell the wiimote we are no longer interested in movement. // Pressing minus will tell the wiimote we are no longer interested in movement.
@ -164,7 +164,7 @@ void handle_event(struct wiimote_t* wm)
//Tmp += "Data: " + TmpData; //Tmp += "Data: " + TmpData;
//Console::ClearScreen(); //Console::ClearScreen();
//INFO_LOG(CONSOLE, "%s\n\n", Tmp.c_str()); //DEBUG_LOG(WIIMOTE, "%s", Tmp.c_str());
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(m_RecordingConfigFrame) if(m_RecordingConfigFrame)
@ -210,8 +210,8 @@ void handle_event(struct wiimote_t* wm)
// wxT("Current: %03u %03u %03u"), Gx, Gy, Gz)); // wxT("Current: %03u %03u %03u"), Gx, Gy, Gz));
if(m_RecordingConfigFrame->m_bRecording) if(m_RecordingConfigFrame->m_bRecording)
INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", Gx, Gy, Gz); DEBUG_LOG(WIIMOTE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i", Gx, Gy, Gz);
//INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x\n", Gx, Gy, Gz); //DEBUG_LOG(WIIMOTE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x", Gx, Gy, Gz);
} }
// Send the data to be saved // Send the data to be saved
@ -229,7 +229,7 @@ void handle_event(struct wiimote_t* wm)
if(!g_DebugData) if(!g_DebugData)
{ {
INFO_LOG(CONSOLE, "Roll:%03i Pitch:%03i\n", (int)wm->orient.roll, (int)wm->orient.pitch); DEBUG_LOG(WIIMOTE, "Roll:%03i Pitch:%03i", (int)wm->orient.roll, (int)wm->orient.pitch);
} }
if(m_PadConfigFrame) if(m_PadConfigFrame)
{ {
@ -337,7 +337,7 @@ void ReadWiimote()
{ {
Temp = ArrayToString(g_WiiMotesFromWiiUse[i]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0), 0, 30); Temp = ArrayToString(g_WiiMotesFromWiiUse[i]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0), 0, 30);
memcpy(WiiMoteEmu::g_Eeprom, g_WiiMotesFromWiiUse[i]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0)); memcpy(WiiMoteEmu::g_Eeprom, g_WiiMotesFromWiiUse[i]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0));
INFO_LOG(CONSOLE, "EEPROM: %s\n", Temp.c_str()); DEBUG_LOG(WIIMOTE, "EEPROM: %s", Temp.c_str());
WiiMoteEmu::UpdateEeprom(); WiiMoteEmu::UpdateEeprom();
g_RunTemporary = false; g_RunTemporary = false;
} }
@ -352,17 +352,17 @@ void ReadWiimote()
*/ */
//wiiuse_set_nunchuk_orient_threshold((struct nunchuk_t*)&wiimotes[i]->exp.nunchuk, 90.0f); //wiiuse_set_nunchuk_orient_threshold((struct nunchuk_t*)&wiimotes[i]->exp.nunchuk, 90.0f);
//wiiuse_set_nunchuk_accel_threshold((struct nunchuk_t*)&wiimotes[i]->exp.nunchuk, 100); //wiiuse_set_nunchuk_accel_threshold((struct nunchuk_t*)&wiimotes[i]->exp.nunchuk, 100);
INFO_LOG(CONSOLE, "Nunchuk inserted.\n"); DEBUG_LOG(WIIMOTE, "Nunchuk inserted.");
break; break;
case WIIUSE_CLASSIC_CTRL_INSERTED: case WIIUSE_CLASSIC_CTRL_INSERTED:
INFO_LOG(CONSOLE, "Classic controller inserted.\n"); DEBUG_LOG(WIIMOTE, "Classic controller inserted.");
break; break;
case WIIUSE_GUITAR_HERO_3_CTRL_INSERTED: case WIIUSE_GUITAR_HERO_3_CTRL_INSERTED:
// some expansion was inserted // some expansion was inserted
//handle_ctrl_status(wiimotes[i]); //handle_ctrl_status(wiimotes[i]);
INFO_LOG(CONSOLE, "Guitar Hero 3 controller inserted.\n"); DEBUG_LOG(WIIMOTE, "Guitar Hero 3 controller inserted.");
break; break;
case WIIUSE_NUNCHUK_REMOVED: case WIIUSE_NUNCHUK_REMOVED:
@ -370,7 +370,7 @@ void ReadWiimote()
case WIIUSE_GUITAR_HERO_3_CTRL_REMOVED: case WIIUSE_GUITAR_HERO_3_CTRL_REMOVED:
// some expansion was removed // some expansion was removed
//handle_ctrl_status(wiimotes[i]); //handle_ctrl_status(wiimotes[i]);
INFO_LOG(CONSOLE, "An expansion was removed.\n"); DEBUG_LOG(WIIMOTE, "An expansion was removed.");
break; break;
default: default:

View File

@ -232,7 +232,7 @@ void Initialize(void *init)
DoInitialize(); DoInitialize();
INFO_LOG(CONSOLE, "ISOId: %08x %s\n", g_WiimoteInitialize.ISOId, Hex2Ascii(g_WiimoteInitialize.ISOId).c_str()); DEBUG_LOG(WIIMOTE, "ISOId: %08x %s", g_WiimoteInitialize.ISOId, Hex2Ascii(g_WiimoteInitialize.ISOId).c_str());
} }
// If a game is not running this is called by the Configuration window when it's closed // If a game is not running this is called by the Configuration window when it's closed
@ -305,10 +305,10 @@ void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
// Debugging // Debugging
{ {
DEBUG_LOG(WII_IPC_WIIMOTE, "Wiimote_Input"); DEBUG_LOG(WIIMOTE, "Wiimote_Input");
DEBUG_LOG(WII_IPC_WIIMOTE, " Channel ID: %04x", _channelID); DEBUG_LOG(WIIMOTE, " Channel ID: %04x", _channelID);
std::string Temp = ArrayToString(data, _Size); std::string Temp = ArrayToString(data, _Size);
DEBUG_LOG(WII_IPC_WIIMOTE, " Data: %s", Temp.c_str()); DEBUG_LOG(WIIMOTE, " Data: %s", Temp.c_str());
} }
// Decice where to send the message // Decice where to send the message
@ -330,7 +330,7 @@ void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
// Check for custom communication // Check for custom communication
if(_channelID == 99 && data[0] == WIIMOTE_RECONNECT) if(_channelID == 99 && data[0] == WIIMOTE_RECONNECT)
{ {
INFO_LOG(CONSOLE, "\n\nWiimote Disconnected\n\n"); DEBUG_LOG(WIIMOTE, "Wiimote Disconnected");
g_EmulatorRunning = false; g_EmulatorRunning = false;
g_WiimoteUnexpectedDisconnect = true; g_WiimoteUnexpectedDisconnect = true;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
@ -341,9 +341,9 @@ void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
// Debugging // Debugging
{ {
DEBUG_LOG(WII_IPC_WIIMOTE, "Wiimote_ControlChannel"); DEBUG_LOG(WIIMOTE, "Wiimote_ControlChannel");
std::string Temp = ArrayToString(data, _Size); std::string Temp = ArrayToString(data, _Size);
DEBUG_LOG(WII_IPC_WIIMOTE, " Data: %s", Temp.c_str()); DEBUG_LOG(WIIMOTE, " Data: %s", Temp.c_str());
//PanicAlert("Wiimote_ControlChannel"); //PanicAlert("Wiimote_ControlChannel");
} }
@ -395,8 +395,8 @@ void Wiimote_Update()
if( GetAsyncKeyState(VK_NEXT) && g_DebugAccelerometer ) g_DebugAccelerometer = false; // Home if( GetAsyncKeyState(VK_NEXT) && g_DebugAccelerometer ) g_DebugAccelerometer = false; // Home
else if (GetAsyncKeyState(VK_NEXT) && !g_DebugAccelerometer ) g_DebugAccelerometer = true; else if (GetAsyncKeyState(VK_NEXT) && !g_DebugAccelerometer ) g_DebugAccelerometer = true;
if( GetAsyncKeyState(VK_END) && g_DebugCustom ) { g_DebugCustom = false; INFO_LOG(CONSOLE, "Custom Debug: Off\n");} // End if( GetAsyncKeyState(VK_END) && g_DebugCustom ) { g_DebugCustom = false; DEBUG_LOG(WIIMOTE, "Custom Debug: Off");} // End
else if (GetAsyncKeyState(VK_END) && !g_DebugCustom ) {g_DebugCustom = true; INFO_LOG(CONSOLE, "Custom Debug: Off\n");} else if (GetAsyncKeyState(VK_END) && !g_DebugCustom ) {g_DebugCustom = true; DEBUG_LOG(WIIMOTE, "Custom Debug: Off");}
#endif #endif
} }
@ -460,15 +460,15 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
Name = "WM_STATUS_REPORT"; Name = "WM_STATUS_REPORT";
{ {
wm_status_report* pStatus = (wm_status_report*)(data + 2); wm_status_report* pStatus = (wm_status_report*)(data + 2);
INFO_LOG(CONSOLE, "\n" DEBUG_LOG(WIIMOTE, ""
"Extension Controller: %i\n" "Extension Controller: %i "
//"Speaker enabled: %i\n" //"Speaker enabled: %i "
//"IR camera enabled: %i\n" //"IR camera enabled: %i "
//"LED 1: %i\n" //"LED 1: %i "
//"LED 2: %i\n" //"LED 2: %i "
//"LED 3: %i\n" //"LED 3: %i "
//"LED 4: %i\n" //"LED 4: %i "
"Battery low: %i\n\n", "Battery low: %i",
pStatus->extension, pStatus->extension,
//pStatus->speaker, //pStatus->speaker,
//pStatus->ir, //pStatus->ir,
@ -499,9 +499,9 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
if ((data[4] == 0x10 || data[4] == 0x20 || data[4] == 0x50) && data[5] == 0x00 && (data[6] == 0xfa || data[6] == 0xfe)) if ((data[4] == 0x10 || data[4] == 0x20 || data[4] == 0x50) && data[5] == 0x00 && (data[6] == 0xfa || data[6] == 0xfe))
{ {
if(data[4] == 0x10) if(data[4] == 0x10)
TmpData.append(StringFromFormat("Game got the encrypted extension ID: %02x%02x\n", data[7], data[8])); TmpData.append(StringFromFormat("Game got the encrypted extension ID: %02x%02x", data[7], data[8]));
else if(data[4] == 0x50) else if(data[4] == 0x50)
TmpData.append(StringFromFormat("Game got the encrypted extension ID: %02x%02x%02x%02x%02x%02x\n", data[7], data[8], data[9], data[10], data[11], data[12])); TmpData.append(StringFromFormat("Game got the encrypted extension ID: %02x%02x%02x%02x%02x%02x", data[7], data[8], data[9], data[10], data[11], data[12]));
// We have already sent the data report so we can safely decrypt it now // We have already sent the data report so we can safely decrypt it now
if(WiiMoteEmu::g_Encryption) if(WiiMoteEmu::g_Encryption)
@ -526,8 +526,8 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI(); if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif #endif
INFO_LOG(CONSOLE, "%s", TmpData.c_str()); DEBUG_LOG(WIIMOTE, "%s", TmpData.c_str());
INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x\n\n", data[7], data[8]); DEBUG_LOG(WIIMOTE, "Game got the decrypted extension ID: %02x%02x", data[7], data[8]);
} }
else if(data[4] == 0x50) else if(data[4] == 0x50)
{ {
@ -541,8 +541,8 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI(); if (m_BasicConfigFrame) m_BasicConfigFrame->UpdateGUI();
#endif #endif
INFO_LOG(CONSOLE, "%s", TmpData.c_str()); DEBUG_LOG(WIIMOTE, "%s", TmpData.c_str());
INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x\n\n", data[7], data[8], data[9], data[10], data[11], data[12]); DEBUG_LOG(WIIMOTE, "Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x", data[7], data[8], data[9], data[10], data[11], data[12]);
} }
} }
@ -554,13 +554,13 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
{ {
if(data[6] == 0x10) if(data[6] == 0x10)
{ {
INFO_LOG(CONSOLE, "\nGame got the Wiimote calibration:\n"); DEBUG_LOG(WIIMOTE, "Game got the Wiimote calibration:");
INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 6]); DEBUG_LOG(WIIMOTE, "Cal_zero.x: %i", data[7 + 6]);
INFO_LOG(CONSOLE, "Cal_zero.y: %i\n", data[7 + 7]); DEBUG_LOG(WIIMOTE, "Cal_zero.y: %i", data[7 + 7]);
INFO_LOG(CONSOLE, "Cal_zero.z: %i\n", data[7 + 8]); DEBUG_LOG(WIIMOTE, "Cal_zero.z: %i", data[7 + 8]);
INFO_LOG(CONSOLE, "Cal_g.x: %i\n", data[7 + 10]); DEBUG_LOG(WIIMOTE, "Cal_g.x: %i", data[7 + 10]);
INFO_LOG(CONSOLE, "Cal_g.y: %i\n", data[7 + 11]); DEBUG_LOG(WIIMOTE, "Cal_g.y: %i", data[7 + 11]);
INFO_LOG(CONSOLE, "Cal_g.z: %i\n", data[7 +12]); DEBUG_LOG(WIIMOTE, "Cal_g.z: %i", data[7 +12]);
} }
} }
@ -568,7 +568,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
if(data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30)) if(data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30))
{ {
// Save the encrypted data // Save the encrypted data
TmpData = StringFromFormat("Read[%s] (enc): %s\n", (Emu ? "Emu" : "Real"), ArrayToString(data, size + 2, 0, 30).c_str()); TmpData = StringFromFormat("Read[%s] (enc): %s", (Emu ? "Emu" : "Real"), ArrayToString(data, size + 2, 0, 30).c_str());
// We have already sent the data report so we can safely decrypt it now // We have already sent the data report so we can safely decrypt it now
if(WiiMoteEmu::g_Encryption) if(WiiMoteEmu::g_Encryption)
@ -576,37 +576,37 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
if (g_Config.iExtensionConnected == EXT_NUNCHUCK) if (g_Config.iExtensionConnected == EXT_NUNCHUCK)
{ {
INFO_LOG(CONSOLE, "\nGame got the Nunchuck calibration:\n"); DEBUG_LOG(WIIMOTE, "Game got the Nunchuck calibration:");
INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 0]); DEBUG_LOG(WIIMOTE, "Cal_zero.x: %i", data[7 + 0]);
INFO_LOG(CONSOLE, "Cal_zero.y: %i\n", data[7 + 1]); DEBUG_LOG(WIIMOTE, "Cal_zero.y: %i", data[7 + 1]);
INFO_LOG(CONSOLE, "Cal_zero.z: %i\n", data[7 + 2]); DEBUG_LOG(WIIMOTE, "Cal_zero.z: %i", data[7 + 2]);
INFO_LOG(CONSOLE, "Cal_g.x: %i\n", data[7 + 4]); DEBUG_LOG(WIIMOTE, "Cal_g.x: %i", data[7 + 4]);
INFO_LOG(CONSOLE, "Cal_g.y: %i\n", data[7 + 5]); DEBUG_LOG(WIIMOTE, "Cal_g.y: %i", data[7 + 5]);
INFO_LOG(CONSOLE, "Cal_g.z: %i\n", data[7 + 6]); DEBUG_LOG(WIIMOTE, "Cal_g.z: %i", data[7 + 6]);
INFO_LOG(CONSOLE, "Js.Max.x: %i\n", data[7 + 8]); DEBUG_LOG(WIIMOTE, "Js.Max.x: %i", data[7 + 8]);
INFO_LOG(CONSOLE, "Js.Min.x: %i\n", data[7 + 9]); DEBUG_LOG(WIIMOTE, "Js.Min.x: %i", data[7 + 9]);
INFO_LOG(CONSOLE, "Js.Center.x: %i\n", data[7 + 10]); DEBUG_LOG(WIIMOTE, "Js.Center.x: %i", data[7 + 10]);
INFO_LOG(CONSOLE, "Js.Max.y: %i\n", data[7 + 11]); DEBUG_LOG(WIIMOTE, "Js.Max.y: %i", data[7 + 11]);
INFO_LOG(CONSOLE, "Js.Min.y: %i\n", data[7 + 12]); DEBUG_LOG(WIIMOTE, "Js.Min.y: %i", data[7 + 12]);
INFO_LOG(CONSOLE, "JS.Center.y: %i\n\n", data[7 + 13]); DEBUG_LOG(WIIMOTE, "JS.Center.y: %i", data[7 + 13]);
} }
else // g_Config.bClassicControllerConnected else // g_Config.bClassicControllerConnected
{ {
INFO_LOG(CONSOLE, "\nGame got the Classic Controller calibration:\n"); DEBUG_LOG(WIIMOTE, "Game got the Classic Controller calibration:");
INFO_LOG(CONSOLE, "Lx.Max: %i\n", data[7 + 0]); DEBUG_LOG(WIIMOTE, "Lx.Max: %i", data[7 + 0]);
INFO_LOG(CONSOLE, "Lx.Min: %i\n", data[7 + 1]); DEBUG_LOG(WIIMOTE, "Lx.Min: %i", data[7 + 1]);
INFO_LOG(CONSOLE, "Lx.Center: %i\n", data[7 + 2]); DEBUG_LOG(WIIMOTE, "Lx.Center: %i", data[7 + 2]);
INFO_LOG(CONSOLE, "Ly.Max: %i\n", data[7 + 3]); DEBUG_LOG(WIIMOTE, "Ly.Max: %i", data[7 + 3]);
INFO_LOG(CONSOLE, "Ly.Min: %i\n", data[7 + 4]); DEBUG_LOG(WIIMOTE, "Ly.Min: %i", data[7 + 4]);
INFO_LOG(CONSOLE, "Ly.Center: %i\n", data[7 + 5]); DEBUG_LOG(WIIMOTE, "Ly.Center: %i", data[7 + 5]);
INFO_LOG(CONSOLE, "Rx.Max.x: %i\n", data[7 + 6]); DEBUG_LOG(WIIMOTE, "Rx.Max.x: %i", data[7 + 6]);
INFO_LOG(CONSOLE, "Rx.Min.x: %i\n", data[7 + 7]); DEBUG_LOG(WIIMOTE, "Rx.Min.x: %i", data[7 + 7]);
INFO_LOG(CONSOLE, "Rx.Center.x: %i\n", data[7 + 8]); DEBUG_LOG(WIIMOTE, "Rx.Center.x: %i", data[7 + 8]);
INFO_LOG(CONSOLE, "Ry.Max.y: %i\n", data[7 + 9]); DEBUG_LOG(WIIMOTE, "Ry.Max.y: %i", data[7 + 9]);
INFO_LOG(CONSOLE, "Ry.Min: %i\n", data[7 + 10]); DEBUG_LOG(WIIMOTE, "Ry.Min: %i", data[7 + 10]);
INFO_LOG(CONSOLE, "Ry.Center: %i\n\n", data[7 + 11]); DEBUG_LOG(WIIMOTE, "Ry.Center: %i", data[7 + 11]);
INFO_LOG(CONSOLE, "Lt.Neutral: %i\n", data[7 + 12]); DEBUG_LOG(WIIMOTE, "Lt.Neutral: %i", data[7 + 12]);
INFO_LOG(CONSOLE, "Rt.Neutral %i\n\n", data[7 + 13]); DEBUG_LOG(WIIMOTE, "Rt.Neutral %i", data[7 + 13]);
} }
// Save the values if they come from the real Wiimote // Save the values if they come from the real Wiimote
@ -622,7 +622,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
// Save the default values that should work with Wireless Nunchucks // Save the default values that should work with Wireless Nunchucks
else else
{ {
WiiMoteEmu::SetDefaultExtensionRegistry(); WiiMoteEmu::UpdateExtRegisterBlocks();
} }
WiiMoteEmu::UpdateEeprom(); WiiMoteEmu::UpdateEeprom();
} }
@ -634,7 +634,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
} }
// Show the encrypted data // Show the encrypted data
INFO_LOG(CONSOLE, "%s", TmpData.c_str()); DEBUG_LOG(WIIMOTE, "%s", TmpData.c_str());
} }
break; break;
@ -676,16 +676,16 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
break; break;
default: default:
//PanicAlert("%s ReadDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]); //PanicAlert("%s ReadDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]);
INFO_LOG(CONSOLE, "%s ReadDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]); DEBUG_LOG(WIIMOTE, "%s ReadDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]);
return; return;
} }
if (!DataReport && g_DebugComm) if (!DataReport && g_DebugComm)
{ {
std::string tmpData = ArrayToString(data, size + 2, 0, 30); std::string tmpData = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 3, " Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "Read[%s] %s: %s\n", (Emu ? "Emu" : "Real"), Name.c_str(), tmpData.c_str()); // No timestamp DEBUG_LOG(WIIMOTE, "Read[%s] %s: %s", (Emu ? "Emu" : "Real"), Name.c_str(), tmpData.c_str()); // No timestamp
//INFO_LOG(CONSOLE, " (%s): %s\n", Tm(true).c_str(), Temp.c_str()); // Timestamp //DEBUG_LOG(WIIMOTE, " (%s): %s", Tm(true).c_str(), Temp.c_str()); // Timestamp
} }
if (DataReport && g_DebugData) if (DataReport && g_DebugData)
@ -698,7 +698,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
// Produce string // Produce string
//std::string TmpData = ArrayToString(data, size + 2, 0, 30); //std::string TmpData = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 3, " Data: %s", Temp.c_str());
std::string TmpCore = "", TmpAccel = "", TmpIR = "", TmpExt = "", CCData = ""; std::string TmpCore = "", TmpAccel = "", TmpIR = "", TmpExt = "", CCData = "";
TmpCore = StringFromFormat( TmpCore = StringFromFormat(
"%02x %02x %02x %02x", "%02x %02x %02x %02x",
@ -796,24 +796,24 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
// ------------------------- // -------------------------
// Classic Controller data // Classic Controller data
INFO_LOG(CONSOLE, "Read[%s]: %s | %s | %s | %s | %s\n", (Emu ? "Emu" : "Real"), DEBUG_LOG(WIIMOTE, "Read[%s]: %s | %s | %s | %s | %s", (Emu ? "Emu" : "Real"),
TmpCore.c_str(), TmpAccel.c_str(), TmpIR.c_str(), TmpExt.c_str(), CCData.c_str()); TmpCore.c_str(), TmpAccel.c_str(), TmpIR.c_str(), TmpExt.c_str(), CCData.c_str());
// Formatted data only // Formatted data only
//INFO_LOG(CONSOLE, "Read[%s]: 0x%02x | %s | %s | %s\n", (Emu ? "Emu" : "Real"), data[1], RollPitch.c_str(), GForce.c_str(), IRData.c_str()); //DEBUG_LOG(WIIMOTE, "Read[%s]: 0x%02x | %s | %s | %s", (Emu ? "Emu" : "Real"), data[1], RollPitch.c_str(), GForce.c_str(), IRData.c_str());
// IR data // IR data
//INFO_LOG(CONSOLE, "Read[%s]: %s | %s\n", (Emu ? "Emu" : "Real"), TmpData.c_str(), IRData.c_str()); //DEBUG_LOG(WIIMOTE, "Read[%s]: %s | %s", (Emu ? "Emu" : "Real"), TmpData.c_str(), IRData.c_str());
// Accelerometer data // Accelerometer data
//INFO_LOG(CONSOLE, "Read[%s]: %s | %s | %s | %s | %s | %s | %s\n", (Emu ? "Emu" : "Real"), //DEBUG_LOG(WIIMOTE, "Read[%s]: %s | %s | %s | %s | %s | %s | %s", (Emu ? "Emu" : "Real"),
// TmpCore.c_str(), TmpAccel.c_str(), TmpIR.c_str(), TmpExt.c_str(), RollPitch.c_str(), GForce.c_str(), CCData.c_str()); // TmpCore.c_str(), TmpAccel.c_str(), TmpIR.c_str(), TmpExt.c_str(), RollPitch.c_str(), GForce.c_str(), CCData.c_str());
// Timestamp // Timestamp
//INFO_LOG(CONSOLE, " (%s): %s\n", Tm(true).c_str(), Temp.c_str()); //DEBUG_LOG(WIIMOTE, " (%s): %s", Tm(true).c_str(), Temp.c_str());
} }
if(g_DebugAccelerometer) if(g_DebugAccelerometer)
{ {
// Accelerometer only // Accelerometer only
// Console::ClearScreen(); // Console::ClearScreen();
INFO_LOG(CONSOLE, "Accel x, y, z: %03u %03u %03u\n", data[4], data[5], data[6]); DEBUG_LOG(WIIMOTE, "Accel x, y, z: %03u %03u %03u", data[4], data[5], data[6]);
} }
} }
@ -872,18 +872,18 @@ void InterruptDebugging(bool Emu, const void* _pData)
Name.append(" REG_SPEAKER"); Name.append(" REG_SPEAKER");
if(data[6] == 7) if(data[6] == 7)
{ {
INFO_LOG(CONSOLE, "\nSound configuration:\n"); DEBUG_LOG(WIIMOTE, "Sound configuration:");
if(data[8] == 0x00) if(data[8] == 0x00)
{ {
memcpy(&SampleValue, &data[9], 2); memcpy(&SampleValue, &data[9], 2);
INFO_LOG(CONSOLE, " Data format: 4-bit ADPCM (%i Hz)\n", 6000000 / SampleValue); DEBUG_LOG(WIIMOTE, " Data format: 4-bit ADPCM (%i Hz)", 6000000 / SampleValue);
INFO_LOG(CONSOLE, " Volume: %02i%%\n\n", (data[11] / 0x40) * 100); DEBUG_LOG(WIIMOTE, " Volume: %02i%%", (data[11] / 0x40) * 100);
} }
else if (data[8] == 0x40) else if (data[8] == 0x40)
{ {
memcpy(&SampleValue, &data[9], 2); memcpy(&SampleValue, &data[9], 2);
INFO_LOG(CONSOLE, " Data format: 8-bit PCM (%i Hz)\n", 12000000 / SampleValue); DEBUG_LOG(WIIMOTE, " Data format: 8-bit PCM (%i Hz)", 12000000 / SampleValue);
INFO_LOG(CONSOLE, " Volume: %02i%%\n\n", (data[11] / 0xff) * 100); DEBUG_LOG(WIIMOTE, " Volume: %02i%%", (data[11] / 0xff) * 100);
} }
} }
} }
@ -897,7 +897,7 @@ void InterruptDebugging(bool Emu, const void* _pData)
WiiMoteEmu::g_Encryption = true; WiiMoteEmu::g_Encryption = true;
else if (data[7] == 0x55) else if (data[7] == 0x55)
WiiMoteEmu::g_Encryption = false; WiiMoteEmu::g_Encryption = false;
INFO_LOG(CONSOLE, "\nExtension enryption turned %s\n\n", WiiMoteEmu::g_Encryption ? "On" : "Off"); DEBUG_LOG(WIIMOTE, "Extension enryption turned %s", WiiMoteEmu::g_Encryption ? "On" : "Off");
} }
break; break;
case 0xb0: case 0xb0:
@ -942,9 +942,9 @@ void InterruptDebugging(bool Emu, const void* _pData)
if (g_DebugComm) Name.append("WM_SPEAKER"); if (g_DebugComm) Name.append("WM_SPEAKER");
size = 1; size = 1;
if(data[1] == 0x14) { if(data[1] == 0x14) {
INFO_LOG(CONSOLE, "\nSpeaker %s\n\n", (data[2] == 0x06) ? "On" : "Off"); DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] == 0x06) ? "On" : "Off");
} else if(data[1] == 0x19) { } else if(data[1] == 0x19) {
INFO_LOG(CONSOLE, "\nSpeaker %s\n\n", (data[2] == 0x06) ? "Muted" : "Unmuted"); DEBUG_LOG(WIIMOTE, "Speaker %s", (data[2] == 0x06) ? "Muted" : "Unmuted");
} }
break; break;
case WM_WRITE_SPEAKER_DATA: // 0x18 case WM_WRITE_SPEAKER_DATA: // 0x18
@ -954,22 +954,22 @@ void InterruptDebugging(bool Emu, const void* _pData)
default: default:
size = 15; size = 15;
INFO_LOG(CONSOLE, "%s InterruptDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]); DEBUG_LOG(WIIMOTE, "%s InterruptDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]);
break; break;
} }
if (g_DebugComm && !SoundData) if (g_DebugComm && !SoundData)
{ {
std::string Temp = ArrayToString(data, size + 2, 0, 30); std::string Temp = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 3, " Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "%s: %s\n", Name.c_str(), Temp.c_str()); // No timestamp DEBUG_LOG(WIIMOTE, "%s: %s", Name.c_str(), Temp.c_str()); // No timestamp
//INFO_LOG(CONSOLE, " (%s): %s\n", Tm(true).c_str(), Temp.c_str()); // Timestamp //DEBUG_LOG(WIIMOTE, " (%s): %s", Tm(true).c_str(), Temp.c_str()); // Timestamp
} }
if (g_DebugSoundData && SoundData) if (g_DebugSoundData && SoundData)
{ {
std::string Temp = ArrayToString(data, size + 2, 0, 30); std::string Temp = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); //LOGV(WIIMOTE, 3, " Data: %s", Temp.c_str());
INFO_LOG(CONSOLE, "%s: %s\n", Name.c_str(), Temp.c_str()); // No timestamp DEBUG_LOG(WIIMOTE, "%s: %s", Name.c_str(), Temp.c_str()); // No timestamp
//INFO_LOG(CONSOLE, " (%s): %s\n", Tm(true).c_str(), Temp.c_str()); // Timestamp //DEBUG_LOG(WIIMOTE, " (%s): %s", Tm(true).c_str(), Temp.c_str()); // Timestamp
} }
} }
@ -996,7 +996,7 @@ int GetUpdateRate()
// Calculate the time and save it // Calculate the time and save it
int Time = (int)(10 / (Common::Timer::GetDoubleTime() - g_UpdateTime)); int Time = (int)(10 / (Common::Timer::GetDoubleTime() - g_UpdateTime));
g_UpdateTimeList.push_back(Time); g_UpdateTimeList.push_back(Time);
//INFO_LOG(CONSOLE, "Time: %i %f\n", Time, Common::Timer::GetDoubleTime()); //DEBUG_LOG(WIIMOTE, "Time: %i %f", Time, Common::Timer::GetDoubleTime());
int TotalTime = 0; int TotalTime = 0;
for (int i = 0; i < (int)g_UpdateTimeList.size(); i++) for (int i = 0; i < (int)g_UpdateTimeList.size(); i++)

View File

@ -105,7 +105,7 @@ void SendData(u16 _channelID, const u8* _pData, u32 _Size)
// Debugging // Debugging
//std::string Temp = ArrayToString(WriteEvent.m_PayLoad, 28, 0, 30); //std::string Temp = ArrayToString(WriteEvent.m_PayLoad, 28, 0, 30);
//INFO_LOG(CONSOLE, "Wiimote Write:\n%s\n", Temp.c_str()); //DEBUG_LOG(WIIMOTE, "Wiimote Write:\n%s", Temp.c_str());
} }
m_pCriticalSection->Leave(); m_pCriticalSection->Leave();
} }
@ -119,7 +119,7 @@ void ReadData()
// Send data to the Wiimote // Send data to the Wiimote
if (!m_EventWriteQueue.empty()) if (!m_EventWriteQueue.empty())
{ {
//INFO_LOG(CONSOLE, "Writing data to the Wiimote\n"); //DEBUG_LOG(WIIMOTE, "Writing data to the Wiimote");
SEvent& rEvent = m_EventWriteQueue.front(); SEvent& rEvent = m_EventWriteQueue.front();
wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, MAX_PAYLOAD); wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, MAX_PAYLOAD);
m_EventWriteQueue.pop(); m_EventWriteQueue.pop();
@ -134,6 +134,7 @@ void ReadData()
m_pCriticalSection->Leave(); m_pCriticalSection->Leave();
// Read data from wiimote (but don't send it to the core, just filter and queue) // Read data from wiimote (but don't send it to the core, just filter and queue)
if (wiiuse_io_read(m_pWiiMote)) if (wiiuse_io_read(m_pWiiMote))
{ {
@ -263,7 +264,7 @@ void SendAcc(u8 _ReportID)
wiiuse_io_write(WiiMoteReal::g_WiiMotesFromWiiUse[0], (byte*)DataAcc, MAX_PAYLOAD); wiiuse_io_write(WiiMoteReal::g_WiiMotesFromWiiUse[0], (byte*)DataAcc, MAX_PAYLOAD);
std::string Temp = ArrayToString(DataAcc, 28, 0, 30); std::string Temp = ArrayToString(DataAcc, 28, 0, 30);
INFO_LOG(CONSOLE, "SendAcc: %s\n", Temp.c_str()); DEBUG_LOG(WIIMOTE, "SendAcc: %s", Temp.c_str());
//22 00 00 _reportID 00 //22 00 00 _reportID 00
} }
@ -311,7 +312,7 @@ int Initialize()
g_WiiMotesFromWiiUse = wiiuse_init(MAX_WIIMOTES); g_WiiMotesFromWiiUse = wiiuse_init(MAX_WIIMOTES);
g_NumberOfWiiMotes = wiiuse_find(g_WiiMotesFromWiiUse, MAX_WIIMOTES, 5); g_NumberOfWiiMotes = wiiuse_find(g_WiiMotesFromWiiUse, MAX_WIIMOTES, 5);
if (g_NumberOfWiiMotes > 0) g_RealWiiMotePresent = true; if (g_NumberOfWiiMotes > 0) g_RealWiiMotePresent = true;
INFO_LOG(CONSOLE, "Found No of Wiimotes: %i\n", g_NumberOfWiiMotes); DEBUG_LOG(WIIMOTE, "Found No of Wiimotes: %i", g_NumberOfWiiMotes);
for (int i = 0; i < g_NumberOfWiiMotes; i++) for (int i = 0; i < g_NumberOfWiiMotes; i++)
{ {
@ -324,11 +325,16 @@ int Initialize()
// Set flags // Set flags
//wiiuse_set_flags(g_WiiMotesFromWiiUse[i], NULL, WIIUSE_SMOOTHING); //wiiuse_set_flags(g_WiiMotesFromWiiUse[i], NULL, WIIUSE_SMOOTHING);
} }
// psyjoe reports this allows majority of lost packets to be transferred.
// Will test soon
//wiiuse_set_timeout(g_WiiMotesFromWiiUse, g_NumberOfWiiMotes, 220, 220);
// WiiUse initializes the Wiimotes in Windows right from the wiiuse_find function // WiiUse initializes the Wiimotes in Windows right from the wiiuse_find function
// The Functionality should REALLY be changed // The Functionality should REALLY be changed
#ifndef _WIN32 #ifndef _WIN32
int Connect = wiiuse_connect(g_WiiMotesFromWiiUse, MAX_WIIMOTES); int Connect = wiiuse_connect(g_WiiMotesFromWiiUse, MAX_WIIMOTES);
INFO_LOG(CONSOLE, "Connected: %i\n", Connect); DEBUG_LOG(WIIMOTE, "Connected: %i", Connect);
#endif #endif
// If we are connecting from the config window without a game running we flash the lights // If we are connecting from the config window without a game running we flash the lights
@ -403,14 +409,14 @@ void Shutdown(void)
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
//INFO_LOG(CONSOLE, "Real InterruptChannel\n"); //DEBUG_LOG(WIIMOTE, "Real InterruptChannel");
// TODO: Update for multiple Wiimotes // TODO: Update for multiple Wiimotes
g_WiiMotes[0]->SendData(_channelID, (const u8*)_pData, _Size); g_WiiMotes[0]->SendData(_channelID, (const u8*)_pData, _Size);
} }
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
//INFO_LOG(CONSOLE, "Real ControlChannel\n"); //DEBUG_LOG(WIIMOTE, "Real ControlChannel");
g_WiiMotes[0]->SendData(_channelID, (const u8*)_pData, _Size); g_WiiMotes[0]->SendData(_channelID, (const u8*)_pData, _Size);
} }
@ -418,7 +424,7 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
// Read the Wiimote once // Read the Wiimote once
void Update() void Update()
{ {
//INFO_LOG(CONSOLE, "Real Update\n"); //DEBUG_LOG(WIIMOTE, "Real Update");
for (int i = 0; i < g_NumberOfWiiMotes; i++) for (int i = 0; i < g_NumberOfWiiMotes; i++)
{ {
g_WiiMotes[i]->Update(); g_WiiMotes[i]->Update();