Wiimote: Added logging messages for the speaker configuration and for the 0x18 sound reports, the speaker currently produce a low humming noise in the wpad tools demo, but no real sound

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2141 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-08 10:15:55 +00:00
parent 6ecbc237db
commit e926bc61d1
9 changed files with 79 additions and 24 deletions

View file

@ -474,7 +474,10 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
break;
case L2CAP_COMMAND_REJ:
PanicAlert("SignalChannel - L2CAP_COMMAND_REJ (something went wrong)",pCommand->code);
PanicAlert(
"SignalChannel - L2CAP_COMMAND_REJ (something went wrong). Try to replace your"
"SYSCONF file with a new copy."
,pCommand->code);
break;
default:

View file

@ -228,7 +228,6 @@ Global
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|x64.ActiveCfg = DebugFast|x64
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|Win32.ActiveCfg = Release|Win32
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|Win32.Build.0 = Release|Win32
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|x64.ActiveCfg = Release|x64
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release|x64.Build.0 = Release|x64
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}.Debug|Win32.ActiveCfg = Debug|Win32

View file

@ -99,9 +99,11 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
#endif
}
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
}
void DllConfig(HWND _hParent)
{
#if defined(_WIN32)
@ -296,6 +298,7 @@ void Shutdown(void)
OpenGL_Shutdown();
}
void Video_Stop(void)
{
Fifo_Stop();

View file

@ -358,7 +358,9 @@ void Shutdown(void)
// ===================================================
/* An ack delay of 1 was not small enough, but 2 seemed to work, that was about between 20 ms and
100 ms in my case. I'm not sure what it means in frame delays. */
100 ms in my case in Zelda - TP. You may have to increase this value for other things to work, for
example in the wpad demo I had to set it to at least 3 for the Sound to be able to turned on (I have
an update rate of around 150 fps in the wpad demo) */
// ----------------
void CreateAckDelay(u8 _ChannelID, u16 _ReportID)
{
@ -435,7 +437,9 @@ void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
// There are no 0x22 replys to these report from the real wiimote from what I could see
// Report 0x10 that seems to be only used for rumble
if(!(data[1] == WM_READ_DATA && data[2] == 0x00) && !(data[1] == WM_REQUEST_STATUS))
if(!(data[1] == WM_READ_DATA && data[2] == 0x00)
&& !(data[1] == WM_REQUEST_STATUS)
&& !(data[1] == WM_WRITE_SPEAKER_DATA))
if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent) CreateAckDelay((u8)_channelID, (u16)sr->channel);
}
break;

View file

