Implement steam overlay.

This commit is contained in:
momo5502
2016-01-07 16:55:10 +01:00
parent b58085810a
commit f8a8edde21
5 changed files with 32 additions and 4 deletions

View File

@ -54,6 +54,11 @@ namespace Steam
void Utils::SetOverlayNotificationPosition(int eNotificationPosition)
{
if (Steam::Overlay)
{
FARPROC setPosition = GetProcAddress(Steam::Overlay, "SetNotificationPosition");
::Utils::Hook::Call<void(int)>(setPosition)(eNotificationPosition);
}
}
bool Utils::IsAPICallCompleted(unsigned __int64 hSteamAPICall, bool *pbFailed)

View File

@ -3,6 +3,8 @@
namespace Steam
{
HMODULE Overlay = 0;
uint64_t Callbacks::CallID = 0;
std::map<uint64_t, bool> Callbacks::Calls;
std::map<uint64_t, Callbacks::Base*> Callbacks::ResultHandlers;
@ -70,6 +72,24 @@ namespace Steam
{
bool SteamAPI_Init()
{
Overlay = GetModuleHandleA("gameoverlayrenderer.dll");
if (!Overlay)
{
HKEY hRegKey;
char steamPath[MAX_PATH] = { 0 };
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
{
DWORD dwLength = sizeof(steamPath);
RegQueryValueExA(hRegKey, "InstallPath", NULL, NULL, (BYTE*)steamPath, &dwLength);
RegCloseKey(hRegKey);
SetDllDirectory(steamPath);
}
Overlay = LoadLibraryA(::Utils::VA("%s\\%s", steamPath, "gameoverlayrenderer.dll"));
}
return true;
}

View File

@ -88,4 +88,6 @@ namespace Steam
STEAM_EXPORT Steam::RemoteStorage* SteamRemoteStorage();
STEAM_EXPORT Steam::User* SteamUser();
STEAM_EXPORT Steam::Utils* SteamUtils();
extern HMODULE Overlay;
}