mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Dalamud.Boot: use unicode::convert
This commit is contained in:
parent
45d30ed9d2
commit
edc5826fe0
3 changed files with 7 additions and 19 deletions
|
|
@ -578,16 +578,6 @@ std::vector<std::string> utils::get_env_list(const wchar_t* pcszName) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring utils::to_wstring(const std::string& str) {
|
|
||||||
if (str.empty()) return std::wstring();
|
|
||||||
size_t convertedChars = 0;
|
|
||||||
size_t newStrSize = str.size() + 1;
|
|
||||||
std::wstring wstr(newStrSize, L'\0');
|
|
||||||
mbstowcs_s(&convertedChars, &wstr[0], newStrSize, str.c_str(), _TRUNCATE);
|
|
||||||
wstr.resize(convertedChars - 1);
|
|
||||||
return wstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::filesystem::path utils::get_module_path(HMODULE hModule) {
|
std::filesystem::path utils::get_module_path(HMODULE hModule) {
|
||||||
std::wstring buf(MAX_PATH, L'\0');
|
std::wstring buf(MAX_PATH, L'\0');
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
||||||
|
|
@ -264,8 +264,6 @@ namespace utils {
|
||||||
return get_env_list<T>(unicode::convert<std::wstring>(pcszName).c_str());
|
return get_env_list<T>(unicode::convert<std::wstring>(pcszName).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring to_wstring(const std::string& str);
|
|
||||||
|
|
||||||
std::filesystem::path get_module_path(HMODULE hModule);
|
std::filesystem::path get_module_path(HMODULE hModule);
|
||||||
|
|
||||||
/// @brief Find the game main window.
|
/// @brief Find the game main window.
|
||||||
|
|
|
||||||
|
|
@ -110,13 +110,13 @@ static void append_injector_launch_args(std::vector<std::wstring>& args)
|
||||||
case DalamudStartInfo::LoadMethod::DllInject:
|
case DalamudStartInfo::LoadMethod::DllInject:
|
||||||
args.emplace_back(L"--mode=inject");
|
args.emplace_back(L"--mode=inject");
|
||||||
}
|
}
|
||||||
args.emplace_back(L"--logpath=\"" + utils::to_wstring(g_startInfo.BootLogPath) + L"\"");
|
args.emplace_back(L"--logpath=\"" + unicode::convert<std::wstring>(g_startInfo.BootLogPath) + L"\"");
|
||||||
args.emplace_back(L"--dalamud-working-directory=\"" + utils::to_wstring(g_startInfo.WorkingDirectory) + L"\"");
|
args.emplace_back(L"--dalamud-working-directory=\"" + unicode::convert<std::wstring>(g_startInfo.WorkingDirectory) + L"\"");
|
||||||
args.emplace_back(L"--dalamud-configuration-path=\"" + utils::to_wstring(g_startInfo.ConfigurationPath) + L"\"");
|
args.emplace_back(L"--dalamud-configuration-path=\"" + unicode::convert<std::wstring>(g_startInfo.ConfigurationPath) + L"\"");
|
||||||
args.emplace_back(L"--dalamud-plugin-directory=\"" + utils::to_wstring(g_startInfo.PluginDirectory) + L"\"");
|
args.emplace_back(L"--dalamud-plugin-directory=\"" + unicode::convert<std::wstring>(g_startInfo.PluginDirectory) + L"\"");
|
||||||
args.emplace_back(L"--dalamud-asset-directory=\"" + utils::to_wstring(g_startInfo.AssetDirectory) + L"\"");
|
args.emplace_back(L"--dalamud-asset-directory=\"" + unicode::convert<std::wstring>(g_startInfo.AssetDirectory) + L"\"");
|
||||||
args.emplace_back(L"--dalamud-client-language=" + std::to_wstring(static_cast<int>(g_startInfo.Language)));
|
args.emplace_back(std::format(L"--dalamud-client-language={}", static_cast<int>(g_startInfo.Language)));
|
||||||
args.emplace_back(L"--dalamud-delay-initialize=" + std::to_wstring(g_startInfo.DelayInitializeMs));
|
args.emplace_back(std::format(L"--dalamud-delay-initialize={}", g_startInfo.DelayInitializeMs));
|
||||||
if (g_startInfo.BootShowConsole)
|
if (g_startInfo.BootShowConsole)
|
||||||
args.emplace_back(L"--console");
|
args.emplace_back(L"--console");
|
||||||
if (g_startInfo.BootEnableEtw)
|
if (g_startInfo.BootEnableEtw)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue