summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2014-11-17 20:59:14 -0500
committercomex <comexk@gmail.com>2015-05-28 19:14:42 -0400
commitdc91e8b60793276e83cc3c141dcdc551aa36d8ed (patch)
tree9dedab7118f77e481459b4d48278cb618a70e892 /Source
parentf6c6822f71e795563e5eacdb28c2a740ca79b520 (diff)
Add a mode to use a dummy Wii NAND.
Eventually, netplay will be able to use the host's NAND, but this could still be useful in some cases; for TAS it definitely makes sense to have a way to avoid using any preexisting NAND. In terms of implementation: remove D_WIIUSER_IDX, which was just WIIROOT + "/", as well as some other indices which are pointless to have as separate variables rather than just using the actual path (fixed, since they're actual Wii NAND paths) at the call site. Then split off D_SESSION_WIIROOT_IDX, which can point to the dummy NAND directory, from D_WIIROOT_IDX, which always points to the "real" one the user configured.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/FileUtil.cpp38
-rw-r--r--Source/Core/Common/FileUtil.h10
-rw-r--r--Source/Core/Common/NandPaths.cpp54
-rw-r--r--Source/Core/Common/NandPaths.h3
-rw-r--r--Source/Core/Common/SysConf.cpp9
-rw-r--r--Source/Core/Core/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/Core.cpp1
-rw-r--r--Source/Core/Core/HW/HW.cpp6
-rw-r--r--Source/Core/Core/HW/WiiSaveCrypted.cpp2
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp5
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp5
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp5
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h10
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp6
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp2
-rw-r--r--Source/Core/Core/ec_wii.cpp2
-rw-r--r--Source/Core/DiscIO/NANDContentLoader.cpp8
-rw-r--r--Source/Core/DiscIO/VolumeCommon.cpp4
-rw-r--r--Source/Core/DolphinQt/GameList/GameFile.cpp2
-rw-r--r--Source/Core/DolphinWX/Config/PathConfigPane.cpp2
-rw-r--r--Source/Core/DolphinWX/ISOFile.cpp4
-rw-r--r--Source/Core/DolphinWX/MainAndroid.cpp2
-rw-r--r--Source/Core/UICommon/UICommon.cpp4
23 files changed, 127 insertions, 59 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index 19269e88d3..925e3f1ed3 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -20,6 +20,7 @@
#include <commdlg.h> // for GetSaveFileName
#include <direct.h> // getcwd
#include <io.h>
+#include <objbase.h> // guid stuff
#include <shellapi.h>
#include <windows.h>
#else
@@ -666,6 +667,32 @@ bool SetCurrentDir(const std::string &directory)
return __chdir(directory.c_str()) == 0;
}
+std::string CreateTempDir()
+{
+#ifdef _WIN32
+ TCHAR temp[MAX_PATH];
+ if (!GetTempPath(MAX_PATH, temp))
+ return "";
+
+ GUID guid;
+ CoCreateGuid(&guid);
+ TCHAR tguid[40];
+ StringFromGUID2(guid, tguid, 39);
+ tguid[39] = 0;
+ std::string dir = TStrToUTF8(temp) + "/" + TStrToUTF8(tguid);
+ if (!CreateDir(dir))
+ return "";
+ dir = ReplaceAll(dir, "\\", DIR_SEP);
+ return dir;
+#else
+ const char* base = getenv("TMPDIR") ?: "/tmp";
+ std::string path = std::string(base) + "/DolphinWii.XXXXXX";
+ if (!mkdtemp(&path[0]))
+ return "";
+ return path;
+#endif
+}
+
std::string GetTempFilenameForAtomicWrite(const std::string &path)
{
std::string abs = path;
@@ -734,17 +761,9 @@ static void RebuildUserDirectories(unsigned int dir_index)
{
switch (dir_index)
{
- case D_WIIROOT_IDX:
- s_user_paths[D_WIIUSER_IDX] = s_user_paths[D_WIIROOT_IDX] + DIR_SEP;
- s_user_paths[D_WIISYSCONF_IDX] = s_user_paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
- s_user_paths[D_WIIWC24_IDX] = s_user_paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
- s_user_paths[F_WIISYSCONF_IDX] = s_user_paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
- break;
-
case D_USER_IDX:
s_user_paths[D_GCUSER_IDX] = s_user_paths[D_USER_IDX] + GC_USER_DIR DIR_SEP;
s_user_paths[D_WIIROOT_IDX] = s_user_paths[D_USER_IDX] + WII_USER_DIR;
- s_user_paths[D_WIIUSER_IDX] = s_user_paths[D_WIIROOT_IDX] + DIR_SEP;
s_user_paths[D_CONFIG_IDX] = s_user_paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
s_user_paths[D_GAMESETTINGS_IDX] = s_user_paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP;
s_user_paths[D_MAPS_IDX] = s_user_paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
@@ -762,14 +781,11 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[D_DUMPDSP_IDX] = s_user_paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
s_user_paths[D_LOGS_IDX] = s_user_paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
s_user_paths[D_MAILLOGS_IDX] = s_user_paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
- s_user_paths[D_WIISYSCONF_IDX] = s_user_paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
- s_user_paths[D_WIIWC24_IDX] = s_user_paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
s_user_paths[D_THEMES_IDX] = s_user_paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
s_user_paths[F_DOLPHINCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
s_user_paths[F_DEBUGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
s_user_paths[F_LOGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + LOGGER_CONFIG;
s_user_paths[F_MAINLOG_IDX] = s_user_paths[D_LOGS_IDX] + MAIN_LOG;
- s_user_paths[F_WIISYSCONF_IDX] = s_user_paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
s_user_paths[F_RAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + RAM_DUMP;
s_user_paths[F_ARAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + ARAM_DUMP;
s_user_paths[F_FAKEVMEMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h
index 3ad7b08d5b..1337ee1670 100644
--- a/Source/Core/Common/FileUtil.h
+++ b/Source/Core/Common/FileUtil.h
@@ -20,8 +20,8 @@
enum {
D_USER_IDX,
D_GCUSER_IDX,
- D_WIIROOT_IDX,
- D_WIIUSER_IDX,
+ D_WIIROOT_IDX, // always points to User/Wii or global user-configured directory
+ D_SESSION_WIIROOT_IDX, // may point to minimal temporary directory for determinism
D_CONFIG_IDX, // global settings
D_GAMESETTINGS_IDX, // user-specified settings which override both the global and the default settings (per game)
D_MAPS_IDX,
@@ -39,14 +39,11 @@ enum {
D_LOAD_IDX,
D_LOGS_IDX,
D_MAILLOGS_IDX,
- D_WIISYSCONF_IDX,
- D_WIIWC24_IDX,
D_THEMES_IDX,
F_DOLPHINCONFIG_IDX,
F_DEBUGGERCONFIG_IDX,
F_LOGGERCONFIG_IDX,
F_MAINLOG_IDX,
- F_WIISYSCONF_IDX,
F_RAMDUMP_IDX,
F_ARAMDUMP_IDX,
F_FAKEVMEMDUMP_IDX,
@@ -122,6 +119,9 @@ void CopyDir(const std::string &source_path, const std::string &dest_path);
// Set the current directory to given directory
bool SetCurrentDir(const std::string &directory);
+// Creates and returns the path to a new temporary directory.
+std::string CreateTempDir();
+
// Get a filename that can hopefully be atomically renamed to the given path.
std::string GetTempFilenameForAtomicWrite(const std::string &path);
diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp
index c695d0744a..6037137410 100644
--- a/Source/Core/Common/NandPaths.cpp
+++ b/Source/Core/Common/NandPaths.cpp
@@ -7,6 +7,7 @@
#include <string>
#include <utility>
+#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
@@ -15,17 +16,55 @@
namespace Common
{
+static std::string s_temp_wii_root;
+
+void InitializeWiiRoot(bool use_dummy)
+{
+ ShutdownWiiRoot();
+ if (use_dummy)
+ {
+ s_temp_wii_root = File::CreateTempDir();
+ if (s_temp_wii_root.empty())
+ {
+ ERROR_LOG(WII_IPC_FILEIO, "Could not create temporary directory");
+ return;
+ }
+ File::CopyDir(File::GetSysDirectory() + WII_USER_DIR, s_temp_wii_root);
+ WARN_LOG(WII_IPC_FILEIO, "Using temporary directory %s for minimal Wii FS", s_temp_wii_root.c_str());
+ static bool s_registered;
+ if (!s_registered)
+ {
+ s_registered = true;
+ atexit(ShutdownWiiRoot);
+ }
+ File::SetUserPath(D_SESSION_WIIROOT_IDX, s_temp_wii_root);
+ }
+ else
+ {
+ File::SetUserPath(D_SESSION_WIIROOT_IDX, File::GetUserPath(D_WIIROOT_IDX));
+ }
+}
+
+void ShutdownWiiRoot()
+{
+ if (!s_temp_wii_root.empty())
+ {
+ File::DeleteDirRecursively(s_temp_wii_root);
+ s_temp_wii_root.clear();
+ }
+}
+
std::string GetTicketFileName(u64 _titleID)
{
- return StringFromFormat("%sticket/%08x/%08x.tik",
- File::GetUserPath(D_WIIUSER_IDX).c_str(),
+ return StringFromFormat("%s/ticket/%08x/%08x.tik",
+ File::GetUserPath(D_SESSION_WIIROOT_IDX).c_str(),
(u32)(_titleID >> 32), (u32)_titleID);
}
std::string GetTitleDataPath(u64 _titleID)
{
- return StringFromFormat("%stitle/%08x/%08x/data/",
- File::GetUserPath(D_WIIUSER_IDX).c_str(),
+ return StringFromFormat("%s/title/%08x/%08x/data/",
+ File::GetUserPath(D_SESSION_WIIROOT_IDX).c_str(),
(u32)(_titleID >> 32), (u32)_titleID);
}
@@ -35,8 +74,8 @@ std::string GetTMDFileName(u64 _titleID)
}
std::string GetTitleContentPath(u64 _titleID)
{
- return StringFromFormat("%stitle/%08x/%08x/content/",
- File::GetUserPath(D_WIIUSER_IDX).c_str(),
+ return StringFromFormat("%s/title/%08x/%08x/content/",
+ File::GetUserPath(D_SESSION_WIIROOT_IDX).c_str(),
(u32)(_titleID >> 32), (u32)_titleID);
}
@@ -89,8 +128,7 @@ void ReadReplacements(replace_v& replacements)
{
replacements.clear();
const std::string replace_fname = "/sys/replace";
- std::string filename(File::GetUserPath(D_WIIROOT_IDX));
- filename += replace_fname;
+ std::string filename = File::GetUserPath(D_SESSION_WIIROOT_IDX) + replace_fname;
if (!File::Exists(filename))
CreateReplacementFile(filename);
diff --git a/Source/Core/Common/NandPaths.h b/Source/Core/Common/NandPaths.h
index 4adfed131f..6a79abf3bf 100644
--- a/Source/Core/Common/NandPaths.h
+++ b/Source/Core/Common/NandPaths.h
@@ -18,6 +18,9 @@ namespace Common
typedef std::pair<char, std::string> replace_t;
typedef std::vector<replace_t> replace_v;
+ void InitializeWiiRoot(bool use_temporary);
+ void ShutdownWiiRoot();
+
std::string GetTicketFileName(u64 _titleID);
std::string GetTMDFileName(u64 _titleID);
std::string GetTitleDataPath(u64 _titleID);
diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp
index 94124c4957..a0d3aa1f04 100644
--- a/Source/Core/Common/SysConf.cpp
+++ b/Source/Core/Common/SysConf.cpp
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/SysConf.h"
@@ -15,8 +16,7 @@
SysConf::SysConf()
: m_IsValid(false)
{
- m_FilenameDefault = File::GetUserPath(F_WIISYSCONF_IDX);
- m_IsValid = LoadFromFile(m_FilenameDefault);
+ UpdateLocation();
}
SysConf::~SysConf()
@@ -409,7 +409,10 @@ void SysConf::UpdateLocation()
// Clear the old filename and set the default filename to the new user path
// So that it can be generated if the file does not exist in the new location
m_Filename.clear();
- m_FilenameDefault = File::GetUserPath(F_WIISYSCONF_IDX);
+ // Note: We don't use the dummy Wii root here (if in use) because this is
+ // all tied up with the configuration code. In the future this should
+ // probably just be synced with the other settings.
+ m_FilenameDefault = File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_SYSCONF_DIR DIR_SEP WII_SYSCONF;
Reload();
}
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index a06cc48839..81a85c5063 100644
--- a/Source/Core/Core/ConfigManager.cpp
+++ b/Source/Core/Core/ConfigManager.cpp
@@ -475,8 +475,6 @@ void SConfig::LoadGeneralSettings(IniFile& ini)
general->Get("NANDRootPath", &m_NANDPath);
File::SetUserPath(D_WIIROOT_IDX, m_NANDPath);
- DiscIO::cUIDsys::AccessInstance().UpdateLocation();
- DiscIO::CSharedContent::AccessInstance().UpdateLocation();
general->Get("WirelessMac", &m_WirelessMac);
}
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index 2972760d34..449682e051 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -832,6 +832,7 @@ void UpdateWantDeterminism(bool initial)
g_video_backend->UpdateWantDeterminism(new_want_determinism);
// We need to clear the cache because some parts of the JIT depend on want_determinism, e.g. use of FMA.
JitInterface::ClearCache();
+ Common::InitializeWiiRoot(g_want_determinism);
Core::PauseAndLock(false, was_unpaused);
}
diff --git a/Source/Core/Core/HW/HW.cpp b/Source/Core/Core/HW/HW.cpp
index ef0aee3a85..533c392cf5 100644
--- a/Source/Core/Core/HW/HW.cpp
+++ b/Source/Core/Core/HW/HW.cpp
@@ -4,6 +4,7 @@
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
+#include "Common/NandPaths.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@@ -25,6 +26,7 @@
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/PPCAnalyst.h"
+#include "DiscIO/NANDContentLoader.h"
namespace HW
{
@@ -50,6 +52,9 @@ namespace HW
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
+ Common::InitializeWiiRoot(Core::g_want_determinism);
+ DiscIO::cUIDsys::AccessInstance().UpdateLocation();
+ DiscIO::CSharedContent::AccessInstance().UpdateLocation();
WII_IPCInterface::Init();
WII_IPC_HLE_Interface::Init();
}
@@ -70,6 +75,7 @@ namespace HW
{
WII_IPCInterface::Shutdown();
WII_IPC_HLE_Interface::Shutdown();
+ Common::ShutdownWiiRoot();
}
State::Shutdown();
diff --git a/Source/Core/Core/HW/WiiSaveCrypted.cpp b/Source/Core/Core/HW/WiiSaveCrypted.cpp
index 4d50fcaa21..beae07402d 100644
--- a/Source/Core/Core/HW/WiiSaveCrypted.cpp
+++ b/Source/Core/Core/HW/WiiSaveCrypted.cpp
@@ -62,7 +62,7 @@ bool CWiiSaveCrypted::ExportWiiSave(u64 title_id)
void CWiiSaveCrypted::ExportAllSaves()
{
- std::string title_folder = File::GetUserPath(D_WIIUSER_IDX) + "title";
+ std::string title_folder = File::GetUserPath(D_WIIROOT_IDX) + "/title";
std::vector<u64> titles;
const u32 path_mask = 0x00010000;
for (int i = 0; i < 8; ++i)
diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
index feaa0c82b0..d075d8a192 100644
--- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
@@ -22,6 +22,7 @@
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
@@ -275,7 +276,7 @@ void Wiimote::WriteData(const wm_write_data* const wd)
{
// writing the whole mii block each write :/
std::ofstream file;
- OpenFStream(file, File::GetUserPath(D_WIIUSER_IDX) + "mii.bin", std::ios::binary | std::ios::out);
+ OpenFStream(file, File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/mii.bin", std::ios::binary | std::ios::out);
file.write((char*)m_eeprom + 0x0FCA, 0x02f0);
file.close();
}
@@ -417,7 +418,7 @@ void Wiimote::ReadData(const wm_read_data* const rd)
{
// reading the whole mii block :/
std::ifstream file;
- file.open((File::GetUserPath(D_WIIUSER_IDX) + "mii.bin").c_str(), std::ios::binary | std::ios::in);
+ file.open((File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/mii.bin").c_str(), std::ios::binary | std::ios::in);
file.read((char*)m_eeprom + 0x0FCA, 0x02f0);
file.close();
}
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
index c14186f6f0..5e300ce120 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
@@ -5,11 +5,14 @@
#include <algorithm>
#include "Common/ChunkFile.h"
+#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Common/StringUtil.h"
+#include "Core/Core.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
@@ -19,7 +22,7 @@ static Common::replace_v replacements;
// This is used by several of the FileIO and /dev/fs functions
std::string HLE_IPC_BuildFilename(std::string path_wii)
{
- std::string path_full = File::GetUserPath(D_WIIROOT_IDX);
+ std::string path_full = File::GetUserPath(D_SESSION_WIIROOT_IDX);
// Replaces chars that FAT32 can't support with strings defined in /sys/replace
for (auto& replacement : replacements)
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
index 70368267f8..68108705fb 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
@@ -32,7 +32,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
{
// clear tmp folder
{
- std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp";
+ std::string Path = HLE_IPC_BuildFilename("/tmp");
File::DeleteDirRecursively(Path);
File::CreateDir(Path);
}
@@ -221,7 +221,6 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtl(u32 _CommandAddress)
{
//u32 DeviceID = Memory::Read_U32(_CommandAddress + 8);
- //LOG(WII_IPC_FILEIO, "FS: IOCtl (Device=%s, DeviceID=%08x)", GetDeviceName().c_str(), DeviceID);
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
@@ -483,7 +482,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
// handle /tmp
- std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp";
+ std::string Path = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/tmp";
if (p.GetMode() == PointerWrap::MODE_READ)
{
File::DeleteDirRecursively(Path);
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h
index b06b45f7d0..c1cecee67e 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h
@@ -4,7 +4,9 @@
#pragma once
+#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
#include "Common/Timer.h"
#include "Core/HW/EXI_DeviceIPL.h"
@@ -172,7 +174,7 @@ private:
public:
NWC24Config()
{
- path = File::GetUserPath(D_WIIWC24_IDX) + "nwc24msg.cfg";
+ path = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_WC24CONF_DIR "/nwc24msg.cfg";
ReadConfig();
}
@@ -211,7 +213,7 @@ public:
{
if (!File::Exists(path))
{
- if (!File::CreateFullPath(File::GetUserPath(D_WIIWC24_IDX)))
+ if (!File::CreateFullPath(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_WC24CONF_DIR))
{
ERROR_LOG(WII_IPC_WC24, "Failed to create directory for WC24");
}
@@ -322,7 +324,7 @@ class WiiNetConfig
public:
WiiNetConfig()
{
- path = File::GetUserPath(D_WIISYSCONF_IDX) + "net/02/config.dat";
+ path = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_SYSCONF_DIR "/net/02/config.dat";
ReadConfig();
}
@@ -347,7 +349,7 @@ public:
{
if (!File::Exists(path))
{
- if (!File::CreateFullPath(std::string(File::GetUserPath(D_WIISYSCONF_IDX) + "net/02/")))
+ if (!File::CreateFullPath(std::string(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_SYSCONF_DIR "/net/02/")))
{
ERROR_LOG(WII_IPC_NET, "Failed to create directory for network config file");
}
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
index 456e181960..03c50a97ce 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
@@ -5,6 +5,7 @@
#include <algorithm>
#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
#include "Core/IPC_HLE/WII_Socket.h"
@@ -286,7 +287,7 @@ _SSL_NEW_ERROR:
if (SSLID_VALID(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
- std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
+ std::string cert_base_path = File::GetUserPath(D_SESSION_WIIROOT_IDX);
int ret = x509_crt_parse_file(&ssl->clicert, (cert_base_path + "clientca.pem").c_str());
int pk_ret = pk_parse_keyfile(&ssl->pk, (cert_base_path + "clientcakey.pem").c_str(), nullptr);
if (ret || pk_ret)
@@ -343,9 +344,8 @@ _SSL_NEW_ERROR:
if (SSLID_VALID(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
- std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
- int ret = x509_crt_parse_file(&ssl->cacert, (cert_base_path + "rootca.pem").c_str());
+ int ret = x509_crt_parse_file(&ssl->cacert, (File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/rootca.pem").c_str());
if (ret)
{
x509_crt_free(&ssl->clicert);
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
index c2bb9c9fe8..b4e3f149db 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
@@ -61,7 +61,7 @@ void CWII_IPC_HLE_Device_sdio_slot0::EventNotify()
void CWII_IPC_HLE_Device_sdio_slot0::OpenInternal()
{
- const std::string filename = File::GetUserPath(D_WIIUSER_IDX) + "sd.raw";
+ const std::string filename = File::GetUserPath(D_WIIROOT_IDX) + "/sd.raw";
m_Card.Open(filename, "r+b");
if (!m_Card)
{
diff --git a/Source/Core/Core/ec_wii.cpp b/Source/Core/Core/ec_wii.cpp
index 272aacac8c..d786d8fe75 100644
--- a/Source/Core/Core/ec_wii.cpp
+++ b/Source/Core/Core/ec_wii.cpp
@@ -119,7 +119,7 @@ void make_blanksig_ec_cert(u8 *cert_out, const char *signer, const char *name, c
EcWii::EcWii()
{
bool init = true;
- std::string keys_path = File::GetUserPath(D_WIIUSER_IDX) + "keys.bin";
+ std::string keys_path = File::GetUserPath(D_WIIROOT_IDX) + "/keys.bin";
if (File::Exists(keys_path))
{
File::IOFile keys_f(keys_path, "rb");
diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp
index 715ac6e878..c247713ee3 100644
--- a/Source/Core/DiscIO/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/NANDContentLoader.cpp
@@ -35,7 +35,7 @@ void CSharedContent::UpdateLocation()
{
m_Elements.clear();
m_lastID = 0;
- m_contentMap = StringFromFormat("%sshared1/content.map", File::GetUserPath(D_WIIUSER_IDX).c_str());
+ m_contentMap = StringFromFormat("%s/shared1/content.map", File::GetUserPath(D_WIIROOT_IDX).c_str());
File::IOFile pFile(m_contentMap, "rb");
SElement Element;
@@ -55,7 +55,7 @@ std::string CSharedContent::GetFilenameFromSHA1(const u8* _pHash)
{
if (memcmp(_pHash, Element.SHA1Hash, 20) == 0)
{
- return StringFromFormat("%sshared1/%c%c%c%c%c%c%c%c.app", File::GetUserPath(D_WIIUSER_IDX).c_str(),
+ return StringFromFormat("%s/shared1/%c%c%c%c%c%c%c%c.app", File::GetUserPath(D_WIIROOT_IDX).c_str(),
Element.FileName[0], Element.FileName[1], Element.FileName[2], Element.FileName[3],
Element.FileName[4], Element.FileName[5], Element.FileName[6], Element.FileName[7]);
}
@@ -80,7 +80,7 @@ std::string CSharedContent::AddSharedContent(const u8* _pHash)
File::IOFile pFile(m_contentMap, "ab");
pFile.WriteArray(&Element, 1);
- filename = StringFromFormat("%sshared1/%s.app", File::GetUserPath(D_WIIUSER_IDX).c_str(), id.c_str());
+ filename = StringFromFormat("%s/shared1/%s.app", File::GetUserPath(D_WIIROOT_IDX).c_str(), id.c_str());
m_lastID++;
}
@@ -371,7 +371,7 @@ void cUIDsys::UpdateLocation()
{
m_Elements.clear();
m_lastUID = 0x00001000;
- m_uidSys = StringFromFormat("%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX).c_str());
+ m_uidSys = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/sys/uid.sys";
File::IOFile pFile(m_uidSys, "rb");
SElement Element;
diff --git a/Source/Core/DiscIO/VolumeCommon.cpp b/Source/Core/DiscIO/VolumeCommon.cpp
index cb4386af68..6d3998d85c 100644
--- a/Source/Core/DiscIO/VolumeCommon.cpp
+++ b/Source/Core/DiscIO/VolumeCommon.cpp
@@ -33,8 +33,8 @@ std::vector<u32> IVolume::GetBanner(int* width, int* height) const
GetTitleID((u8*)&TitleID);
TitleID = Common::swap64(TitleID);
- std::string file_name = StringFromFormat("%stitle/%08x/%08x/data/banner.bin",
- File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID >> 32), (u32)TitleID);
+ std::string file_name = StringFromFormat("%s/title/%08x/%08x/data/banner.bin",
+ File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(TitleID >> 32), (u32)TitleID);
if (!File::Exists(file_name))
return std::vector<u32>();
diff --git a/Source/Core/DolphinQt/GameList/GameFile.cpp b/Source/Core/DolphinQt/GameList/GameFile.cpp
index e8cbe83f3c..b7ee748c52 100644
--- a/Source/Core/DolphinQt/GameList/GameFile.cpp
+++ b/Source/Core/DolphinQt/GameList/GameFile.cpp
@@ -292,7 +292,7 @@ const QString GameFile::GetWiiFSPath() const
volume->GetTitleID((u8*)&title);
title = Common::swap64(title);
- path = StringFromFormat("%stitle/%08x/%08x/data/", File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(title >> 32), (u32)title);
+ path = StringFromFormat("%s/title/%08x/%08x/data/", File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title >> 32), (u32)title);
if (!File::Exists(path))
File::CreateFullPath(path);
diff --git a/Source/Core/DolphinWX/Config/PathConfigPane.cpp b/Source/Core/DolphinWX/Config/PathConfigPane.cpp
index 04e9f20aab..efde03d64d 100644
--- a/Source/Core/DolphinWX/Config/PathConfigPane.cpp
+++ b/Source/Core/DolphinWX/Config/PathConfigPane.cpp
@@ -182,8 +182,6 @@ void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event)
m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path));
SConfig::GetInstance().m_SYSCONF->UpdateLocation();
- DiscIO::cUIDsys::AccessInstance().UpdateLocation();
- DiscIO::CSharedContent::AccessInstance().UpdateLocation();
main_frame->UpdateWiiMenuChoice();
}
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp
index a85586e7d5..f4b05a855c 100644
--- a/Source/Core/DolphinWX/ISOFile.cpp
+++ b/Source/Core/DolphinWX/ISOFile.cpp
@@ -259,8 +259,8 @@ const std::string GameListItem::GetWiiFSPath() const
iso->GetTitleID((u8*)&title);
title = Common::swap64(title);
- const std::string path = StringFromFormat("%stitle/%08x/%08x/data/",
- File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(title>>32), (u32)title);
+ const std::string path = StringFromFormat("%s/title/%08x/%08x/data/",
+ File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title>>32), (u32)title);
if (!File::Exists(path))
File::CreateFullPath(path);
diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp
index 2f37f36240..95b816c50b 100644
--- a/Source/Core/DolphinWX/MainAndroid.cpp
+++ b/Source/Core/DolphinWX/MainAndroid.cpp
@@ -537,7 +537,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFo
{
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
- File::CreateFullPath(File::GetUserPath(D_WIIUSER_IDX));
+ File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp
index f1fa25ff44..a8394d9ea4 100644
--- a/Source/Core/UICommon/UICommon.cpp
+++ b/Source/Core/UICommon/UICommon.cpp
@@ -51,8 +51,8 @@ void Shutdown()
void CreateDirectories()
{
// Copy initial Wii NAND data from Sys to User.
- File::CopyDir(File::GetSysDirectory() + WII_USER_DIR DIR_SEP,
- File::GetUserPath(D_WIIUSER_IDX));
+ File::CopyDir(File::GetSysDirectory() + WII_USER_DIR,
+ File::GetUserPath(D_WIIROOT_IDX));
File::CreateFullPath(File::GetUserPath(D_USER_IDX));
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));