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,134 +99,134 @@ namespace steam
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C"
|
||||||
bool SteamAPI_RestartAppIfNecessary()
|
|
||||||
{
|
{
|
||||||
return false;
|
bool SteamAPI_RestartAppIfNecessary()
|
||||||
}
|
|
||||||
|
|
||||||
bool SteamAPI_Init()
|
|
||||||
{
|
|
||||||
overlay = ::utils::nt::library("gameoverlayrenderer.dll");
|
|
||||||
|
|
||||||
if (!overlay)
|
|
||||||
{
|
{
|
||||||
const auto steam_path = get_steam_install_directory();
|
return false;
|
||||||
if (!steam_path.empty())
|
|
||||||
{
|
|
||||||
overlay = ::utils::nt::library::load(steam_path + "gameoverlayrenderer.dll");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
bool SteamAPI_Init()
|
||||||
}
|
{
|
||||||
|
overlay = ::utils::nt::library("gameoverlayrenderer.dll");
|
||||||
|
|
||||||
void SteamAPI_RegisterCallResult(callbacks::base* result, uint64_t call)
|
if (!overlay)
|
||||||
{
|
{
|
||||||
callbacks::register_call_result(call, result);
|
const std::filesystem::path steam_path = ::steam::get_steam_install_directory();
|
||||||
}
|
if (!steam_path.empty())
|
||||||
|
{
|
||||||
|
overlay = ::utils::nt::library::load(steam_path / "gameoverlayrenderer.dll");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SteamAPI_RegisterCallback(callbacks::base* handler, int callback)
|
return true;
|
||||||
{
|
}
|
||||||
callbacks::register_callback(handler, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SteamAPI_RunCallbacks()
|
void SteamAPI_RegisterCallResult(callbacks::base* result, uint64_t call)
|
||||||
{
|
{
|
||||||
callbacks::run_callbacks();
|
callbacks::register_call_result(call, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamAPI_Shutdown()
|
void SteamAPI_RegisterCallback(callbacks::base* handler, int callback)
|
||||||
{
|
{
|
||||||
}
|
callbacks::register_callback(handler, callback);
|
||||||
|
}
|
||||||
|
|
||||||
void SteamAPI_UnregisterCallResult()
|
void SteamAPI_RunCallbacks()
|
||||||
{
|
{
|
||||||
}
|
callbacks::run_callbacks();
|
||||||
|
}
|
||||||
|
|
||||||
void SteamAPI_UnregisterCallback()
|
void SteamAPI_Shutdown()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SteamAPI_UnregisterCallResult()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SteamAPI_UnregisterCallback()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SteamGameServer_Init()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SteamGameServer_RunCallbacks()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SteamGameServer_Shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SteamGameServer_Init()
|
friends* SteamFriends()
|
||||||
{
|
{
|
||||||
return true;
|
static friends friends;
|
||||||
}
|
return &friends;
|
||||||
|
}
|
||||||
|
|
||||||
void SteamGameServer_RunCallbacks()
|
matchmaking* SteamMatchmaking()
|
||||||
{
|
{
|
||||||
}
|
static matchmaking matchmaking;
|
||||||
|
return &matchmaking;
|
||||||
|
}
|
||||||
|
|
||||||
void SteamGameServer_Shutdown()
|
matchmaking_servers* SteamMatchmakingServers()
|
||||||
{
|
{
|
||||||
}
|
static matchmaking_servers matchmaking_servers;
|
||||||
|
return &matchmaking_servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
game_server* SteamGameServer()
|
||||||
|
{
|
||||||
|
static game_server game_server;
|
||||||
|
return &game_server;
|
||||||
|
}
|
||||||
|
|
||||||
friends* SteamFriends()
|
master_server_updater* SteamMasterServerUpdater()
|
||||||
{
|
{
|
||||||
static friends friends;
|
static master_server_updater master_server_updater;
|
||||||
return &friends;
|
return &master_server_updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchmaking* SteamMatchmaking()
|
networking* SteamNetworking()
|
||||||
{
|
{
|
||||||
static matchmaking matchmaking;
|
static networking networking;
|
||||||
return &matchmaking;
|
return &networking;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchmaking_servers* SteamMatchmakingServers()
|
remote_storage* SteamRemoteStorage()
|
||||||
{
|
{
|
||||||
static matchmaking_servers matchmaking_servers;
|
static remote_storage remote_storage;
|
||||||
return &matchmaking_servers;
|
return &remote_storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
game_server* SteamGameServer()
|
user* SteamUser()
|
||||||
{
|
{
|
||||||
static game_server game_server;
|
static user user;
|
||||||
return &game_server;
|
return &user;
|
||||||
}
|
}
|
||||||
|
|
||||||
master_server_updater* SteamMasterServerUpdater()
|
utils* SteamUtils()
|
||||||
{
|
{
|
||||||
static master_server_updater master_server_updater;
|
static utils utils;
|
||||||
return &master_server_updater;
|
return &utils;
|
||||||
}
|
}
|
||||||
|
|
||||||
networking* SteamNetworking()
|
apps* SteamApps()
|
||||||
{
|
{
|
||||||
static networking networking;
|
static apps apps;
|
||||||
return &networking;
|
return &apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_storage* SteamRemoteStorage()
|
user_stats* SteamUserStats()
|
||||||
{
|
{
|
||||||
static remote_storage remote_storage;
|
static user_stats user_stats;
|
||||||
return &remote_storage;
|
return &user_stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
user* SteamUser()
|
|
||||||
{
|
|
||||||
static user user;
|
|
||||||
return &user;
|
|
||||||
}
|
|
||||||
|
|
||||||
utils* SteamUtils()
|
|
||||||
{
|
|
||||||
static utils utils;
|
|
||||||
return &utils;
|
|
||||||
}
|
|
||||||
|
|
||||||
apps* SteamApps()
|
|
||||||
{
|
|
||||||
static apps apps;
|
|
||||||
return &apps;
|
|
||||||
}
|
|
||||||
|
|
||||||
user_stats* SteamUserStats()
|
|
||||||
{
|
|
||||||
static user_stats user_stats;
|
|
||||||
return &user_stats;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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…
Reference in New Issue
Block a user