mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
Rename path _utf8Wrapper to _utf8ToPath for better clarity
This commit is contained in:
parent
168ecf8825
commit
680beaaf21
@ -209,7 +209,7 @@ void InfoLog_TitleLoaded()
|
|||||||
fs::path effectiveSavePath = getTitleSavePath();
|
fs::path effectiveSavePath = getTitleSavePath();
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
const bool saveDirExists = fs::exists(effectiveSavePath, ec);
|
const bool saveDirExists = fs::exists(effectiveSavePath, ec);
|
||||||
cemuLog_force("Save path: {}{}", _utf8Wrapper(effectiveSavePath), saveDirExists ? "" : " (not present)");
|
cemuLog_force("Save path: {}{}", _pathToUtf8(effectiveSavePath), saveDirExists ? "" : " (not present)");
|
||||||
|
|
||||||
// log shader cache name
|
// log shader cache name
|
||||||
cemuLog_log(LogType::Force, "Shader cache file: shaderCache/transferable/{:016x}.bin", titleId);
|
cemuLog_log(LogType::Force, "Shader cache file: shaderCache/transferable/{:016x}.bin", titleId);
|
||||||
@ -617,7 +617,7 @@ namespace CafeSystem
|
|||||||
sLaunchModeIsStandalone = true;
|
sLaunchModeIsStandalone = true;
|
||||||
cemuLog_log(LogType::Force, "Launching executable in standalone mode due to incorrect layout or missing meta files");
|
cemuLog_log(LogType::Force, "Launching executable in standalone mode due to incorrect layout or missing meta files");
|
||||||
fs::path executablePath = path;
|
fs::path executablePath = path;
|
||||||
std::string dirName = _utf8Wrapper(executablePath.parent_path().filename());
|
std::string dirName = _pathToUtf8(executablePath.parent_path().filename());
|
||||||
if (boost::iequals(dirName, "code"))
|
if (boost::iequals(dirName, "code"))
|
||||||
{
|
{
|
||||||
// check for content folder
|
// check for content folder
|
||||||
@ -626,18 +626,18 @@ namespace CafeSystem
|
|||||||
if (fs::is_directory(contentPath, ec))
|
if (fs::is_directory(contentPath, ec))
|
||||||
{
|
{
|
||||||
// mounting content folder
|
// mounting content folder
|
||||||
bool r = FSCDeviceHostFS_Mount(std::string("/vol/content").c_str(), _utf8Wrapper(contentPath), FSC_PRIORITY_BASE);
|
bool r = FSCDeviceHostFS_Mount(std::string("/vol/content").c_str(), _pathToUtf8(contentPath), FSC_PRIORITY_BASE);
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Failed to mount {}", _utf8Wrapper(contentPath).c_str());
|
cemuLog_log(LogType::Force, "Failed to mount {}", _pathToUtf8(contentPath));
|
||||||
return STATUS_CODE::UNABLE_TO_MOUNT;
|
return STATUS_CODE::UNABLE_TO_MOUNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// mount code folder to a virtual temporary path
|
// mount code folder to a virtual temporary path
|
||||||
FSCDeviceHostFS_Mount(std::string("/internal/code/").c_str(), _utf8Wrapper(executablePath.parent_path()), FSC_PRIORITY_BASE);
|
FSCDeviceHostFS_Mount(std::string("/internal/code/").c_str(), _pathToUtf8(executablePath.parent_path()), FSC_PRIORITY_BASE);
|
||||||
std::string internalExecutablePath = "/internal/code/";
|
std::string internalExecutablePath = "/internal/code/";
|
||||||
internalExecutablePath.append(_utf8Wrapper(executablePath.filename()));
|
internalExecutablePath.append(_pathToUtf8(executablePath.filename()));
|
||||||
_pathToExecutable = internalExecutablePath;
|
_pathToExecutable = internalExecutablePath;
|
||||||
// since a lot of systems (including save folder location) rely on a TitleId, we derive a placeholder id from the executable hash
|
// since a lot of systems (including save folder location) rely on a TitleId, we derive a placeholder id from the executable hash
|
||||||
auto execData = fsc_extractFile(_pathToExecutable.c_str());
|
auto execData = fsc_extractFile(_pathToExecutable.c_str());
|
||||||
|
@ -127,7 +127,7 @@ bool FSCVirtualFile_Host::fscDirNext(FSCDirEntry* dirEntry)
|
|||||||
m_dirIterator.reset(new fs::directory_iterator(*m_path));
|
m_dirIterator.reset(new fs::directory_iterator(*m_path));
|
||||||
if (!m_dirIterator)
|
if (!m_dirIterator)
|
||||||
{
|
{
|
||||||
cemuLog_force("Failed to iterate directory: {}", _utf8Wrapper(m_path->generic_u8string()));
|
cemuLog_force("Failed to iterate directory: {}", _pathToUtf8(*m_path));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,14 +175,14 @@ FSCVirtualFile* FSCVirtualFile_Host::OpenFile(const fs::path& path, FSC_ACCESS_F
|
|||||||
cemu_assert_debug(writeAccessRequested);
|
cemu_assert_debug(writeAccessRequested);
|
||||||
fs = FileStream::createFile2(path);
|
fs = FileStream::createFile2(path);
|
||||||
if (!fs)
|
if (!fs)
|
||||||
cemuLog_force("FSC: File create failed for {}", _utf8Wrapper(path));
|
cemuLog_force("FSC: File create failed for {}", _pathToUtf8(path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::FILE_ALWAYS_CREATE))
|
else if (HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::FILE_ALWAYS_CREATE))
|
||||||
{
|
{
|
||||||
fs = FileStream::createFile2(path);
|
fs = FileStream::createFile2(path);
|
||||||
if (!fs)
|
if (!fs)
|
||||||
cemuLog_force("FSC: File create failed for {}", _utf8Wrapper(path));
|
cemuLog_force("FSC: File create failed for {}", _pathToUtf8(path));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -293,8 +293,8 @@ public:
|
|||||||
void fscDeviceHostFS_mapBaseDirectories_deprecated()
|
void fscDeviceHostFS_mapBaseDirectories_deprecated()
|
||||||
{
|
{
|
||||||
const auto mlc = ActiveSettings::GetMlcPath();
|
const auto mlc = ActiveSettings::GetMlcPath();
|
||||||
fsc_mount("/cemuBossStorage/", _utf8Wrapper(mlc / "usr/boss/"), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE);
|
fsc_mount("/cemuBossStorage/", _pathToUtf8(mlc / "usr/boss/"), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE);
|
||||||
fsc_mount("/vol/storage_mlc01/", _utf8Wrapper(mlc / ""), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE);
|
fsc_mount("/vol/storage_mlc01/", _pathToUtf8(mlc / ""), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FSCDeviceHostFS_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority)
|
bool FSCDeviceHostFS_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority)
|
||||||
|
@ -31,12 +31,12 @@ void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath)
|
|||||||
|
|
||||||
if (!iniParser.NextSection())
|
if (!iniParser.NextSection())
|
||||||
{
|
{
|
||||||
cemuLog_force("{}: Does not contain any sections", _utf8Wrapper(rulesPath));
|
cemuLog_force("{}: Does not contain any sections", _pathToUtf8(rulesPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!boost::iequals(iniParser.GetCurrentSectionName(), "Definition"))
|
if (!boost::iequals(iniParser.GetCurrentSectionName(), "Definition"))
|
||||||
{
|
{
|
||||||
cemuLog_force("{}: [Definition] must be the first section", _utf8Wrapper(rulesPath));
|
cemuLog_force("{}: [Definition] must be the first section", _pathToUtf8(rulesPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath)
|
|||||||
auto [ptr, ec] = std::from_chars(option_version->data(), option_version->data() + option_version->size(), versionNum);
|
auto [ptr, ec] = std::from_chars(option_version->data(), option_version->data() + option_version->size(), versionNum);
|
||||||
if (ec != std::errc{})
|
if (ec != std::errc{})
|
||||||
{
|
{
|
||||||
cemuLog_force("{}: Unable to parse version", _utf8Wrapper(rulesPath));
|
cemuLog_force("{}: Unable to parse version", _pathToUtf8(rulesPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cemuLog_force("{}: Outdated graphic pack", _utf8Wrapper(rulesPath));
|
cemuLog_force("{}: Outdated graphic pack", _pathToUtf8(rulesPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicPack2::LoadAll()
|
void GraphicPack2::LoadAll()
|
||||||
|
@ -109,7 +109,7 @@ namespace coreinit
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
const auto path = ActiveSettings::GetPath("sdcard/");
|
const auto path = ActiveSettings::GetPath("sdcard/");
|
||||||
fs::create_directories(path, ec);
|
fs::create_directories(path, ec);
|
||||||
FSCDeviceHostFS_Mount("/vol/external01", _utf8Wrapper(path), FSC_PRIORITY_BASE);
|
FSCDeviceHostFS_Mount("/vol/external01", _pathToUtf8(path), FSC_PRIORITY_BASE);
|
||||||
|
|
||||||
_sdCard01Mounted = true;
|
_sdCard01Mounted = true;
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ namespace coreinit
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
const auto path = ActiveSettings::GetPath("sdcard/");
|
const auto path = ActiveSettings::GetPath("sdcard/");
|
||||||
fs::create_directories(path, ec);
|
fs::create_directories(path, ec);
|
||||||
if (!FSCDeviceHostFS_Mount(mountPathOut, _utf8Wrapper(path), FSC_PRIORITY_BASE))
|
if (!FSCDeviceHostFS_Mount(mountPathOut, _pathToUtf8(path), FSC_PRIORITY_BASE))
|
||||||
return FS_RESULT::ERR_PLACEHOLDER;
|
return FS_RESULT::ERR_PLACEHOLDER;
|
||||||
_sdCard01Mounted = true;
|
_sdCard01Mounted = true;
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ namespace coreinit
|
|||||||
if (_mlc01Mounted)
|
if (_mlc01Mounted)
|
||||||
return FS_RESULT::ERR_PLACEHOLDER;
|
return FS_RESULT::ERR_PLACEHOLDER;
|
||||||
|
|
||||||
if (!FSCDeviceHostFS_Mount(mountPathOut, _utf8Wrapper(ActiveSettings::GetMlcPath()), FSC_PRIORITY_BASE))
|
if (!FSCDeviceHostFS_Mount(mountPathOut, _pathToUtf8(ActiveSettings::GetMlcPath()), FSC_PRIORITY_BASE))
|
||||||
return FS_RESULT::ERR_PLACEHOLDER;
|
return FS_RESULT::ERR_PLACEHOLDER;
|
||||||
_mlc01Mounted = true;
|
_mlc01Mounted = true;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace acp
|
|||||||
|
|
||||||
// mount save path
|
// mount save path
|
||||||
const auto mlc = ActiveSettings::GetMlcPath("usr/save/{:08x}/{:08x}/user/", high, low);
|
const auto mlc = ActiveSettings::GetMlcPath("usr/save/{:08x}/{:08x}/user/", high, low);
|
||||||
FSCDeviceHostFS_Mount("/vol/save/", _utf8Wrapper(mlc), FSC_PRIORITY_BASE);
|
FSCDeviceHostFS_Mount("/vol/save/", _pathToUtf8(mlc), FSC_PRIORITY_BASE);
|
||||||
nnResult mountResult = BUILD_NN_RESULT(NN_RESULT_LEVEL_SUCCESS, NN_RESULT_MODULE_NN_ACP, 0);
|
nnResult mountResult = BUILD_NN_RESULT(NN_RESULT_LEVEL_SUCCESS, NN_RESULT_MODULE_NN_ACP, 0);
|
||||||
return _ACPConvertResultToACPStatus(&mountResult, "ACPMountSaveDir", 0x60);
|
return _ACPConvertResultToACPStatus(&mountResult, "ACPMountSaveDir", 0x60);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ void CafeSaveList::RefreshThreadWorker()
|
|||||||
{
|
{
|
||||||
if(!it_titleHigh.is_directory(ec))
|
if(!it_titleHigh.is_directory(ec))
|
||||||
continue;
|
continue;
|
||||||
std::string dirName = _utf8Wrapper(it_titleHigh.path().filename());
|
std::string dirName = _pathToUtf8(it_titleHigh.path().filename());
|
||||||
if(dirName.empty())
|
if(dirName.empty())
|
||||||
continue;
|
continue;
|
||||||
uint32 titleIdHigh;
|
uint32 titleIdHigh;
|
||||||
@ -78,7 +78,7 @@ void CafeSaveList::RefreshThreadWorker()
|
|||||||
{
|
{
|
||||||
if (!it_titleLow.is_directory(ec))
|
if (!it_titleLow.is_directory(ec))
|
||||||
continue;
|
continue;
|
||||||
dirName = _utf8Wrapper(it_titleLow.path().filename());
|
dirName = _pathToUtf8(it_titleLow.path().filename());
|
||||||
if (dirName.empty())
|
if (dirName.empty())
|
||||||
continue;
|
continue;
|
||||||
uint32 titleIdLow;
|
uint32 titleIdLow;
|
||||||
|
@ -177,12 +177,12 @@ bool TitleInfo::DetectFormat(const fs::path& path, fs::path& pathOut, TitleDataF
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
if (path.has_extension() && fs::is_regular_file(path, ec))
|
if (path.has_extension() && fs::is_regular_file(path, ec))
|
||||||
{
|
{
|
||||||
std::string filenameStr = _utf8Wrapper(path.filename());
|
std::string filenameStr = _pathToUtf8(path.filename());
|
||||||
if (boost::iends_with(filenameStr, ".rpx"))
|
if (boost::iends_with(filenameStr, ".rpx"))
|
||||||
{
|
{
|
||||||
// is in code folder?
|
// is in code folder?
|
||||||
fs::path parentPath = path.parent_path();
|
fs::path parentPath = path.parent_path();
|
||||||
if (boost::iequals(_utf8Wrapper(parentPath.filename()), "code"))
|
if (boost::iequals(_pathToUtf8(parentPath.filename()), "code"))
|
||||||
{
|
{
|
||||||
parentPath = parentPath.parent_path();
|
parentPath = parentPath.parent_path();
|
||||||
// next to content and meta?
|
// next to content and meta?
|
||||||
@ -370,7 +370,7 @@ bool TitleInfo::Mount(std::string_view virtualPath, std::string_view subfolder,
|
|||||||
{
|
{
|
||||||
fs::path hostFSPath = m_fullPath;
|
fs::path hostFSPath = m_fullPath;
|
||||||
hostFSPath.append(subfolder);
|
hostFSPath.append(subfolder);
|
||||||
bool r = FSCDeviceHostFS_Mount(std::string(virtualPath).c_str(), _utf8Wrapper(hostFSPath), mountPriority);
|
bool r = FSCDeviceHostFS_Mount(std::string(virtualPath).c_str(), _pathToUtf8(hostFSPath), mountPriority);
|
||||||
cemu_assert_debug(r);
|
cemu_assert_debug(r);
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
{
|
||||||
@ -495,7 +495,7 @@ bool TitleInfo::ParseXmlInfo()
|
|||||||
if (!m_parsedMetaXml || !m_parsedAppXml || !m_parsedCosXml)
|
if (!m_parsedMetaXml || !m_parsedAppXml || !m_parsedCosXml)
|
||||||
{
|
{
|
||||||
if (hasAnyXml)
|
if (hasAnyXml)
|
||||||
cemuLog_log(LogType::Force, "Title has missing meta .xml files. Title path: {}", _utf8Wrapper(m_fullPath));
|
cemuLog_log(LogType::Force, "Title has missing meta .xml files. Title path: {}", _pathToUtf8(m_fullPath));
|
||||||
delete m_parsedMetaXml;
|
delete m_parsedMetaXml;
|
||||||
delete m_parsedAppXml;
|
delete m_parsedAppXml;
|
||||||
delete m_parsedCosXml;
|
delete m_parsedCosXml;
|
||||||
@ -621,7 +621,7 @@ std::string TitleInfo::GetPrintPath() const
|
|||||||
if (!m_isValid)
|
if (!m_isValid)
|
||||||
return "invalid";
|
return "invalid";
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
tmp.append(_utf8Wrapper(m_fullPath));
|
tmp.append(_pathToUtf8(m_fullPath));
|
||||||
switch (m_titleFormat)
|
switch (m_titleFormat)
|
||||||
{
|
{
|
||||||
case TitleDataFormat::HOST_FS:
|
case TitleDataFormat::HOST_FS:
|
||||||
|
@ -120,16 +120,16 @@ void CafeTitleList::StoreCacheFile()
|
|||||||
titleInfoNode.append_child("region").append_child(pugi::node_pcdata).set_value(fmt::format("{}", (uint32)info.region).c_str());
|
titleInfoNode.append_child("region").append_child(pugi::node_pcdata).set_value(fmt::format("{}", (uint32)info.region).c_str());
|
||||||
titleInfoNode.append_child("name").append_child(pugi::node_pcdata).set_value(info.titleName.c_str());
|
titleInfoNode.append_child("name").append_child(pugi::node_pcdata).set_value(info.titleName.c_str());
|
||||||
titleInfoNode.append_child("format").append_child(pugi::node_pcdata).set_value(fmt::format("{}", (uint32)info.titleDataFormat).c_str());
|
titleInfoNode.append_child("format").append_child(pugi::node_pcdata).set_value(fmt::format("{}", (uint32)info.titleDataFormat).c_str());
|
||||||
titleInfoNode.append_child("path").append_child(pugi::node_pcdata).set_value(_utf8Wrapper(info.path).c_str());
|
titleInfoNode.append_child("path").append_child(pugi::node_pcdata).set_value(_pathToUtf8(info.path).c_str());
|
||||||
if(!info.subPath.empty())
|
if(!info.subPath.empty())
|
||||||
titleInfoNode.append_child("sub_path").append_child(pugi::node_pcdata).set_value(_utf8Wrapper(info.subPath).c_str());
|
titleInfoNode.append_child("sub_path").append_child(pugi::node_pcdata).set_value(_pathToUtf8(info.subPath).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::path tmpPath = fs::path(sTLCacheFilePath.parent_path()).append(fmt::format("{}__tmp", _utf8Wrapper(sTLCacheFilePath.filename())));
|
fs::path tmpPath = fs::path(sTLCacheFilePath.parent_path()).append(fmt::format("{}__tmp", _pathToUtf8(sTLCacheFilePath.filename())));
|
||||||
std::ofstream fileOut(tmpPath, std::ios::out | std::ios::binary | std::ios::trunc);
|
std::ofstream fileOut(tmpPath, std::ios::out | std::ios::binary | std::ios::trunc);
|
||||||
if (!fileOut.is_open())
|
if (!fileOut.is_open())
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Unable to store title list in {}", _utf8Wrapper(tmpPath));
|
cemuLog_log(LogType::Force, "Unable to store title list in {}", _pathToUtf8(tmpPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
doc.save(fileOut, " ", 1, pugi::xml_encoding::encoding_utf8);
|
doc.save(fileOut, " ", 1, pugi::xml_encoding::encoding_utf8);
|
||||||
@ -158,7 +158,7 @@ void CafeTitleList::SetMLCPath(fs::path path)
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
if (!fs::is_directory(path, ec))
|
if (!fs::is_directory(path, ec))
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "MLC set to invalid path: {}", _utf8Wrapper(path));
|
cemuLog_log(LogType::Force, "MLC set to invalid path: {}", _pathToUtf8(path));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sTLMLCPath = path;
|
sTLMLCPath = path;
|
||||||
@ -211,12 +211,12 @@ void _RemoveTitleFromMultimap(TitleInfo* titleInfo)
|
|||||||
// in the special case that path points to a WUA file, all contained titles will be added
|
// in the special case that path points to a WUA file, all contained titles will be added
|
||||||
void CafeTitleList::AddTitleFromPath(fs::path path)
|
void CafeTitleList::AddTitleFromPath(fs::path path)
|
||||||
{
|
{
|
||||||
if (path.has_extension() && boost::iequals(_utf8Wrapper(path.extension()), ".wua"))
|
if (path.has_extension() && boost::iequals(_pathToUtf8(path.extension()), ".wua"))
|
||||||
{
|
{
|
||||||
ZArchiveReader* zar = ZArchiveReader::OpenFromFile(path);
|
ZArchiveReader* zar = ZArchiveReader::OpenFromFile(path);
|
||||||
if (!zar)
|
if (!zar)
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Found {} but it is not a valid Wii U archive file", _utf8Wrapper(path));
|
cemuLog_log(LogType::Force, "Found {} but it is not a valid Wii U archive file", _pathToUtf8(path));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// enumerate all contained titles
|
// enumerate all contained titles
|
||||||
@ -233,7 +233,7 @@ void CafeTitleList::AddTitleFromPath(fs::path path)
|
|||||||
uint16 parsedVersion;
|
uint16 parsedVersion;
|
||||||
if (!TitleInfo::ParseWuaTitleFolderName(dirEntry.name, parsedId, parsedVersion))
|
if (!TitleInfo::ParseWuaTitleFolderName(dirEntry.name, parsedId, parsedVersion))
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Invalid title directory in {}: \"{}\"", _utf8Wrapper(path), dirEntry.name);
|
cemuLog_log(LogType::Force, "Invalid title directory in {}: \"{}\"", _pathToUtf8(path), dirEntry.name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// valid subdirectory
|
// valid subdirectory
|
||||||
@ -351,7 +351,7 @@ void CafeTitleList::ScanGamePath(const fs::path& path)
|
|||||||
{
|
{
|
||||||
dirsInDirectory.emplace_back(it.path());
|
dirsInDirectory.emplace_back(it.path());
|
||||||
|
|
||||||
std::string dirName = _utf8Wrapper(it.path().filename());
|
std::string dirName = _pathToUtf8(it.path().filename());
|
||||||
if (boost::iequals(dirName, "content"))
|
if (boost::iequals(dirName, "content"))
|
||||||
hasContentFolder = true;
|
hasContentFolder = true;
|
||||||
else if (boost::iequals(dirName, "code"))
|
else if (boost::iequals(dirName, "code"))
|
||||||
@ -366,7 +366,7 @@ void CafeTitleList::ScanGamePath(const fs::path& path)
|
|||||||
// since checking files is slow, we only do it for known file extensions
|
// since checking files is slow, we only do it for known file extensions
|
||||||
if (!it.has_extension())
|
if (!it.has_extension())
|
||||||
continue;
|
continue;
|
||||||
if (!_IsKnownFileExtension(_utf8Wrapper(it.extension())))
|
if (!_IsKnownFileExtension(_pathToUtf8(it.extension())))
|
||||||
continue;
|
continue;
|
||||||
AddTitleFromPath(it);
|
AddTitleFromPath(it);
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ void CafeTitleList::ScanGamePath(const fs::path& path)
|
|||||||
{
|
{
|
||||||
for (auto& it : dirsInDirectory)
|
for (auto& it : dirsInDirectory)
|
||||||
{
|
{
|
||||||
std::string dirName = _utf8Wrapper(it.filename());
|
std::string dirName = _pathToUtf8(it.filename());
|
||||||
if (!boost::iequals(dirName, "content") &&
|
if (!boost::iequals(dirName, "content") &&
|
||||||
!boost::iequals(dirName, "code") &&
|
!boost::iequals(dirName, "code") &&
|
||||||
!boost::iequals(dirName, "meta"))
|
!boost::iequals(dirName, "meta"))
|
||||||
@ -408,7 +408,7 @@ void CafeTitleList::ScanMLCPath(const fs::path& path)
|
|||||||
if (!it.is_directory())
|
if (!it.is_directory())
|
||||||
continue;
|
continue;
|
||||||
// only scan directories which match the title id naming scheme
|
// only scan directories which match the title id naming scheme
|
||||||
std::string dirName = _utf8Wrapper(it.path().filename());
|
std::string dirName = _pathToUtf8(it.path().filename());
|
||||||
if(dirName.size() != 8)
|
if(dirName.size() != 8)
|
||||||
continue;
|
continue;
|
||||||
bool containsNoHexCharacter = false;
|
bool containsNoHexCharacter = false;
|
||||||
|
@ -420,21 +420,14 @@ inline std::string_view _utf8Wrapper(std::u8string_view input)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a std::u8string as std::string, the contents are left as-is
|
// convert fs::path to utf8 encoded string
|
||||||
inline std::string _utf8Wrapper(const std::u8string& u8str)
|
inline std::string _pathToUtf8(const fs::path& path)
|
||||||
{
|
{
|
||||||
std::string v;
|
std::u8string strU8 = path.generic_u8string();
|
||||||
v.resize(u8str.size());
|
std::string v((const char*)strU8.data(), strU8.size());
|
||||||
memcpy(v.data(), u8str.data(), u8str.size());
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get utf8 generic path string directly from std::filesystem::path
|
|
||||||
inline std::string _utf8Wrapper(const fs::path& path)
|
|
||||||
{
|
|
||||||
return _utf8Wrapper(path.generic_u8string());
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert utf8 encoded string to fs::path
|
// convert utf8 encoded string to fs::path
|
||||||
inline fs::path _utf8ToPath(std::string_view input)
|
inline fs::path _utf8ToPath(std::string_view input)
|
||||||
{
|
{
|
||||||
|
@ -417,7 +417,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
|
|||||||
for (const auto& game : graphic_pack_entries)
|
for (const auto& game : graphic_pack_entries)
|
||||||
{
|
{
|
||||||
auto entry = graphic_pack_parser.set("Entry");
|
auto entry = graphic_pack_parser.set("Entry");
|
||||||
entry.set_attribute("filename",_utf8Wrapper(game.first).c_str());
|
entry.set_attribute("filename",_pathToUtf8(game.first).c_str());
|
||||||
for(const auto& kv : game.second)
|
for(const auto& kv : game.second)
|
||||||
{
|
{
|
||||||
// TODO: less hacky pls
|
// TODO: less hacky pls
|
||||||
|
@ -251,7 +251,7 @@ void GameUpdateWindow::ThreadWork()
|
|||||||
error_msg << GetSystemErrorMessage(ex);
|
error_msg << GetSystemErrorMessage(ex);
|
||||||
|
|
||||||
if(currentDirEntry != fs::directory_entry{})
|
if(currentDirEntry != fs::directory_entry{})
|
||||||
error_msg << fmt::format("\n{}\n{}",_("Current file:").ToStdString(), _utf8Wrapper(currentDirEntry.path()));
|
error_msg << fmt::format("\n{}\n{}",_("Current file:").ToStdString(), _pathToUtf8(currentDirEntry.path()));
|
||||||
|
|
||||||
m_thread_exception = error_msg.str();
|
m_thread_exception = error_msg.str();
|
||||||
m_thread_state = ThreadCanceled;
|
m_thread_state = ThreadCanceled;
|
||||||
|
@ -1947,7 +1947,7 @@ public:
|
|||||||
"/*****************************************************************************/\r\n"
|
"/*****************************************************************************/\r\n"
|
||||||
);
|
);
|
||||||
delete fs;
|
delete fs;
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(tempPath))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(tempPath))));
|
||||||
});
|
});
|
||||||
lineSizer->Add(noticeLink, 0);
|
lineSizer->Add(noticeLink, 0);
|
||||||
lineSizer->Add(new wxStaticText(parent, -1, ")"), 0);
|
lineSizer->Add(new wxStaticText(parent, -1, ")"), 0);
|
||||||
|
@ -275,7 +275,7 @@ void MemorySearcherTool::Load()
|
|||||||
if (!memSearcherIniContents)
|
if (!memSearcherIniContents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IniParser iniParser(*memSearcherIniContents, _utf8Wrapper(memorySearcherPath));
|
IniParser iniParser(*memSearcherIniContents, _pathToUtf8(memorySearcherPath));
|
||||||
while (iniParser.NextSection())
|
while (iniParser.NextSection())
|
||||||
{
|
{
|
||||||
auto option_description = iniParser.FindOption("description");
|
auto option_description = iniParser.FindOption("description");
|
||||||
|
@ -480,7 +480,7 @@ void TitleManager::OnSaveOpenDirectory(wxCommandEvent& event)
|
|||||||
if (!fs::exists(target) || !fs::is_directory(target))
|
if (!fs::exists(target) || !fs::is_directory(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(target))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(target))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleManager::OnSaveDelete(wxCommandEvent& event)
|
void TitleManager::OnSaveDelete(wxCommandEvent& event)
|
||||||
|
@ -563,7 +563,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
fs::path path(gameInfo.GetBase().GetPath());
|
fs::path path(gameInfo.GetBase().GetPath());
|
||||||
_stripPathFilename(path);
|
_stripPathFilename(path);
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kWikiPage:
|
case kWikiPage:
|
||||||
@ -584,21 +584,21 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
|
|
||||||
case kContextMenuSaveFolder:
|
case kContextMenuSaveFolder:
|
||||||
{
|
{
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(gameInfo.GetSaveFolder()))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(gameInfo.GetSaveFolder()))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kContextMenuUpdateFolder:
|
case kContextMenuUpdateFolder:
|
||||||
{
|
{
|
||||||
fs::path path(gameInfo.GetUpdate().GetPath());
|
fs::path path(gameInfo.GetUpdate().GetPath());
|
||||||
_stripPathFilename(path);
|
_stripPathFilename(path);
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kContextMenuDLCFolder:
|
case kContextMenuDLCFolder:
|
||||||
{
|
{
|
||||||
fs::path path(gameInfo.GetAOC().front().GetPath());
|
fs::path path(gameInfo.GetAOC().front().GetPath());
|
||||||
_stripPathFilename(path);
|
_stripPathFilename(path);
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kContextMenuEditGraphicPacks:
|
case kContextMenuEditGraphicPacks:
|
||||||
|
@ -293,21 +293,21 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId)
|
|||||||
std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):\n \n"));
|
std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):\n \n"));
|
||||||
|
|
||||||
if (titleInfo_base.IsValid())
|
if (titleInfo_base.IsValid())
|
||||||
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _utf8Wrapper(titleInfo_base.GetPath())));
|
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _pathToUtf8(titleInfo_base.GetPath())));
|
||||||
else
|
else
|
||||||
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: Not installed")))));
|
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: Not installed")))));
|
||||||
|
|
||||||
msg.append("\n");
|
msg.append("\n");
|
||||||
|
|
||||||
if (titleInfo_update.IsValid())
|
if (titleInfo_update.IsValid())
|
||||||
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: {}"))), _utf8Wrapper(titleInfo_update.GetPath())));
|
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: {}"))), _pathToUtf8(titleInfo_update.GetPath())));
|
||||||
else
|
else
|
||||||
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: Not installed")))));
|
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: Not installed")))));
|
||||||
|
|
||||||
msg.append("\n");
|
msg.append("\n");
|
||||||
|
|
||||||
if (titleInfo_aoc.IsValid())
|
if (titleInfo_aoc.IsValid())
|
||||||
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: {}"))), _utf8Wrapper(titleInfo_aoc.GetPath())));
|
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: {}"))), _pathToUtf8(titleInfo_aoc.GetPath())));
|
||||||
else
|
else
|
||||||
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: Not installed")))));
|
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: Not installed")))));
|
||||||
|
|
||||||
@ -778,9 +778,9 @@ bool wxTitleManagerList::DeleteEntry(long index, const TitleEntry& entry)
|
|||||||
wxString msg;
|
wxString msg;
|
||||||
const bool is_directory = fs::is_directory(entry.path);
|
const bool is_directory = fs::is_directory(entry.path);
|
||||||
if(is_directory)
|
if(is_directory)
|
||||||
msg = wxStringFormat2(_("Are you really sure that you want to delete the following folder:\n{}"), wxHelper::FromUtf8(_utf8Wrapper(entry.path)));
|
msg = wxStringFormat2(_("Are you really sure that you want to delete the following folder:\n{}"), wxHelper::FromUtf8(_pathToUtf8(entry.path)));
|
||||||
else
|
else
|
||||||
msg = wxStringFormat2(_("Are you really sure that you want to delete the following file:\n{}"), wxHelper::FromUtf8(_utf8Wrapper(entry.path)));
|
msg = wxStringFormat2(_("Are you really sure that you want to delete the following file:\n{}"), wxHelper::FromUtf8(_pathToUtf8(entry.path)));
|
||||||
|
|
||||||
const auto result = wxMessageBox(msg, _("Warning"), wxYES_NO | wxCENTRE | wxICON_EXCLAMATION, this);
|
const auto result = wxMessageBox(msg, _("Warning"), wxYES_NO | wxCENTRE | wxICON_EXCLAMATION, this);
|
||||||
if (result == wxNO)
|
if (result == wxNO)
|
||||||
@ -852,7 +852,7 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
case kContextMenuOpenDirectory:
|
case kContextMenuOpenDirectory:
|
||||||
{
|
{
|
||||||
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
|
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kContextMenuDelete:
|
case kContextMenuDelete:
|
||||||
|
@ -170,7 +170,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
if (!fs::is_directory(target_path))
|
if (!fs::is_directory(target_path))
|
||||||
{
|
{
|
||||||
const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _utf8Wrapper(target_path));
|
const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _pathToUtf8(target_path));
|
||||||
wxMessageBox(msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
wxMessageBox(msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||||
m_return_code = wxCANCEL;
|
m_return_code = wxCANCEL;
|
||||||
Close();
|
Close();
|
||||||
|
@ -108,7 +108,7 @@ void SaveTransfer::OnTransfer(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
if(!fs::is_directory(target_path))
|
if(!fs::is_directory(target_path))
|
||||||
{
|
{
|
||||||
const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _utf8Wrapper(target_path));
|
const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _pathToUtf8(target_path));
|
||||||
wxMessageBox(msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
wxMessageBox(msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||||
m_return_code = wxCANCEL;
|
m_return_code = wxCANCEL;
|
||||||
Close();
|
Close();
|
||||||
|
@ -166,7 +166,7 @@ void reconfigureGLDrivers()
|
|||||||
fs::create_directories(nvCacheDir, err);
|
fs::create_directories(nvCacheDir, err);
|
||||||
|
|
||||||
std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH=");
|
std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH=");
|
||||||
nvCacheDirEnvOption.append(_utf8Wrapper(nvCacheDir));
|
nvCacheDirEnvOption.append(_pathToUtf8(nvCacheDir));
|
||||||
|
|
||||||
#if BOOST_OS_WINDOWS
|
#if BOOST_OS_WINDOWS
|
||||||
std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption);
|
std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption);
|
||||||
|
Loading…
Reference in New Issue
Block a user