@ -127,6 +127,8 @@ void HidOutputReport(u16 _channelID, wm_report* sr) {
if(sr->data[0] == 0x02) g_SpeakerVoice = 0; // g_SpeakerVoice
else if(sr->data[0] == 0x06) g_SpeakerVoice = 1;
break;
case WM_WRITE_SPEAKER_DATA: // 0x18
break;
default:
PanicAlert("HidOutputReport: Unknown channel 0x%02x", sr->channel);
return;

View file

@ -78,6 +78,7 @@ nu_cal g_nu;
bool g_DebugAccelerometer = false;
bool g_DebugData = false;
bool g_DebugComm = true;
bool g_DebugSoundData = true;
bool g_DebugCustom = false;
// Update speed
@ -639,6 +640,8 @@ void InterruptDebugging(bool Emu, const void* _pData)
std::string Name;
int size;
u16 SampleValue;
bool SoundData = false;
if (g_DebugComm) Name += StringFromFormat("Write[%s] ", (Emu ? "Emu" : "Real"));
@ -676,7 +679,30 @@ void InterruptDebugging(bool Emu, const void* _pData)
switch(data[3])
{
case 0xa2:
if (g_DebugComm) Name.append(" REG_SPEAKER"); break;
// data[8]: FF, 0x00 or 0x40
// data[9, 10]: RR RR, 0xd007 or 0x401f
// data[11]: VV, 0x00 to 0xff or 0x00 to 0x40
if (g_DebugComm)
{
Name.append(" REG_SPEAKER");
if(data[6] == 7)
{
Console::Print("\nSound configuration:\n");
if(data[8] == 0x00)
{
memcpy(&SampleValue, &data[9], 2);
Console::Print(" Data format: 4-bit ADPCM (%i Hz)\n", 6000000 / SampleValue);
Console::Print(" Volume: %02i%%\n\n", (data[11] / 0x40) * 100);
}
else if (data[8] == 0x40)
{
memcpy(&SampleValue, &data[9], 2);
Console::Print(" Data format: 8-bit PCM (%i Hz)\n", 12000000 / SampleValue);
Console::Print(" Volume: %02i%%\n\n", (data[11] / 0xff) * 100);
}
}
}
break;
case 0xa4:
if (g_DebugComm) Name.append(" REG_EXT");
// Update the encryption mode
@ -720,28 +746,42 @@ void InterruptDebugging(bool Emu, const void* _pData)
break;
}
break;
case WM_IR_PIXEL_CLOCK: // 0x13
case WM_IR_LOGIC: // 0x1a
if (g_DebugComm) Name.append("WM_IR");
size = 1;
break;
case WM_SPEAKER_ENABLE: // 0x14
case WM_SPEAKER_MUTE:
case WM_SPEAKER_MUTE: // 0x19
if (g_DebugComm) Name.append("WM_SPEAKER");
size = 1;
break;
case WM_WRITE_SPEAKER_DATA: // 0x18
if (g_DebugComm) Name.append("WM_SPEAKER_DATA");
size = 21;
break;
default:
size = 15;
Console::Print("%s InterruptDebugging: Unknown channel 0x%02x", (Emu ? "Emu" : "Real"), data[1]);
break;
}
if (g_DebugComm)
if (g_DebugComm && !SoundData)
{
std::string Temp = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
Console::Print("%s: %s\n", Name.c_str(), Temp.c_str()); // No timestamp
//Console::Print(" (%s): %s\n", Tm(true).c_str(), Temp.c_str()); // Timestamp
}
if (g_DebugSoundData && SoundData)
{
std::string Temp = ArrayToString(data, size + 2, 0, 30);
//LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str());
Console::Print("%s: %s\n", Name.c_str(), Temp.c_str()); // No timestamp
//Console::Print(" (%s): %s\n", Tm(true).c_str(), Temp.c_str()); // Timestamp
}
}
@ -812,7 +852,7 @@ void DoInitialize()
// Debugging window
// ----------
/*Console::Open(130, 1000, "Wiimote"); // give room for 20 rows
Console::Print("\n\n\nWiimote console opened\n");
Console::Print("\n\nWiimote console opened\n");
// Move window
//MoveWindow(Console::GetHwnd(), 0,400, 100*8,10*14, true); // small window

View file

@ -84,6 +84,7 @@ struct SRecordingAll
extern bool g_DebugAccelerometer;
extern bool g_DebugData;
extern bool g_DebugComm;
extern bool g_DebugSoundData;
extern bool g_DebugCustom;
// Update speed

View file

@ -107,7 +107,6 @@ struct wm_acknowledge
u8 errorID;
};
#define WM_READ_DATA 0x17
struct wm_read_data {
u8 rumble : 1;
@ -284,6 +283,7 @@ struct wm_report_ext21
#define WM_SPEAKER_ENABLE 0x14
#define WM_SPEAKER_MUTE 0x19
#define WM_WRITE_SPEAKER_DATA 0x18
//******************************************************************************

View file

@ -590,26 +590,29 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
Pad_Use_Rumble(_numPAD, _pPADStatus);
/* Debugging
Console::ClearScreen();
Console::Print(
"Pad %i: %i %i\n"
"State: L:%i R:%i HalfPress:%i\n"
"Trigger type: %s StatusLeft:%04x StatusRight:%04x TriggerLeft:%04x TriggerRight:%04x TriggerValue:%i\n"
"Buttons: %i X:%i\n"
"D-Pad type: %s L:%i R:%i U:%i D:%i",
if(_numPAD == 1)
{
Console::ClearScreen();
Console::Print(
"Pad %i: %i %i\n"
"State: L:%i R:%i HalfPress:%i\n"
"Trigger type: %s StatusLeft:%04x StatusRight:%04x TriggerLeft:%04x TriggerRight:%04x TriggerValue:%i\n"
"Buttons: %i X:%i\n"
"D-Pad type: %s L:%i R:%i U:%i D:%i",
_numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy,
_numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy,
PadState[_numPAD].buttons[CTL_L_SHOULDER], PadState[_numPAD].buttons[CTL_R_SHOULDER], PadState[_numPAD].halfpress,
PadState[_numPAD].buttons[CTL_L_SHOULDER], PadState[_numPAD].buttons[CTL_R_SHOULDER], PadState[_numPAD].halfpress,
(PadMapping[_numPAD].triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
_pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue,
(PadMapping[_numPAD].triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
_pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue,
_pPADStatus->button, PadState[_numPAD].buttons[CTL_X_BUTTON],
_pPADStatus->button, PadState[_numPAD].buttons[CTL_X_BUTTON],
(PadMapping[_numPAD].controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
0, 0, 0, 0
);*/
(PadMapping[_numPAD].controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
0, 0, 0, 0
);
}*/
}