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;