[Proxy] Basic steam proxy

This commit is contained in:
momo5502 2016-12-10 13:07:18 +01:00
parent 0fb882ef3b
commit 6b86d4a807
2 changed files with 81 additions and 1 deletions

View File

@ -5,6 +5,14 @@ namespace Steam
::Utils::Library Proxy::Client;
::Utils::Library Proxy::Overlay;
ISteamClient008* Proxy::SteamClient;
void* Proxy::SteamPipe;
void* Proxy::SteamUser;
Friends* Proxy::SteamFriends;
Utils* Proxy::SteamUtils;
bool Proxy::Inititalize()
{
std::string directoy = Proxy::GetSteamDirectory();
@ -14,12 +22,50 @@ namespace Steam
Proxy::Client = ::Utils::Library(STEAMCLIENT_LIB, false);
Proxy::Overlay = ::Utils::Library(GAMEOVERLAY_LIB, false);
if (!Proxy::Client.valid() || !Proxy::Overlay.valid()) return false;
return (Proxy::Client.valid() && Proxy::Overlay.valid());
Proxy::SteamClient = Proxy::Client.get<ISteamClient008*(const char*, int*)>("CreateInterface")("SteamClient008", nullptr);
Proxy::SteamPipe = Proxy::SteamClient->CreateSteamPipe();
if (!Proxy::SteamPipe) return false;
Proxy::SteamUser = Proxy::SteamClient->ConnectToGlobalUser(Proxy::SteamPipe);
if (!Proxy::SteamUser)
{
Proxy::SteamClient->ReleaseSteamPipe(Proxy::SteamPipe);
return false;
}
Proxy::SteamFriends = reinterpret_cast<Friends*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamFriends005"));
if (!Proxy::SteamFriends)
{
Proxy::SteamClient->ReleaseUser(Proxy::SteamPipe, Proxy::SteamUser);
Proxy::SteamClient->ReleaseSteamPipe(Proxy::SteamPipe);
return false;
}
Proxy::SteamUtils = reinterpret_cast<Utils*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamUtils005"));
if (!Proxy::SteamUtils)
{
Proxy::SteamClient->ReleaseUser(Proxy::SteamPipe, Proxy::SteamUser);
Proxy::SteamClient->ReleaseSteamPipe(Proxy::SteamPipe);
return false;
}
return true;
}
void Proxy::Uninititalize()
{
if (Proxy::SteamClient && Proxy::SteamPipe)
{
if (Proxy::SteamUser)
{
Proxy::SteamClient->ReleaseUser(Proxy::SteamPipe, Proxy::SteamUser);
}
Proxy::SteamClient->ReleaseSteamPipe(Proxy::SteamPipe);
}
Proxy::Client = ::Utils::Library();
Proxy::Overlay = ::Utils::Library();
}

View File

@ -10,6 +10,32 @@
namespace Steam
{
class ISteamClient008
{
public:
virtual void* CreateSteamPipe() = 0;
virtual bool ReleaseSteamPipe(void* hSteamPipe) = 0;
virtual void* ConnectToGlobalUser(void* hSteamPipe) = 0;
virtual void* CreateLocalUser(void* *phSteamPipe, int eAccountType) = 0;
virtual void ReleaseUser(void* hSteamPipe, void* hUser) = 0;
virtual void *GetISteamUser(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamGameServer(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void SetLocalIPBinding(uint32_t unIP, uint16_t usPort) = 0;
virtual void *GetISteamFriends(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamUtils(void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamMatchmaking(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamMasterServerUpdater(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamMatchmakingServers(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamGenericInterface(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamUserStats(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamApps(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void *GetISteamNetworking(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void*GetISteamRemoteStorage(void* hSteamuser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void RunFrame() = 0;
virtual uint32_t GetIPCCallCount() = 0;
virtual void SetWarningMessageHook(void* pFunction) = 0;
};
class Proxy
{
public:
@ -21,10 +47,18 @@ namespace Steam
static bool IsOverlayEnabled();
static bool BOverlayNeedsPresent();
static Friends* SteamFriends;
static Utils* SteamUtils;
private:
static ::Utils::Library Client;
static ::Utils::Library Overlay;
static ISteamClient008* SteamClient;
static void* SteamPipe;
static void* SteamUser;
static std::string GetSteamDirectory();
};
}