Common: Convert FromWhichRoot to enum class

This commit is contained in:
Dentomologist 2023-06-13 13:22:56 -07:00
parent 89e7e7d669
commit 7ff7c9e84f
7 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ namespace Common
{ {
std::string RootUserPath(FromWhichRoot from) std::string RootUserPath(FromWhichRoot from)
{ {
int idx = from == FROM_CONFIGURED_ROOT ? D_WIIROOT_IDX : D_SESSION_WIIROOT_IDX; int idx = from == FromWhichRoot::Configured ? D_WIIROOT_IDX : D_SESSION_WIIROOT_IDX;
std::string dir = File::GetUserPath(idx); std::string dir = File::GetUserPath(idx);
dir.pop_back(); // remove trailing path separator dir.pop_back(); // remove trailing path separator
return dir; return dir;

View File

@ -10,10 +10,10 @@
namespace Common namespace Common
{ {
enum FromWhichRoot enum class FromWhichRoot
{ {
FROM_CONFIGURED_ROOT, // not related to currently running game - use D_WIIROOT_IDX Configured, // not related to currently running game - use D_WIIROOT_IDX
FROM_SESSION_ROOT, // request from currently running game - use D_SESSION_WIIROOT_IDX Session, // request from currently running game - use D_SESSION_WIIROOT_IDX
}; };
std::string RootUserPath(FromWhichRoot from); std::string RootUserPath(FromWhichRoot from);

View File

@ -1473,8 +1473,8 @@ void GetSettings()
if (SConfig::GetInstance().bWii) if (SConfig::GetInstance().bWii)
{ {
u64 title_id = SConfig::GetInstance().GetTitleID(); u64 title_id = SConfig::GetInstance().GetTitleID();
s_bClearSave = !File::Exists(Common::GetTitleDataPath(title_id, Common::FROM_SESSION_ROOT) + s_bClearSave = !File::Exists(
"/banner.bin"); Common::GetTitleDataPath(title_id, Common::FromWhichRoot::Session) + "/banner.bin");
} }
else else
{ {

View File

@ -356,7 +356,7 @@ void InitializeWiiFileSystemContents(
File::CreateDirs(save_redirect->m_target_path); File::CreateDirs(save_redirect->m_target_path);
if (save_redirect->m_clone) if (save_redirect->m_clone)
{ {
File::Copy(Common::GetTitleDataPath(title_id, Common::FROM_SESSION_ROOT), File::Copy(Common::GetTitleDataPath(title_id, Common::FromWhichRoot::Session),
save_redirect->m_target_path); save_redirect->m_target_path);
} }
} }

View File

@ -870,7 +870,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
// Check for NANDs that were used with old Dolphin versions. // Check for NANDs that were used with old Dolphin versions.
const std::string sys_replace_path = const std::string sys_replace_path =
Common::RootUserPath(Common::FROM_CONFIGURED_ROOT) + "/sys/replace"; Common::RootUserPath(Common::FromWhichRoot::Configured) + "/sys/replace";
if (File::Exists(sys_replace_path)) if (File::Exists(sys_replace_path))
{ {
ERROR_LOG_FMT(CORE, ERROR_LOG_FMT(CORE,
@ -882,7 +882,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
} }
// Clean up after a bug fixed in https://github.com/dolphin-emu/dolphin/pull/8802 // Clean up after a bug fixed in https://github.com/dolphin-emu/dolphin/pull/8802
const std::string rfl_db_path = Common::GetMiiDatabasePath(Common::FROM_CONFIGURED_ROOT); const std::string rfl_db_path = Common::GetMiiDatabasePath(Common::FromWhichRoot::Configured);
const File::FileInfo rfl_db(rfl_db_path); const File::FileInfo rfl_db(rfl_db_path);
if (rfl_db.Exists() && rfl_db.GetSize() == 0) if (rfl_db.Exists() && rfl_db.GetSize() == 0)
{ {
@ -895,7 +895,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
for (const u64 title_id : es.GetInstalledTitles()) for (const u64 title_id : es.GetInstalledTitles())
{ {
const std::string title_dir = Common::GetTitlePath(title_id, Common::FROM_CONFIGURED_ROOT); const std::string title_dir = Common::GetTitlePath(title_id, Common::FromWhichRoot::Configured);
const std::string content_dir = title_dir + "/content"; const std::string content_dir = title_dir + "/content";
const std::string data_dir = title_dir + "/data"; const std::string data_dir = title_dir + "/data";

View File

@ -24,7 +24,7 @@ constexpr u32 ICON_HEIGHT = 48;
constexpr u32 ICON_SIZE = ICON_WIDTH * ICON_HEIGHT * 2; constexpr u32 ICON_SIZE = ICON_WIDTH * ICON_HEIGHT * 2;
WiiSaveBanner::WiiSaveBanner(u64 title_id) WiiSaveBanner::WiiSaveBanner(u64 title_id)
: WiiSaveBanner(Common::GetTitleDataPath(title_id, Common::FROM_CONFIGURED_ROOT) + : WiiSaveBanner(Common::GetTitleDataPath(title_id, Common::FromWhichRoot::Configured) +
"/banner.bin") "/banner.bin")
{ {
} }

View File

@ -731,7 +731,7 @@ GameFile::CompareSyncIdentifier(const NetPlay::SyncIdentifier& sync_identifier)
std::string GameFile::GetWiiFSPath() const std::string GameFile::GetWiiFSPath() const
{ {
ASSERT(DiscIO::IsWii(m_platform)); ASSERT(DiscIO::IsWii(m_platform));
return Common::GetTitleDataPath(m_title_id, Common::FROM_CONFIGURED_ROOT); return Common::GetTitleDataPath(m_title_id, Common::FromWhichRoot::Configured);
} }
bool GameFile::ShouldShowFileFormatDetails() const bool GameFile::ShouldShowFileFormatDetails() const