Refactor more wstring instances to utf8-encoded string

This commit is contained in:
Exzap 2023-09-28 02:51:40 +02:00
parent f6c3c96d94
commit abce406ee8
26 changed files with 82 additions and 114 deletions

View file

@ -40,7 +40,7 @@ ActiveSettings::LoadOnce(
g_config.SetFilename(GetConfigPath("settings.xml").generic_wstring());
g_config.Load();
LaunchSettings::ChangeNetworkServiceURL(GetConfig().account.active_service);
std::wstring additionalErrorInfo;
std::string additionalErrorInfo;
s_has_required_online_files = iosuCrypt_checkRequirementsForOnlineMode(additionalErrorInfo) == IOS_CRYPTO_ONLINE_REQ_OK;
return failed_write_access;
}

View file

@ -110,7 +110,7 @@ void CemuConfig::Load(XMLConfigParser& parser)
try
{
recent_launch_files.emplace_back(boost::nowide::widen(path));
recent_launch_files.emplace_back(path);
}
catch (const std::exception&)
{
@ -125,10 +125,9 @@ void CemuConfig::Load(XMLConfigParser& parser)
const std::string path = element.value("");
if (path.empty())
continue;
try
{
recent_nfc_files.emplace_back(boost::nowide::widen(path));
recent_nfc_files.emplace_back(path);
}
catch (const std::exception&)
{
@ -143,10 +142,9 @@ void CemuConfig::Load(XMLConfigParser& parser)
const std::string path = element.value("");
if (path.empty())
continue;
try
{
game_paths.emplace_back(boost::nowide::widen(path));
game_paths.emplace_back(path);
}
catch (const std::exception&)
{
@ -402,20 +400,20 @@ void CemuConfig::Save(XMLConfigParser& parser)
auto launch_files_parser = config.set("RecentLaunchFiles");
for (const auto& entry : recent_launch_files)
{
launch_files_parser.set("Entry", boost::nowide::narrow(entry).c_str());
launch_files_parser.set("Entry", entry.c_str());
}
auto nfc_files_parser = config.set("RecentNFCFiles");
for (const auto& entry : recent_nfc_files)
{
nfc_files_parser.set("Entry", boost::nowide::narrow(entry).c_str());
nfc_files_parser.set("Entry", entry.c_str());
}
// game paths
auto game_path_parser = config.set("GamePaths");
for (const auto& entry : game_paths)
{
game_path_parser.set("Entry", boost::nowide::narrow(entry).c_str());
game_path_parser.set("Entry", entry.c_str());
}
// game list cache
@ -593,22 +591,18 @@ void CemuConfig::SetGameListCustomName(uint64 titleId, std::string customName)
gameEntry->custom_name = std::move(customName);
}
void CemuConfig::AddRecentlyLaunchedFile(std::wstring_view file)
void CemuConfig::AddRecentlyLaunchedFile(std::string_view file)
{
// insert into front
recent_launch_files.insert(recent_launch_files.begin(), std::wstring{ file });
recent_launch_files.insert(recent_launch_files.begin(), std::string(file));
RemoveDuplicatesKeepOrder(recent_launch_files);
// keep maximum of entries
while(recent_launch_files.size() > kMaxRecentEntries)
recent_launch_files.pop_back();
}
void CemuConfig::AddRecentNfcFile(std::wstring_view file)
void CemuConfig::AddRecentNfcFile(std::string_view file)
{
// insert into front
recent_nfc_files.insert(recent_nfc_files.begin(), std::wstring{ file });
recent_nfc_files.insert(recent_nfc_files.begin(), std::string(file));
RemoveDuplicatesKeepOrder(recent_nfc_files);
// keep maximum of entries
while (recent_nfc_files.size() > kMaxRecentEntries)
recent_nfc_files.pop_back();
}

View file

@ -379,7 +379,7 @@ struct CemuConfig
ConfigValue<bool> disable_screensaver{DISABLE_SCREENSAVER_DEFAULT};
#undef DISABLE_SCREENSAVER_DEFAULT
std::vector<std::wstring> game_paths;
std::vector<std::string> game_paths;
std::mutex game_cache_entries_mutex;
std::vector<GameEntry> game_cache_entries;
@ -399,8 +399,8 @@ struct CemuConfig
// max 15 entries
static constexpr size_t kMaxRecentEntries = 15;
std::vector<std::wstring> recent_launch_files;
std::vector<std::wstring> recent_nfc_files;
std::vector<std::string> recent_launch_files;
std::vector<std::string> recent_nfc_files;
Vector2i window_position{-1,-1};
Vector2i window_size{ -1,-1 };
@ -499,8 +499,8 @@ struct CemuConfig
void Load(XMLConfigParser& parser);
void Save(XMLConfigParser& parser);
void AddRecentlyLaunchedFile(std::wstring_view file);
void AddRecentNfcFile(std::wstring_view file);
void AddRecentlyLaunchedFile(std::string_view file);
void AddRecentNfcFile(std::string_view file);
bool IsGameListFavorite(uint64 titleId);
void SetGameListFavorite(uint64 titleId, bool isFavorite);