1. Fixed the unbearable noise in "Resident Evil: Umbrella Chronicles", "Resident Evil: Dark Chronicles", and many other games.

No need to use "Sound Loop Hack", so I just removed it.

2. Fixed the WAD game loading issue. What can I say, I have to go though and patch all the WII_IPC_HLE devices to take care of this.

3. Applied tomman's Linux keyboard patch, but I can't test here, no suitable environment.

4. Disabled configuration dialogs when game is running, you have to pause game first to be able to change any configuration. (Which prevents some accidental crash to happen.)

5. Other trivial fixes, no need to mention.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4632 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2009-12-01 15:39:37 +00:00
parent 9e17ee5155
commit 4d512ecba7
27 changed files with 163 additions and 135 deletions

View File

@ -108,9 +108,13 @@ void Reset(bool _bHard)
TDeviceMap::iterator itr = g_DeviceMap.begin();
while (itr != g_DeviceMap.end())
{
// Hardware should not be deleted unless it is a hard reset
if (_bHard || !itr->second->IsHardware())
delete itr->second;
if (itr->second)
{
itr->second->Close(NULL, true);
// Hardware should not be deleted unless it is a hard reset
if (_bHard || !itr->second->IsHardware())
delete itr->second;
}
++itr;
}
// Erase invalid device
@ -220,7 +224,8 @@ void DoState(PointerWrap &p)
TFileNameMap::const_iterator itr = g_FileNameMap.begin();
while (itr != g_FileNameMap.end())
{
delete g_DeviceMap[itr->first];
if (g_DeviceMap[itr->first])
delete g_DeviceMap[itr->first];
g_DeviceMap.erase(itr->first);
++itr;
}

View File

@ -45,7 +45,7 @@ public:
u32 GetDeviceID() const { return m_DeviceID; }
virtual bool Open(u32 _CommandAddress, u32 _Mode) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Open()", m_Name.c_str()); m_Active = true; return true; }
virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); m_Active = false; return true; }
virtual bool Close(u32 _CommandAddress, bool _bForce = false) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); m_Active = false; return true; }
virtual bool Seek(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Seek()", m_Name.c_str()); return true; }
virtual bool Read(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Read()", m_Name.c_str()); return true; }
virtual bool Write(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Write()", m_Name.c_str()); return true; }

View File

@ -64,14 +64,16 @@ bool CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress, bool _bForce)
{
if (m_pFileSystem)
{
delete m_pFileSystem;
m_pFileSystem = NULL;
}
Memory::Write_U32(0, _CommandAddress + 4);
m_ErrorStatus = 0;
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}

View File

@ -34,7 +34,7 @@ public:
virtual ~CWII_IPC_HLE_Device_di();
bool Open(u32 _CommandAddress, u32 _Mode);
bool Close(u32 _CommandAddress);
bool Close(u32 _CommandAddress, bool _bForce);
bool IOCtl(u32 _CommandAddress);
bool IOCtlV(u32 _CommandAddress);

View File

@ -39,9 +39,10 @@ public:
return true;
}
virtual bool Close(u32 _CommandAddress)
virtual bool Close(u32 _CommandAddress, bool _bForce)
{
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}

View File

@ -44,19 +44,15 @@ CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std:
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName, false) // not a real hardware
, m_pFileHandle(NULL)
, m_FileLength(0)
{
}
{}
CWII_IPC_HLE_Device_FileIO::~CWII_IPC_HLE_Device_FileIO()
{
}
{}
bool
CWII_IPC_HLE_Device_FileIO::Close(u32 _CommandAddress)
CWII_IPC_HLE_Device_FileIO::Close(u32 _CommandAddress, bool _bForce)
{
u32 DeviceID = Memory::Read_U32(_CommandAddress + 8);
INFO_LOG(WII_IPC_FILEIO, "FileIO: Close %s (DeviceID=%08x)", GetDeviceName().c_str(), DeviceID);
INFO_LOG(WII_IPC_FILEIO, "FileIO: Close %s (DeviceID=%08x)", m_Name.c_str(), m_DeviceID);
if (m_pFileHandle != NULL)
{
@ -65,7 +61,8 @@ CWII_IPC_HLE_Device_FileIO::Close(u32 _CommandAddress)
}
// Close always return 0 for success
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}

View File

@ -28,7 +28,7 @@ public:
virtual ~CWII_IPC_HLE_Device_FileIO();
bool Close(u32 _CommandAddress);
bool Close(u32 _CommandAddress, bool _bForce);
bool Open(u32 _CommandAddress, u32 _Mode);
bool Seek(u32 _CommandAddress);
bool Read(u32 _CommandAddress);

View File

