EXPERIMENTAL: an attempt to fix Issue 1725

Please test, especially on multi-Wiimote.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5024 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2010-02-07 06:07:56 +00:00
parent 13437c1f6b
commit 0978551269
6 changed files with 45 additions and 4 deletions

View File

@ -39,7 +39,7 @@ void AudioCommonConfig::Set(IniFile &file) {
file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic);
file.Set("Config", "EnableThrottle", m_EnableThrottle); file.Set("Config", "EnableThrottle", m_EnableThrottle);
file.Set("Config", "Backend", sBackend); file.Set("Config", "Backend", sBackend);
file.Set("Config", "Volume", m_Volume); // file.Set("Config", "Volume", m_Volume);
} }
// Update according to the values (stream/mixer) // Update according to the values (stream/mixer)

View File

@ -90,6 +90,8 @@ u32 g_Address = NULL;
u32 g_Reply = NULL; u32 g_Reply = NULL;
u32 g_ReplyHead = NULL; u32 g_ReplyHead = NULL;
u32 g_ReplyTail = NULL; u32 g_ReplyTail = NULL;
u32 g_ReplyNum = NULL;
u32 g_ReplyFifo[REPLY_FIFO_DEPTH] = {0};
u32 g_SensorBarPower = NULL; u32 g_SensorBarPower = NULL;
UIPC_Status g_IPC_Status(NULL); UIPC_Status g_IPC_Status(NULL);
UIPC_Config g_IPC_Config(NULL); UIPC_Config g_IPC_Config(NULL);
@ -102,6 +104,8 @@ void DoState(PointerWrap &p)
p.Do(g_Reply); p.Do(g_Reply);
p.Do(g_ReplyHead); p.Do(g_ReplyHead);
p.Do(g_ReplyTail); p.Do(g_ReplyTail);
p.Do(g_ReplyNum);
p.DoArray(g_ReplyFifo, REPLY_FIFO_DEPTH);
p.Do(g_SensorBarPower); p.Do(g_SensorBarPower);
p.Do(g_IPC_Status); p.Do(g_IPC_Status);
p.Do(g_IPC_Config); p.Do(g_IPC_Config);
@ -116,6 +120,7 @@ void Init()
g_Reply = NULL; g_Reply = NULL;
g_ReplyHead = NULL; g_ReplyHead = NULL;
g_ReplyTail = NULL; g_ReplyTail = NULL;
g_ReplyNum = NULL;
g_SensorBarPower = NULL; g_SensorBarPower = NULL;
g_IPC_Status = UIPC_Status(NULL); g_IPC_Status = UIPC_Status(NULL);
g_IPC_Config = UIPC_Config(NULL); g_IPC_Config = UIPC_Config(NULL);
@ -259,6 +264,7 @@ void GenerateReply(u32 _Address)
void EnqReply(u32 _Address) void EnqReply(u32 _Address)
{ {
/*
// AyuanX: Replies are stored in a FIFO (depth 2), like ping-pong, and 2 is fairly enough // AyuanX: Replies are stored in a FIFO (depth 2), like ping-pong, and 2 is fairly enough
// Simple structure of fixed length will do good for DoState // Simple structure of fixed length will do good for DoState
// //
@ -272,10 +278,23 @@ void EnqReply(u32 _Address)
ERROR_LOG(WII_IPC, "Reply FIFO is full, something must be wrong!"); ERROR_LOG(WII_IPC, "Reply FIFO is full, something must be wrong!");
PanicAlert("WII_IPC: Reply FIFO is full, something must be wrong!"); PanicAlert("WII_IPC: Reply FIFO is full, something must be wrong!");
} }
*/
if (g_ReplyNum < REPLY_FIFO_DEPTH)
{
g_ReplyFifo[g_ReplyTail++] = _Address;
g_ReplyTail &= REPLY_FIFO_MASK;
g_ReplyNum++;
}
else
{
ERROR_LOG(WII_IPC, "Reply FIFO is full, something must be wrong!");
PanicAlert("WII_IPC: Reply FIFO is full, something must be wrong!");
}
} }
u32 DeqReply() u32 DeqReply()
{ {
/*
u32 _Address = (g_ReplyHead) ? g_ReplyHead : g_ReplyTail; u32 _Address = (g_ReplyHead) ? g_ReplyHead : g_ReplyTail;
if (g_ReplyHead) if (g_ReplyHead)
@ -283,6 +302,21 @@ u32 DeqReply()
else else
g_ReplyTail = NULL; g_ReplyTail = NULL;
return _Address;
*/
u32 _Address;
if (g_ReplyNum)
{
_Address = g_ReplyFifo[g_ReplyHead++];
g_ReplyHead &= REPLY_FIFO_MASK;
g_ReplyNum--;
}
else
{
_Address = NULL;
}
return _Address; return _Address;
} }

View File

@ -23,6 +23,9 @@ class PointerWrap;
namespace WII_IPCInterface namespace WII_IPCInterface
{ {
#define REPLY_FIFO_DEPTH (8)
#define REPLY_FIFO_MASK (REPLY_FIFO_DEPTH - 1)
void Init(); void Init();
void Reset(); void Reset();
void Shutdown(); void Shutdown();

View File

@ -469,7 +469,7 @@ void Update()
INFO_LOG(WII_IPC_HLE, "||-- Acknowledge Command Address: 0x%08x", _Address); INFO_LOG(WII_IPC_HLE, "||-- Acknowledge Command Address: 0x%08x", _Address);
ExecuteCommand(_Address); ExecuteCommand(_Address);
/*
// AyuanX: Since current HLE time slot is empty, we can piggyback a reply // AyuanX: Since current HLE time slot is empty, we can piggyback a reply
// Besides, this trick makes a Ping-Pong Reply FIFO never get full // Besides, this trick makes a Ping-Pong Reply FIFO never get full
// I don't know whether original hardware supports this feature or not // I don't know whether original hardware supports this feature or not
@ -481,7 +481,7 @@ void Update()
WII_IPCInterface::GenerateReply(_Reply); WII_IPCInterface::GenerateReply(_Reply);
INFO_LOG(WII_IPC_HLE, "<<-- Reply to Command Address: 0x%08x", _Reply); INFO_LOG(WII_IPC_HLE, "<<-- Reply to Command Address: 0x%08x", _Reply);
} }
*/
#if MAX_LOG_LEVEL >= DEBUG_LEVEL #if MAX_LOG_LEVEL >= DEBUG_LEVEL
Debugger::PrintCallstack(LogTypes::WII_IPC_HLE, LogTypes::LDEBUG); Debugger::PrintCallstack(LogTypes::WII_IPC_HLE, LogTypes::LDEBUG);
#endif #endif

View File

@ -643,8 +643,9 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
case WM_USER_STOP: case WM_USER_STOP:
main_frame->DoStop(); main_frame->DoStop();
} break;
#endif #endif
}
} }
void CFrame::OnCustomHostMessage(int Id) void CFrame::OnCustomHostMessage(int Id)

View File

@ -232,6 +232,9 @@ std::string VKToString(int keycode)
case VK_OEM_COMMA: return ","; case VK_OEM_COMMA: return ",";
case VK_OEM_PERIOD: return "."; case VK_OEM_PERIOD: return ".";
case VK_BROWSER_BACK: return "Nav Bwd";
case VK_BROWSER_FORWARD: return "Nav Fwd";
//default: return KeyString = KeyStr; //default: return KeyString = KeyStr;
} }