From 4d512ecba77258b9f28fee8d95d338053964e48e Mon Sep 17 00:00:00 2001 From: ayuanx Date: Tue, 1 Dec 2009 15:39:37 +0000 Subject: [PATCH] 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 --- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp | 13 +++++--- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device.h | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 6 ++-- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_Error.h | 5 +-- .../Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp | 15 ++++----- .../Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 17 ++++++---- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h | 3 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp | 6 ++-- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 21 ++++++------ .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h | 11 ++++--- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 29 +++++++++++------ .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h | 2 +- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h | 14 +++++--- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 32 +++++++++++++++---- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h | 10 +++--- Source/Core/DolphinWX/Src/FrameTools.cpp | 11 +++++++ Source/Core/DolphinWX/Src/Main.cpp | 6 ++-- Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp | 2 -- Source/Plugins/Plugin_DSP_HLE/Src/Config.h | 1 - .../Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp | 22 +++++-------- Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h | 2 -- .../Src/UCodes/UCode_AX_Voice.h | 26 +++------------ .../Plugins/Plugin_VideoDX9/Src/resource.rc | 7 +--- .../Plugins/Plugin_Wiimote/Src/FillReport.cpp | 29 ++++++++++------- 27 files changed, 163 insertions(+), 135 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index bc1977e5db..2dad1b089d 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h index 5b5fce0ebc..b70e60cbd7 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index 54ec4a09c4..fa2f6a025d 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h index ef605d9cec..36e9f89067 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h @@ -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); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_Error.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_Error.h index 3fc2f97234..9bdf1f4e88 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_Error.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_Error.h @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index c2c82a46f3..2cb59be7af 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h index ca739172c1..cdd14a3ba3 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h @@ -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); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index af88f933fb..2b964d91a0 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h index e118b97c61..a60af6f316 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h @@ -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 m_TitleIDs; u64 m_TitleID; u32 AccessIdentID; + // This should only be cleared on power reset std::string m_ContentFile; u64 GetCurrentTitleID() const; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index 3a4bd7085c..c6afc2b8ff 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h index b56aaa3df7..dfd8c2ffc9 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h @@ -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); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp index 2be3377208..484dc71a67 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp @@ -64,12 +64,10 @@ extern std::queue > 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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h index 6115fbdeae..41dbead2d9 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h @@ -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: diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 42683cf8e8..ed11bdc68d 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h index 8901584750..051e20495c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h @@ -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); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h index 40c92ab3e4..f1eb7cc1dd 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index d47aef3b35..f468d5c805 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -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; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h index d76d35bc38..a4b5ab5e2a 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h @@ -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 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); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 83bc5a7746..ce0f3a61ae 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 9cef859181..66ceb92b5f 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -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 diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp index 812bfd003c..44ddb9d2dc 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp @@ -35,7 +35,6 @@ void CConfig::Load() file.Load(FULL_CONFIG_DIR "DSP.ini"); file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings file.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack - file.Get("Config", "EnableLoopAudioFix", &m_EnableLoopFix, false); // Loop Hack ac_Config.Load(file); } @@ -45,7 +44,6 @@ void CConfig::Save() file.Load(FULL_CONFIG_DIR "DSP.ini"); file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings file.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack - file.Set("Config", "EnableLoopAudioFix", m_EnableLoopFix); // Loop Hack ac_Config.Set(file); file.Save(FULL_CONFIG_DIR "DSP.ini"); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h index 52a7d406a7..ca70665610 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h @@ -24,7 +24,6 @@ struct CConfig { bool m_EnableHLEAudio; bool m_EnableRE0Fix; - bool m_EnableLoopFix; CConfig(); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp index 151824ef2e..ff98a92ce4 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp @@ -25,7 +25,6 @@ EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, DSPConfigDialogHLE::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogHLE::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogHLE::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_RE0_FIX, DSPConfigDialogHLE::SettingsChanged) -EVT_CHECKBOX(ID_ENABLE_LOOP_FIX, DSPConfigDialogHLE::SettingsChanged) EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogHLE::VolumeChanged) END_EVENT_TABLE() @@ -40,9 +39,8 @@ DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wx // Create items m_buttonEnableHLEAudio = new wxCheckBox(this, ID_ENABLE_HLE_AUDIO, wxT("Enable HLE Audio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_buttonEnableDTKMusic = new wxCheckBox(this, ID_ENABLE_DTK_MUSIC, wxT("Enable DTK Music"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, wxT("Enable Other Audio (Throttle)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, wxT("Enable Audio Throttle"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_buttonEnableRE0Fix = new wxCheckBox(this, ID_ENABLE_RE0_FIX, wxT("Enable RE0 Audio Hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_buttonEnableLoopFix = new wxCheckBox(this, ID_ENABLE_LOOP_FIX, wxT("Enable Loop Audio Hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxStaticText *BackendText = new wxStaticText(this, wxID_ANY, wxT("Audio Backend"), wxDefaultPosition, wxDefaultSize, 0); m_BackendSelection = new wxComboBox(this, ID_BACKEND, wxEmptyString, wxDefaultPosition, wxSize(90, 20), wxArrayBackends, wxCB_READONLY, wxDefaultValidator); @@ -54,18 +52,16 @@ DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wx m_buttonEnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false); m_buttonEnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false); m_buttonEnableRE0Fix->SetValue(g_Config.m_EnableRE0Fix ? true : false); - m_buttonEnableLoopFix->SetValue(g_Config.m_EnableLoopFix ? true : false); // Add tooltips - m_buttonEnableHLEAudio->SetToolTip(wxT("This is the most common sound type")); - m_buttonEnableDTKMusic->SetToolTip(wxT("This is sometimes used to play music tracks from the disc")); - m_buttonEnableThrottle->SetToolTip(wxT("This is sometimes used together with pre-rendered movies.\n") - wxT("Disabling this also disables the speed throttle which this causes,\n") - wxT("meaning that there will be no upper limit on your FPS.")); + m_buttonEnableHLEAudio->SetToolTip(wxT("This is usually used to play voice and sound effects.")); + m_buttonEnableDTKMusic->SetToolTip(wxT("This is used to play music tracks, like BGM.")); + m_buttonEnableThrottle->SetToolTip(wxT("This is used to control game speed by sound throttle.\n") + wxT("Disabling this could cause abnormal game speed, such as too fast.\n") + wxT("But sometimes enabling this causes constant noise.")); + m_buttonEnableRE0Fix->SetToolTip(wxT("This fixes audio in Resident Evil Zero and maybe some other games.")); - m_buttonEnableLoopFix->SetToolTip(wxT("This fixes audio loops in some games, by default it should be disabled.\n") - wxT("Unless you are experiencing strange sound loops, don't enable it,\n") - wxT("or it will cause some games to hang up.")); + m_BackendSelection->SetToolTip(wxT("Changing this will have no effect while the emulator is running!")); // Create sizer and add items to dialog @@ -79,7 +75,6 @@ DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wx sbSettings->Add(m_buttonEnableDTKMusic, 0, wxALL, 5); sbSettings->Add(m_buttonEnableThrottle, 0, wxALL, 5); sbSettings->Add(m_buttonEnableRE0Fix, 0, wxALL, 5); - sbSettings->Add(m_buttonEnableLoopFix, 0, wxALL, 5); sBackend->Add(BackendText, 0, wxALIGN_CENTER|wxALL, 5); sBackend->Add(m_BackendSelection, 0, wxALL, 1); sbSettings->Add(sBackend, 0, wxALL, 2); @@ -139,7 +134,6 @@ void DSPConfigDialogHLE::SettingsChanged(wxCommandEvent& event) ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue(); ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); g_Config.m_EnableRE0Fix = m_buttonEnableRE0Fix->GetValue(); - g_Config.m_EnableLoopFix = m_buttonEnableLoopFix->GetValue(); #ifdef __APPLE__ strncpy(ac_Config.sBackend, m_BackendSelection->GetValue().mb_str(), 128); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h index d0fe1c7beb..32bf40b959 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h @@ -47,7 +47,6 @@ private: wxCheckBox *m_buttonEnableDTKMusic; wxCheckBox *m_buttonEnableThrottle; wxCheckBox *m_buttonEnableRE0Fix; - wxCheckBox *m_buttonEnableLoopFix; wxArrayString wxArrayBackends; wxComboBox *m_BackendSelection; @@ -58,7 +57,6 @@ private: ID_ENABLE_DTK_MUSIC, ID_ENABLE_THROTTLE, ID_ENABLE_RE0_FIX, - ID_ENABLE_LOOP_FIX, ID_BACKEND, ID_VOLUME }; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h index e83d8d34ea..3fc371b112 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h @@ -191,9 +191,7 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, break; case AUDIOFORMAT_ADPCM: - u32 toSamplePos; - toSamplePos = (newSamplePos > sampleEnd) ? sampleEnd : newSamplePos; - sample = ADPCM_Step(pb.adpcm, samplePos, toSamplePos, frac); + sample = ADPCM_Step(pb.adpcm, samplePos, newSamplePos, frac); break; default: @@ -248,24 +246,10 @@ inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, } else { - if (!g_Config.m_EnableLoopFix && Wii && (_uCode == UCODE_AXWII)) - { - // This accurate boundary wrapping will fix the hangup in many AXWii games like: - // New Super Mario Bros.Wii, Fatal Frame 4, Resident Evil Darkside Chronicles - samplePos = newSamplePos - sampleEnd + loopPos; - - // And these AXWii games check this flag and will turn it off when necessary - // So DSP should not touch it - // - //pb.running = 0; - } - else - { - pb.running = 0; - } - // not sure if this will mute the unwanted over looping sound - pb.mixer.volume_left = 0; - pb.mixer.volume_right = 0; + pb.running = 0; + samplePos = samplePos - sampleEnd + loopPos; + memset(&pb.updates, 0, sizeof(pb.updates)); + memset(pb.src.last_samples, 0, 8); break; } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.rc b/Source/Plugins/Plugin_VideoDX9/Src/resource.rc index fe0789e399..8071279577 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.rc +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -184,11 +184,6 @@ BEGIN END 2 TEXTINCLUDE -BEGIN - "#include ""afxres.h\0" -END - -3 TEXTINCLUDE BEGIN "#include