@ -64,10 +64,7 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string&
{}
CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es()
{
// Leave deletion of the INANDContentLoader objects to CNANDContentManager, don't do it here!
m_NANDContent.clear();
}
{}
void CWII_IPC_HLE_Device_es::LoadWAD(const std::string& _rContentFile)
{
@ -97,7 +94,6 @@ bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode)
// scan for the title ids listed in TMDs within /title/
m_TitleIDs.clear();
m_TitleIDs.push_back(0x0000000100000002ULL);
//m_TitleIDs.push_back(0x0001000248414741ULL);
//m_TitleIDs.push_back(0x0001000248414341ULL);
@ -113,12 +109,19 @@ bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce)
{
// Leave deletion of the INANDContentLoader objects to CNANDContentManager, don't do it here!
m_NANDContent.clear();
m_ContentAccessMap.clear();
m_pContentLoader = NULL;
m_TitleIDs.clear();
m_TitleID = -1;
AccessIdentID = 0x6000000;
INFO_LOG(WII_IPC_ES, "ES: Close");
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}

View File

@ -34,7 +34,7 @@ public:
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtlV(u32 _CommandAddress);
@ -132,6 +132,7 @@ private:
std::vector<u64> m_TitleIDs;
u64 m_TitleID;
u32 AccessIdentID;
// This should only be cleared on power reset
std::string m_ContentFile;
u64 GetCurrentTitleID() const;

View File

@ -71,11 +71,11 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_fs::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_fs::Close(u32 _CommandAddress, bool _bForce)
{
// Do we even need to do anything?
INFO_LOG(WII_IPC_NET, "/dev/fs: Close");
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}

View File

@ -36,7 +36,7 @@ public:
virtual ~CWII_IPC_HLE_Device_fs();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtl(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress);

View File

@ -64,12 +64,10 @@ extern std::queue<std::pair<u32,std::string> > g_ReplyQueueLater;
// Handle /dev/net/kd/request requests
CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{
}
{}
CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request()
{
}
{}
bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode)
{
@ -79,10 +77,11 @@ bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_net_kd_request::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_net_kd_request::Close(u32 _CommandAddress, bool _bForce)
{
INFO_LOG(WII_IPC_NET, "NET_KD_REQ: Close");
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}
@ -170,10 +169,11 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_net_ncd_manage::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_net_ncd_manage::Close(u32 _CommandAddress, bool _bForce)
{
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: Close");
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}
@ -221,10 +221,11 @@ bool CWII_IPC_HLE_Device_net_ip_top::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_net_ip_top::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_net_ip_top::Close(u32 _CommandAddress, bool _bForce)
{
INFO_LOG(WII_IPC_NET, "NET_IP_TOP: Close");
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}

View File

@ -32,7 +32,7 @@ public:
virtual ~CWII_IPC_HLE_Device_net_kd_request();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtl(u32 _CommandAddress);
private:
@ -81,10 +81,11 @@ public:
return true;
}
virtual bool Close(u32 _CommandAddress)
virtual bool Close(u32 _CommandAddress, bool _bForce)
{
INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Close");
Memory::Write_U32(0, _CommandAddress + 4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
return true;
}
@ -154,7 +155,7 @@ public:
virtual ~CWII_IPC_HLE_Device_net_ip_top();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtl(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress);
@ -210,7 +211,7 @@ public:
virtual ~CWII_IPC_HLE_Device_net_ncd_manage();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtlV(u32 _CommandAddress);
private:

View File

@ -27,17 +27,19 @@
CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{
m_Card = NULL;
m_Status = CARD_INSERTED;
m_BlockLength = 0;
m_BusWidth = 0;
// Clear the whole SD Host Control Register
//Memory::Memset(SDIO_BASE, 0, 0x100);
}
, m_Card(NULL)
, m_Status(CARD_INSERTED)
, m_BlockLength(0)
, m_BusWidth(0)
{}
CWII_IPC_HLE_Device_sdio_slot0::~CWII_IPC_HLE_Device_sdio_slot0()
{
if(m_Card)
{
fclose(m_Card);
m_Card = NULL;
}
}
bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode)
@ -65,14 +67,21 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress, bool _bForce)
{
INFO_LOG(WII_IPC_SD, "Close");
if(m_Card)
{
fclose(m_Card);
m_Card = NULL;
}
m_Status = CARD_INSERTED;
m_BlockLength = 0;
m_BusWidth = 0;
Memory::Write_U32(0, _CommandAddress + 0x4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 0x4);
m_Active = false;
return true;
}

View File

@ -31,7 +31,7 @@ public:
virtual ~CWII_IPC_HLE_Device_sdio_slot0();
bool Open(u32 _CommandAddress, u32 _Mode);
bool Close(u32 _CommandAddress);
bool Close(u32 _CommandAddress, bool _bForce);
bool IOCtl(u32 _CommandAddress);
bool IOCtlV(u32 _CommandAddress);

View File

@ -47,7 +47,7 @@ public:
CWII_IPC_HLE_Device_stm_immediate(u32 _DeviceID, const std::string& _rDeviceName) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{}
{}
virtual ~CWII_IPC_HLE_Device_stm_immediate()
{}
@ -60,10 +60,11 @@ public:
return true;
}
virtual bool Close(u32 _CommandAddress)
virtual bool Close(u32 _CommandAddress, bool _bForce)
{
ERROR_LOG(WII_IPC_STM, "STM immediate: Close");
Memory::Write_U32(0, _CommandAddress+4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress+4);
m_Active = false;
return true;
}
@ -151,10 +152,13 @@ public:
return true;
}
virtual bool Close(u32 _CommandAddress)
virtual bool Close(u32 _CommandAddress, bool _bForce)
{
m_EventHookAddress = 0;
INFO_LOG(WII_IPC_STM, "STM eventhook: Close");
Memory::Write_U32(0, _CommandAddress+4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress+4);
m_Active = false;
return true;
}

View File

@ -94,9 +94,29 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Open(u32 _CommandAddress, u32 _Mode)
// ===================================================
// Close
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Close(u32 _CommandAddress, bool _bForce)
{
Memory::Write_U32(0, _CommandAddress + 4);
m_PINType = 0;
m_ScanEnable = 0;
m_EventFilterType = 0;
m_EventFilterCondition = 0;
m_HostMaxACLSize = 0;
m_HostMaxSCOSize = 0;
m_HostNumACLPackets = 0;
m_HostNumSCOPackets = 0;
m_LastCmd = NULL;
m_PacketCount = 0;
m_FreqDividerSync = 0;
m_FreqDividerMote = 0;
m_HCIBuffer.m_address = NULL;
m_HCIPool.m_number = 0;
m_ACLBuffer.m_address = NULL;
m_ACLPool.m_number = 0;
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 4);
m_Active = false;
return true;
}
@ -2128,8 +2148,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey)
//
CWII_IPC_HLE_Device_usb_oh0::CWII_IPC_HLE_Device_usb_oh0(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{
}
{}
CWII_IPC_HLE_Device_usb_oh0::~CWII_IPC_HLE_Device_usb_oh0()
{}
@ -2141,9 +2160,10 @@ bool CWII_IPC_HLE_Device_usb_oh0::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
bool CWII_IPC_HLE_Device_usb_oh0::Close(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_usb_oh0::Close(u32 _CommandAddress, bool _bForce)
{
Memory::Write_U32(0, _CommandAddress + 0x4);
if (!_bForce)
Memory::Write_U32(0, _CommandAddress + 0x4);
m_Active = false;
return true;
}

View File

@ -41,10 +41,10 @@ union UACLHeader
struct SQueuedEvent
{
u8 m_buffer[1024];
size_t m_size;
u32 m_size;
u16 m_connectionHandle;
SQueuedEvent(size_t size, u16 connectionHandle)
SQueuedEvent(u32 size, u16 connectionHandle)
: m_size(size)
, m_connectionHandle(connectionHandle)
{
@ -65,7 +65,7 @@ public:
virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtlV(u32 _CommandAddress);
virtual bool IOCtl(u32 _CommandAddress);
@ -179,8 +179,6 @@ private:
u16 m_HostNumACLPackets;
u16 m_HostNumSCOPackets;
typedef std::queue<SQueuedEvent> CEventQueue;
// STATE_TO_SAVE
SHCICommandMessage m_CtrlSetup;
CtrlBuffer m_HCIBuffer;
@ -273,7 +271,7 @@ public:
virtual ~CWII_IPC_HLE_Device_usb_oh0();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress); // hermes' dsp demo
virtual bool Close(u32 _CommandAddress, bool _bForce); // hermes' dsp demo
virtual bool IOCtlV(u32 _CommandAddress);
virtual bool IOCtl(u32 _CommandAddress);

View File

@ -894,6 +894,11 @@ void CFrame::UpdateGUI()
m_ToolBar->EnableTool(wxID_REFRESH, !Initialized); // Don't allow refresh when we don't show the list
m_ToolBar->EnableTool(IDM_STOP, Running || Paused);
m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
m_ToolBar->EnableTool(IDM_CONFIG_MAIN, !Running);
m_ToolBar->EnableTool(IDM_CONFIG_GFX_PLUGIN, !Running);
m_ToolBar->EnableTool(IDM_CONFIG_DSP_PLUGIN, !Running);
m_ToolBar->EnableTool(IDM_CONFIG_PAD_PLUGIN, !Running);
m_ToolBar->EnableTool(IDM_CONFIG_WIIMOTE_PLUGIN, !Running);
}
// File
@ -909,6 +914,12 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_CONFIG_MAIN)->Enable(!Running);
GetMenuBar()->FindItem(IDM_CONFIG_GFX_PLUGIN)->Enable(!Running);
GetMenuBar()->FindItem(IDM_CONFIG_DSP_PLUGIN)->Enable(!Running);
GetMenuBar()->FindItem(IDM_CONFIG_PAD_PLUGIN)->Enable(!Running);
GetMenuBar()->FindItem(IDM_CONFIG_WIIMOTE_PLUGIN)->Enable(!Running);
m_pSubMenuLoad->Enable(Initialized);
m_pSubMenuSave->Enable(Initialized);

View File

@ -619,10 +619,12 @@ void Host_SetDebugMode(bool)
void Host_SetWaitCursor(bool enable)
{
#ifdef _WIN32
if(enable)
if (enable)
{
SetCursor(LoadCursor(NULL, IDC_WAIT));
} else {
}
else
{
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
#endif