added reset to WII IPC HLE so all devices are closed

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2409 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fires.gc 2009-02-24 07:23:17 +00:00
parent 595dc42dcb
commit 772e37be9a
2 changed files with 30 additions and 6 deletions

View File

@ -178,7 +178,6 @@ void HWCALL Write32(const u32 _Value, const u32 _Address)
g_IPC_Control.unk5 = TempControl.unk5;
g_IPC_Control.unk6 = TempControl.unk6;
g_IPC_Control.pad = TempControl.pad;
if (TempControl.ExecuteCmd)
{
WII_IPC_HLE_Interface::AckCommand(g_Address);
@ -199,6 +198,13 @@ void HWCALL Write32(const u32 _Value, const u32 _Address)
{
LOG(WII_IPC, "IOP: Write32 to IPC_CONFIG_REGISTER(0x33) = 0x%08x", _Value);
g_IPC_Config.Hex = _Value;
if (_Value&0x40000000)
{
WII_IPC_HLE_Interface::Reset();
}
}
break;

View File

@ -63,6 +63,7 @@
#include "../HW/Memmap.h"
#include "../HW/WII_IPC.h"
#include "../Debugger/Debugger_SymbolMap.h"
#include "../PowerPC/PowerPC.h"
namespace WII_IPC_HLE_Interface
{
@ -74,6 +75,7 @@ TDeviceMap g_DeviceMap;
// STATE_TO_SAVE
u32 g_LastDeviceID = 0x13370000;
std::list<u32> g_Ack;
u32 g_AckNumber = 0;
std::queue<std::pair<u32,std::string> > g_ReplyQueue;
void ExecuteCommand(u32 _Address);
@ -83,7 +85,7 @@ void Init()
_dbg_assert_msg_(WII_IPC, g_DeviceMap.empty(), "DeviceMap isnt empty on init");
}
void Shutdown()
void Reset()
{
TDeviceMap::const_iterator itr = g_DeviceMap.begin();
while(itr != g_DeviceMap.end())
@ -91,7 +93,21 @@ void Shutdown()
delete itr->second;
++itr;
}
g_DeviceMap.clear();
g_DeviceMap.clear();
while(!g_ReplyQueue.empty())
{
g_ReplyQueue.pop();
}
g_Ack.clear();
}
void Shutdown()
{
Reset();
g_LastDeviceID = 0x13370000;
g_AckNumber = 0;
}
u32 GetDeviceIDByName(const std::string& _rDeviceName)
@ -208,8 +224,8 @@ IWII_IPC_HLE_Device* CreateDevice(u32 _DeviceID, const std::string& _rDeviceName
// ----------------
bool AckCommand(u32 _Address)
{
Debugger::PrintCallstack(LogTypes::WII_IPC_HLE);
LOGV(WII_IPC_HLE, 1, "AckCommand: 0%08x", _Address);
Debugger::PrintCallstack(LogTypes::WII_IPC_HLE);
LOGV(WII_IPC_HLE, 1, "AckCommand: 0%08x (num: %i) PC=0x%08x", _Address, g_AckNumber, PC);
std::list<u32>::iterator itr = g_Ack.begin();
while (itr != g_Ack.end())
@ -224,6 +240,7 @@ bool AckCommand(u32 _Address)
}
g_Ack.push_back(_Address);
g_AckNumber++;
return true;
}
@ -476,8 +493,9 @@ void Update()
{
u32 _Address = g_Ack.front();
g_Ack.pop_front();
LOGV(WII_IPC_HLE, 1, "-- Exeute Ack (0x%08x)", _Address);
ExecuteCommand(_Address);
LOGV(WII_IPC_HLE, 1, "-- Generate Ack (0x%08x)", _Address);
LOGV(WII_IPC_HLE, 1, "-- End of ExecuteAck (0x%08x)", _Address);
// Go back to WII_IPC.cpp and generate an acknowledgement
WII_IPCInterface::GenerateAck(_Address);