steam_proxy: use wide strings
This commit is contained in:
parent
acd999a425
commit
2bccc53eea
@ -34,7 +34,7 @@ public:
|
|||||||
this->start_mod("\xF0\x9F\x90\x8D Open-IW5 Multiplayer", 42690);
|
this->start_mod("\xF0\x9F\x90\x8D Open-IW5 Multiplayer", 42690);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
printf("Steam: %s\n", e.what());
|
printf("Steam: %s\n", e.what());
|
||||||
}
|
}
|
||||||
|
@ -75,22 +75,22 @@ namespace steam
|
|||||||
results_.clear();
|
results_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_steam_install_directory()
|
std::wstring get_steam_install_directory()
|
||||||
{
|
{
|
||||||
HKEY reg_key;
|
HKEY reg_key;
|
||||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, ®_key) ==
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, ®_key) ==
|
||||||
ERROR_SUCCESS)
|
ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH] = {0};
|
wchar_t path[MAX_PATH]{};
|
||||||
DWORD length = sizeof(path);
|
DWORD length = sizeof(path);
|
||||||
RegQueryValueExA(reg_key, "InstallPath", nullptr, nullptr, reinterpret_cast<BYTE*>(path),
|
RegQueryValueExW(reg_key, L"InstallPath", nullptr, nullptr, reinterpret_cast<BYTE*>(path),
|
||||||
&length);
|
&length);
|
||||||
RegCloseKey(reg_key);
|
RegCloseKey(reg_key);
|
||||||
|
|
||||||
std::string steam_path = path;
|
std::wstring steam_path = path;
|
||||||
if (steam_path.back() != '\\' && steam_path.back() != '/')
|
if (steam_path.back() != L'\\' && steam_path.back() != L'/')
|
||||||
{
|
{
|
||||||
steam_path.push_back('\\');
|
steam_path.push_back(L'\\');
|
||||||
}
|
}
|
||||||
|
|
||||||
return steam_path;
|
return steam_path;
|
||||||
@ -99,7 +99,8 @@ namespace steam
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
bool SteamAPI_RestartAppIfNecessary()
|
bool SteamAPI_RestartAppIfNecessary()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -111,10 +112,10 @@ namespace steam
|
|||||||
|
|
||||||
if (!overlay)
|
if (!overlay)
|
||||||
{
|
{
|
||||||
const auto steam_path = get_steam_install_directory();
|
const std::filesystem::path steam_path = ::steam::get_steam_install_directory();
|
||||||
if (!steam_path.empty())
|
if (!steam_path.empty())
|
||||||
{
|
{
|
||||||
overlay = ::utils::nt::library::load(steam_path + "gameoverlayrenderer.dll");
|
overlay = ::utils::nt::library::load(steam_path / "gameoverlayrenderer.dll");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,6 @@ namespace steam
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SteamGameServer_Init()
|
bool SteamGameServer_Init()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -118,7 +118,7 @@ namespace steam
|
|||||||
STEAM_EXPORT apps* SteamApps();
|
STEAM_EXPORT apps* SteamApps();
|
||||||
STEAM_EXPORT user_stats* SteamUserStats();
|
STEAM_EXPORT user_stats* SteamUserStats();
|
||||||
|
|
||||||
std::string get_steam_install_directory();
|
std::wstring get_steam_install_directory();
|
||||||
|
|
||||||
extern ::utils::nt::library overlay;
|
extern ::utils::nt::library overlay;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace utils::nt
|
|||||||
|
|
||||||
library library::load(const std::filesystem::path& path)
|
library library::load(const std::filesystem::path& path)
|
||||||
{
|
{
|
||||||
return library::load(path.generic_string());
|
return library(LoadLibraryW(path.generic_wstring().data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
library library::get_by_address(void* address)
|
library library::get_by_address(void* address)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user