Core: Make format of D_WIIROOT_IDX consistent with the rest of the user directories.

This commit is contained in:
Admiral H. Curtiss 2021-11-22 03:20:17 +01:00
parent 3e1511ce98
commit e54657254a
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
6 changed files with 15 additions and 12 deletions

View File

@ -932,7 +932,7 @@ static void RebuildUserDirectories(unsigned int dir_index)
{
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_WIIROOT_IDX] = s_user_paths[D_USER_IDX] + WII_USER_DIR 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;
@ -978,7 +978,7 @@ static void RebuildUserDirectories(unsigned int dir_index)
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;
s_user_paths[F_GCSRAM_IDX] = s_user_paths[D_GCUSER_IDX] + GC_SRAM;
s_user_paths[F_WIISDCARD_IDX] = s_user_paths[D_WIIROOT_IDX] + DIR_SEP WII_SDCARD;
s_user_paths[F_WIISDCARD_IDX] = s_user_paths[D_WIIROOT_IDX] + WII_SDCARD;
s_user_paths[D_MEMORYWATCHER_IDX] = s_user_paths[D_USER_IDX] + MEMORYWATCHER_DIR DIR_SEP;
s_user_paths[F_MEMORYWATCHERLOCATIONS_IDX] =

View File

@ -19,7 +19,9 @@ namespace Common
std::string RootUserPath(FromWhichRoot from)
{
int idx = from == FROM_CONFIGURED_ROOT ? D_WIIROOT_IDX : D_SESSION_WIIROOT_IDX;
return File::GetUserPath(idx);
std::string dir = File::GetUserPath(idx);
dir.pop_back(); // remove trailing path separator
return dir;
}
static std::string RootUserPath(std::optional<FromWhichRoot> from)

View File

@ -117,6 +117,8 @@ HostFileSystem::HostFileSystem(const std::string& root_path,
std::vector<NandRedirect> nand_redirects)
: m_root_path{root_path}, m_nand_redirects(std::move(nand_redirects))
{
while (StringEndsWith(m_root_path, "/"))
m_root_path.pop_back();
File::CreateFullPath(m_root_path + "/");
ResetFst();
LoadFst();

View File

@ -557,7 +557,7 @@ void IOSC::LoadDefaultEntries(ConsoleType console_type)
void IOSC::LoadEntries()
{
File::IOFile file{File::GetUserPath(D_WIIROOT_IDX) + "/keys.bin", "rb"};
File::IOFile file{File::GetUserPath(D_WIIROOT_IDX) + "keys.bin", "rb"};
if (!file)
{
WARN_LOG_FMT(IOS, "keys.bin could not be found. Default values will be used.");

View File

@ -65,14 +65,14 @@ static bool CopyBackupFile(const std::string& path_from, const std::string& path
static void DeleteBackupFile(const std::string& file_name)
{
File::Delete(File::GetUserPath(D_BACKUP_IDX) + DIR_SEP + file_name);
File::Delete(File::GetUserPath(D_BACKUP_IDX) + file_name);
}
static void BackupFile(const std::string& path_in_nand)
{
const std::string file_name = PathToFileName(path_in_nand);
const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP + path_in_nand;
const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + DIR_SEP + file_name;
const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + path_in_nand;
const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + file_name;
CopyBackupFile(original_path, backup_path);
}
@ -80,8 +80,8 @@ static void BackupFile(const std::string& path_in_nand)
static void RestoreFile(const std::string& path_in_nand)
{
const std::string file_name = PathToFileName(path_in_nand);
const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP + path_in_nand;
const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + DIR_SEP + file_name;
const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + path_in_nand;
const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + file_name;
if (CopyBackupFile(backup_path, original_path))
DeleteBackupFile(file_name);

View File

@ -34,10 +34,9 @@ void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
if (!ReadNANDBin(path_to_bin, get_otp_dump_path))
return;
const std::string nand_root = File::GetUserPath(D_WIIROOT_IDX);
std::string nand_root = File::GetUserPath(D_WIIROOT_IDX);
nand_root.pop_back(); // remove trailing path separator
m_nand_root_length = nand_root.length();
if (nand_root.back() == '/')
m_nand_root_length++;
FindSuperblock();
ProcessEntry(0, nand_root);