From fddab016fa51008a9490e361022fd59d1a2727b0 Mon Sep 17 00:00:00 2001 From: ayuanx Date: Thu, 26 Nov 2009 17:50:14 +0000 Subject: [PATCH] Fixed the save file path issue of r4613 Anyone encounters significant FPS drop (comparing to r4611 or earlier) please report git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4614 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp | 3 +-- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 17 ++++++++--------- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 18 ++++++++++-------- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h | 3 ++- 4 files changed, 21 insertions(+), 20 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 8031e5386a..e3b91046ba 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -89,7 +89,6 @@ void Init() g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_immediate(i, std::string("/dev/stm/immediate")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_eventhook(i, std::string("/dev/stm/eventhook")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_fs(i, std::string("/dev/fs")); i++; - // Warning: "/dev/es" must be created after "/dev/fs", not before g_DeviceMap[i] = new CWII_IPC_HLE_Device_es(i, std::string("/dev/es")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_di(i, std::string("/dev/di")); i++; g_DeviceMap[i] = new CWII_IPC_HLE_Device_net_kd_request(i, std::string("/dev/net/kd/request")); i++; @@ -140,7 +139,7 @@ void SetDefaultContentFile(const std::string& _rFilename) { CWII_IPC_HLE_Device_es* pDevice = (CWII_IPC_HLE_Device_es*)AccessDeviceByID(GetDeviceIDByName(std::string("/dev/es"))); if (pDevice) - pDevice->Load(_rFilename); + pDevice->LoadWAD(_rFilename); } u32 GetDeviceIDByName(const std::string& _rDeviceName) 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 80391d4386..cb6d694083 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 @@ -40,14 +40,7 @@ CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& , m_pFileSystem(NULL) , m_ErrorStatus(0) , m_CoverStatus(DI_COVER_REG_NO_DISC) -{ - if (VolumeHandler::IsValid()) - { - m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume()); - m_CoverStatus |= DI_COVER_REG_INITIALIZED; - m_CoverStatus &= ~DI_COVER_REG_NO_DISC; - } -} +{} CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di() { @@ -60,7 +53,13 @@ CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di() bool CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress, u32 _Mode) { - Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); + if (VolumeHandler::IsValid()) + { + m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume()); + m_CoverStatus |= DI_COVER_REG_INITIALIZED; + m_CoverStatus &= ~DI_COVER_REG_NO_DISC; + } + Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); m_Active = true; return true; } 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 81e063ef81..d821e675f7 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 @@ -60,8 +60,8 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& , m_pContentLoader(NULL) , m_TitleID(-1) , AccessIdentID(0x6000000) -{ -} + , m_ContentFile() +{} CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es() { @@ -69,9 +69,14 @@ CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es() m_NANDContent.clear(); } -void CWII_IPC_HLE_Device_es::Load(const std::string& _rDefaultContentFile) +void CWII_IPC_HLE_Device_es::LoadWAD(const std::string& _rContentFile) { - m_pContentLoader = &DiscIO::CNANDContentManager::Access().GetNANDLoader(_rDefaultContentFile); + m_ContentFile = _rContentFile; +} + +bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) +{ + m_pContentLoader = &DiscIO::CNANDContentManager::Access().GetNANDLoader(m_ContentFile); // check for cd ... if (m_pContentLoader->IsValid()) @@ -102,11 +107,8 @@ void CWII_IPC_HLE_Device_es::Load(const std::string& _rDefaultContentFile) //FindValidTitleIDs(); INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID); -} -bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) -{ - Memory::Write_U32(GetDeviceID(), _CommandAddress+4); + Memory::Write_U32(GetDeviceID(), _CommandAddress+4); m_Active = true; 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 53ad0b0b0b..e118b97c61 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 @@ -30,7 +30,7 @@ public: virtual ~CWII_IPC_HLE_Device_es(); - void Load(const std::string& _rDefaultContentFile); + void LoadWAD(const std::string& _rContentFile); virtual bool Open(u32 _CommandAddress, u32 _Mode); @@ -132,6 +132,7 @@ private: std::vector m_TitleIDs; u64 m_TitleID; u32 AccessIdentID; + std::string m_ContentFile; u64 GetCurrentTitleID() const;