summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-05-02 17:40:52 -0400
committerGitHub <noreply@github.com>2021-05-02 17:40:52 -0400
commita8c40eb510df2bb26c9baf54bbafafc4262feabb (patch)
treee42978e68af5cdc47e26eda2522074ab2b61fc71
parent9e92d6ddcb593db030d78a13e1b6e5f4df96915c (diff)
parent3397f49a0ae872093394128d56d2738a04e35305 (diff)
Merge pull request #9682 from JosJuice/fix-wii-netplay
IOS: Don't let Kernel initialize WiiRoot if already initialized
-rw-r--r--Source/Core/Core/IOS/IOS.cpp7
-rw-r--r--Source/Core/Core/WiiRoot.cpp12
-rw-r--r--Source/Core/Core/WiiRoot.h1
3 files changed, 18 insertions, 2 deletions
diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp
index 755e13541d..b636288c9c 100644
--- a/Source/Core/Core/IOS/IOS.cpp
+++ b/Source/Core/Core/IOS/IOS.cpp
@@ -256,8 +256,11 @@ Kernel::Kernel()
// Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static,
// using more than one IOS instance at a time is not supported.
ASSERT(GetIOS() == nullptr);
- Core::InitializeWiiRoot(false);
- m_is_responsible_for_nand_root = true;
+
+ m_is_responsible_for_nand_root = !Core::WiiRootIsInitialized();
+ if (m_is_responsible_for_nand_root)
+ Core::InitializeWiiRoot(false);
+
AddCoreDevices();
}
diff --git a/Source/Core/Core/WiiRoot.cpp b/Source/Core/Core/WiiRoot.cpp
index 9503b70b9e..df8b74e759 100644
--- a/Source/Core/Core/WiiRoot.cpp
+++ b/Source/Core/Core/WiiRoot.cpp
@@ -33,6 +33,7 @@ namespace Core
namespace FS = IOS::HLE::FS;
static std::string s_temp_wii_root;
+static bool s_wii_root_initialized = false;
static bool CopyBackupFile(const std::string& path_from, const std::string& path_to)
{
@@ -170,6 +171,8 @@ static void InitializeDeterministicWiiSaves(FS::FileSystem* session_fs)
void InitializeWiiRoot(bool use_temporary)
{
+ ASSERT(!s_wii_root_initialized);
+
if (use_temporary)
{
s_temp_wii_root = File::GetUserPath(D_USER_IDX) + "WiiSession" DIR_SEP;
@@ -198,6 +201,8 @@ void InitializeWiiRoot(bool use_temporary)
{
File::SetUserPath(D_SESSION_WIIROOT_IDX, File::GetUserPath(D_WIIROOT_IDX));
}
+
+ s_wii_root_initialized = true;
}
void ShutdownWiiRoot()
@@ -207,6 +212,13 @@ void ShutdownWiiRoot()
File::DeleteDirRecursively(s_temp_wii_root);
s_temp_wii_root.clear();
}
+
+ s_wii_root_initialized = false;
+}
+
+bool WiiRootIsInitialized()
+{
+ return s_wii_root_initialized;
}
bool WiiRootIsTemporary()
diff --git a/Source/Core/Core/WiiRoot.h b/Source/Core/Core/WiiRoot.h
index ad4ac609b9..1919973abe 100644
--- a/Source/Core/Core/WiiRoot.h
+++ b/Source/Core/Core/WiiRoot.h
@@ -15,6 +15,7 @@ enum class RestoreReason
void InitializeWiiRoot(bool use_temporary);
void ShutdownWiiRoot();
+bool WiiRootIsInitialized();
bool WiiRootIsTemporary();
void BackupWiiSettings();