This commit is contained in:
2024-01-15 12:14:55 +01:00
commit 215030f626
294 changed files with 39223 additions and 0 deletions

View File

@ -0,0 +1,98 @@
#include <std_include.hpp>
#include "interface.hpp"
#include <utils/memory.hpp>
#include <utils/nt.hpp>
namespace steam
{
interface::interface() : interface(nullptr)
{
}
interface::interface(void* interface_ptr) : interface_ptr_(static_cast<void***>(interface_ptr))
{
}
interface::operator bool() const
{
return this->interface_ptr_ != nullptr;
}
void* interface::find_method(const std::string& name)
{
const auto method_entry = this->methods_.find(name);
if (method_entry != this->methods_.end())
{
return method_entry->second;
}
return this->search_method(name);
}
void* interface::search_method(const std::string& name)
{
if (!utils::memory::is_bad_read_ptr(this->interface_ptr_))
{
auto vftbl = *this->interface_ptr_;
while (!utils::memory::is_bad_read_ptr(vftbl) && !utils::memory::is_bad_code_ptr(*vftbl))
{
const auto ptr = *vftbl;
const auto result = this->analyze_method(ptr);
if (!result.empty())
{
this->methods_[result] = ptr;
if (result == name)
{
return ptr;
}
}
++vftbl;
}
}
return {};
}
std::string interface::analyze_method(const void* method_ptr)
{
if (utils::memory::is_bad_code_ptr(method_ptr)) return {};
ud_t ud;
ud_init(&ud);
ud_set_mode(&ud, 64);
ud_set_pc(&ud, uint64_t(method_ptr));
ud_set_input_buffer(&ud, static_cast<const uint8_t*>(method_ptr), INT32_MAX);
while (true)
{
ud_disassemble(&ud);
if (ud_insn_mnemonic(&ud) == UD_Iret)
{
break;
}
if (ud_insn_mnemonic(&ud) == UD_Ilea)
{
const auto* operand = ud_insn_opr(&ud, 1);
if (operand && operand->type == UD_OP_MEM && operand->base == UD_R_RIP)
{
auto* operand_ptr = reinterpret_cast<char*>(ud_insn_len(&ud) + ud_insn_off(&ud) + operand->lval.
sdword);
if (!utils::memory::is_bad_read_ptr(operand_ptr) && utils::memory::is_rdata_ptr(operand_ptr))
{
return operand_ptr;
}
}
}
if (*reinterpret_cast<unsigned char*>(ud.pc) == 0xCC) break; // int 3
}
return {};
}
}

View File

@ -0,0 +1,85 @@
#pragma once
#ifdef interface
#undef interface
#endif
namespace steam
{
struct raw_steam_id final
{
unsigned int account_id : 32;
unsigned int account_instance : 20;
unsigned int account_type : 4;
int universe : 8;
};
typedef union
{
raw_steam_id raw;
unsigned long long bits;
} steam_id;
#pragma pack( push, 1 )
struct raw_game_id final
{
unsigned int app_id : 24;
unsigned int type : 8;
unsigned int mod_id : 32;
};
typedef union
{
raw_game_id raw;
unsigned long long bits;
} game_id;
#pragma pack( pop )
class interface final
{
public:
interface();
interface(void* interface_ptr);
operator bool() const;
template <typename T, typename... Args>
T invoke(const std::string& method_name, Args ... args)
{
if (!this->interface_ptr_)
{
throw std::runtime_error("Invalid interface pointer");
}
const auto method = this->find_method(method_name);
if (!method)
{
throw std::runtime_error("Unable to find method: " + method_name);
}
return static_cast<T(__thiscall*)(void*, Args ...)>(method)(this->interface_ptr_, args...);
}
template <typename T, typename... Args>
T invoke(const size_t table_entry, Args ... args)
{
if (!this->interface_ptr_)
{
throw std::runtime_error("Invalid interface pointer");
}
return static_cast<T(__thiscall*)(void*, Args ...)>((*this->interface_ptr_)[table_entry])(
this->interface_ptr_, args...);
}
private:
void*** interface_ptr_;
std::unordered_map<std::string, void*> methods_;
void* find_method(const std::string& name);
void* search_method(const std::string& name);
std::string analyze_method(const void* method_ptr);
};
}

View File

@ -0,0 +1,104 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
bool apps::BIsSubscribed()
{
return true;
}
bool apps::BIsLowViolence()
{
return false;
}
bool apps::BIsCybercafe()
{
return false;
}
bool apps::BIsVACBanned()
{
return false;
}
const char* apps::GetCurrentGameLanguage()
{
return "english";
}
const char* apps::GetAvailableGameLanguages()
{
return "english";
}
bool apps::BIsSubscribedApp(unsigned int appID)
{
return true;
}
bool apps::BIsDlcInstalled(unsigned int appID)
{
return true;
}
unsigned int apps::GetEarliestPurchaseUnixTime(unsigned int nAppID)
{
return 0;
}
bool apps::BIsSubscribedFromFreeWeekend()
{
return false;
}
int apps::GetDLCCount()
{
return 0;
}
bool apps::BGetDLCDataByIndex(int iDLC, unsigned int* pAppID, bool* pbAvailable, char* pchName,
int cchNameBufferSize)
{
return false;
}
void apps::InstallDLC(unsigned int nAppID)
{
}
void apps::UninstallDLC(unsigned int nAppID)
{
}
void apps::RequestAppProofOfPurchaseKey(unsigned int nAppID)
{
}
bool apps::GetCurrentBetaName(char* pchName, int cchNameBufferSize)
{
strncpy_s(pchName, cchNameBufferSize, "public", cchNameBufferSize);
return true;
}
bool apps::MarkContentCorrupt(bool bMissingFilesOnly)
{
return false;
}
unsigned int apps::GetInstalledDepots(int* pvecDepots, unsigned int cMaxDepots)
{
return 0;
}
unsigned int apps::GetAppInstallDir(unsigned int appID, char* pchFolder, unsigned int cchFolderBufferSize)
{
return 0;
}
bool apps::BIsAppInstalled(unsigned int appID)
{
return false;
}
}

View File

@ -0,0 +1,32 @@
#pragma once
namespace steam
{
class apps
{
public:
~apps() = default;
virtual bool BIsSubscribed();
virtual bool BIsLowViolence();
virtual bool BIsCybercafe();
virtual bool BIsVACBanned();
virtual const char* GetCurrentGameLanguage();
virtual const char* GetAvailableGameLanguages();
virtual bool BIsSubscribedApp(unsigned int appID);
virtual bool BIsDlcInstalled(unsigned int appID);
virtual unsigned int GetEarliestPurchaseUnixTime(unsigned int nAppID);
virtual bool BIsSubscribedFromFreeWeekend();
virtual int GetDLCCount();
virtual bool BGetDLCDataByIndex(int iDLC, unsigned int* pAppID, bool* pbAvailable, char* pchName,
int cchNameBufferSize);
virtual void InstallDLC(unsigned int nAppID);
virtual void UninstallDLC(unsigned int nAppID);
virtual void RequestAppProofOfPurchaseKey(unsigned int nAppID);
virtual bool GetCurrentBetaName(char* pchName, int cchNameBufferSize);
virtual bool MarkContentCorrupt(bool bMissingFilesOnly);
virtual unsigned int GetInstalledDepots(int* pvecDepots, unsigned int cMaxDepots);
virtual unsigned int GetAppInstallDir(unsigned int appID, char* pchFolder, unsigned int cchFolderBufferSize);
virtual bool BIsAppInstalled(unsigned int appID);
};
}

View File

@ -0,0 +1,313 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
const char* friends::GetPersonaName()
{
return "1337";
}
unsigned long long friends::SetPersonaName(const char* pchPersonaName)
{
return 0;
}
int friends::GetPersonaState()
{
return 1;
}
int friends::GetFriendCount(int eFriendFlags)
{
return 0;
}
steam_id friends::GetFriendByIndex(int iFriend, int iFriendFlags)
{
return steam_id();
}
int friends::GetFriendRelationship(steam_id steamIDFriend)
{
return 0;
}
int friends::GetFriendPersonaState(steam_id steamIDFriend)
{
return 0;
}
const char* friends::GetFriendPersonaName(steam_id steamIDFriend)
{
return "";
}
bool friends::GetFriendGamePlayed(steam_id steamIDFriend, void* pFriendGameInfo)
{
return false;
}
const char* friends::GetFriendPersonaNameHistory(steam_id steamIDFriend, int iPersonaName)
{
return "";
}
bool friends::HasFriend(steam_id steamIDFriend, int eFriendFlags)
{
return false;
}
int friends::GetClanCount()
{
return 0;
}
steam_id friends::GetClanByIndex(int iClan)
{
return steam_id();
}
const char* friends::GetClanName(steam_id steamIDClan)
{
return "3arc";
}
const char* friends::GetClanTag(steam_id steamIDClan)
{
return this->GetClanName(steamIDClan);
}
bool friends::GetClanActivityCounts(steam_id steamID, int* pnOnline, int* pnInGame, int* pnChatting)
{
return false;
}
unsigned long long friends::DownloadClanActivityCounts(steam_id groupIDs[], int nIds)
{
return 0;
}
int friends::GetFriendCountFromSource(steam_id steamIDSource)
{
return 0;
}
steam_id friends::GetFriendFromSourceByIndex(steam_id steamIDSource, int iFriend)
{
return steam_id();
}
bool friends::IsUserInSource(steam_id steamIDUser, steam_id steamIDSource)
{
return false;
}
void friends::SetInGameVoiceSpeaking(steam_id steamIDUser, bool bSpeaking)
{
}
void friends::ActivateGameOverlay(const char* pchDialog)
{
}
void friends::ActivateGameOverlayToUser(const char* pchDialog, steam_id steamID)
{
}
void friends::ActivateGameOverlayToWebPage(const char* pchURL)
{
}
void friends::ActivateGameOverlayToStore(unsigned int nAppID, unsigned int eFlag)
{
}
void friends::SetPlayedWith(steam_id steamIDUserPlayedWith)
{
}
void friends::ActivateGameOverlayInviteDialog(steam_id steamIDLobby)
{
}
int friends::GetSmallFriendAvatar(steam_id steamIDFriend)
{
return 0;
}
int friends::GetMediumFriendAvatar(steam_id steamIDFriend)
{
return 0;
}
int friends::GetLargeFriendAvatar(steam_id steamIDFriend)
{
return 0;
}
bool friends::RequestUserInformation(steam_id steamIDUser, bool bRequireNameOnly)
{
return false;
}
unsigned long long friends::RequestClanOfficerList(steam_id steamIDClan)
{
return 0;
}
steam_id friends::GetClanOwner(steam_id steamIDClan)
{
return steam_id();
}
int friends::GetClanOfficerCount(steam_id steamIDClan)
{
return 0;
}
steam_id friends::GetClanOfficerByIndex(steam_id steamIDClan, int iOfficer)
{
return steam_id();
}
int friends::GetUserRestrictions()
{
return 0;
}
bool friends::SetRichPresence(const char* pchKey, const char* pchValue)
{
return true;
}
void friends::ClearRichPresence()
{
}
const char* friends::GetFriendRichPresence(steam_id steamIDFriend, const char* pchKey)
{
return "";
}
int friends::GetFriendRichPresenceKeyCount(steam_id steamIDFriend)
{
return 0;
}
const char* friends::GetFriendRichPresenceKeyByIndex(steam_id steamIDFriend, int iKey)
{
return "a";
}
void friends::RequestFriendRichPresence(steam_id steamIDFriend)
{
}
bool friends::InviteUserToGame(steam_id steamIDFriend, const char* pchConnectString)
{
return false;
}
int friends::GetCoplayFriendCount()
{
return 0;
}
steam_id friends::GetCoplayFriend(int iCoplayFriend)
{
return steam_id();
}
int friends::GetFriendCoplayTime(steam_id steamIDFriend)
{
return 0;
}
unsigned int friends::GetFriendCoplayGame(steam_id steamIDFriend)
{
return 0;
}
unsigned long long friends::JoinClanChatRoom(steam_id steamIDClan)
{
return 0;
}
bool friends::LeaveClanChatRoom(steam_id steamIDClan)
{
return false;
}
int friends::GetClanChatMemberCount(steam_id steamIDClan)
{
return 0;
}
steam_id friends::GetChatMemberByIndex(steam_id steamIDClan, int iUser)
{
return steam_id();
}
bool friends::SendClanChatMessage(steam_id steamIDClanChat, const char* pchText)
{
return false;
}
int friends::GetClanChatMessage(steam_id steamIDClanChat, int iMessage, void* prgchText, int cchTextMax,
unsigned int* peChatEntryType, steam_id* pSteamIDChatter)
{
return 0;
}
bool friends::IsClanChatAdmin(steam_id steamIDClanChat, steam_id steamIDUser)
{
return false;
}
bool friends::IsClanChatWindowOpenInSteam(steam_id steamIDClanChat)
{
return false;
}
bool friends::OpenClanChatWindowInSteam(steam_id steamIDClanChat)
{
return false;
}
bool friends::CloseClanChatWindowInSteam(steam_id steamIDClanChat)
{
return false;
}
bool friends::SetListenForFriendsMessages(bool bInterceptEnabled)
{
return false;
}
bool friends::ReplyToFriendMessage(steam_id steamIDFriend, const char* pchMsgToSend)
{
return false;
}
int friends::GetFriendMessage(steam_id steamIDFriend, int iMessageID, void* pvData, int cubData,
unsigned int* peChatEntryType)
{
return 0;
}
unsigned long long friends::GetFollowerCount(steam_id steamID)
{
return 0;
}
unsigned long long friends::IsFollowing(steam_id steamID)
{
return 0;
}
unsigned long long friends::EnumerateFollowingList(unsigned int unStartIndex)
{
return 0;
}
}

View File

@ -0,0 +1,76 @@
#pragma once
namespace steam
{
class friends
{
public:
~friends() = default;
virtual const char* GetPersonaName();
virtual unsigned long long SetPersonaName(const char* pchPersonaName);
virtual int GetPersonaState();
virtual int GetFriendCount(int eFriendFlags);
virtual steam_id GetFriendByIndex(int iFriend, int iFriendFlags);
virtual int GetFriendRelationship(steam_id steamIDFriend);
virtual int GetFriendPersonaState(steam_id steamIDFriend);
virtual const char* GetFriendPersonaName(steam_id steamIDFriend);
virtual bool GetFriendGamePlayed(steam_id steamIDFriend, void* pFriendGameInfo);
virtual const char* GetFriendPersonaNameHistory(steam_id steamIDFriend, int iPersonaName);
virtual bool HasFriend(steam_id steamIDFriend, int eFriendFlags);
virtual int GetClanCount();
virtual steam_id GetClanByIndex(int iClan);
virtual const char* GetClanName(steam_id steamIDClan);
virtual const char* GetClanTag(steam_id steamIDClan);
virtual bool GetClanActivityCounts(steam_id steamID, int* pnOnline, int* pnInGame, int* pnChatting);
virtual unsigned long long DownloadClanActivityCounts(steam_id groupIDs[], int nIds);
virtual int GetFriendCountFromSource(steam_id steamIDSource);
virtual steam_id GetFriendFromSourceByIndex(steam_id steamIDSource, int iFriend);
virtual bool IsUserInSource(steam_id steamIDUser, steam_id steamIDSource);
virtual void SetInGameVoiceSpeaking(steam_id steamIDUser, bool bSpeaking);
virtual void ActivateGameOverlay(const char* pchDialog);
virtual void ActivateGameOverlayToUser(const char* pchDialog, steam_id steamID);
virtual void ActivateGameOverlayToWebPage(const char* pchURL);
virtual void ActivateGameOverlayToStore(unsigned int nAppID, unsigned int eFlag);
virtual void SetPlayedWith(steam_id steamIDUserPlayedWith);
virtual void ActivateGameOverlayInviteDialog(steam_id steamIDLobby);
virtual int GetSmallFriendAvatar(steam_id steamIDFriend);
virtual int GetMediumFriendAvatar(steam_id steamIDFriend);
virtual int GetLargeFriendAvatar(steam_id steamIDFriend);
virtual bool RequestUserInformation(steam_id steamIDUser, bool bRequireNameOnly);
virtual unsigned long long RequestClanOfficerList(steam_id steamIDClan);
virtual steam_id GetClanOwner(steam_id steamIDClan);
virtual int GetClanOfficerCount(steam_id steamIDClan);
virtual steam_id GetClanOfficerByIndex(steam_id steamIDClan, int iOfficer);
virtual int GetUserRestrictions();
virtual bool SetRichPresence(const char* pchKey, const char* pchValue);
virtual void ClearRichPresence();
virtual const char* GetFriendRichPresence(steam_id steamIDFriend, const char* pchKey);
virtual int GetFriendRichPresenceKeyCount(steam_id steamIDFriend);
virtual const char* GetFriendRichPresenceKeyByIndex(steam_id steamIDFriend, int iKey);
virtual void RequestFriendRichPresence(steam_id steamIDFriend);
virtual bool InviteUserToGame(steam_id steamIDFriend, const char* pchConnectString);
virtual int GetCoplayFriendCount();
virtual steam_id GetCoplayFriend(int iCoplayFriend);
virtual int GetFriendCoplayTime(steam_id steamIDFriend);
virtual unsigned int GetFriendCoplayGame(steam_id steamIDFriend);
virtual unsigned long long JoinClanChatRoom(steam_id steamIDClan);
virtual bool LeaveClanChatRoom(steam_id steamIDClan);
virtual int GetClanChatMemberCount(steam_id steamIDClan);
virtual steam_id GetChatMemberByIndex(steam_id steamIDClan, int iUser);
virtual bool SendClanChatMessage(steam_id steamIDClanChat, const char* pchText);
virtual int GetClanChatMessage(steam_id steamIDClanChat, int iMessage, void* prgchText, int cchTextMax,
unsigned int* peChatEntryType, steam_id* pSteamIDChatter);
virtual bool IsClanChatAdmin(steam_id steamIDClanChat, steam_id steamIDUser);
virtual bool IsClanChatWindowOpenInSteam(steam_id steamIDClanChat);
virtual bool OpenClanChatWindowInSteam(steam_id steamIDClanChat);
virtual bool CloseClanChatWindowInSteam(steam_id steamIDClanChat);
virtual bool SetListenForFriendsMessages(bool bInterceptEnabled);
virtual bool ReplyToFriendMessage(steam_id steamIDFriend, const char* pchMsgToSend);
virtual int GetFriendMessage(steam_id steamIDFriend, int iMessageID, void* pvData, int cubData,
unsigned int* peChatEntryType);
virtual unsigned long long GetFollowerCount(steam_id steamID);
virtual unsigned long long IsFollowing(steam_id steamID);
virtual unsigned long long EnumerateFollowingList(unsigned int unStartIndex);
};
}

View File

@ -0,0 +1,204 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
bool game_server::InitGameServer(unsigned int unGameIP, unsigned short unGamePort, unsigned short usQueryPort,
unsigned int unServerFlags, unsigned int nAppID, const char* pchVersion)
{
return true;
}
void game_server::SetProduct(const char* pchProductName)
{
}
void game_server::SetGameDescription(const char* pchGameDescription)
{
}
void game_server::SetModDir(const char* pchModDir)
{
}
void game_server::SetDedicatedServer(bool bDedicatedServer)
{
}
void game_server::LogOn(const char* pszAccountName, const char* pszPassword)
{
}
void game_server::LogOnAnonymous()
{
auto* const retvals = calloc(1, 1);
const auto result = callbacks::register_call();
callbacks::return_call(retvals, 0, 101, result);
}
void game_server::LogOff()
{
}
bool game_server::BLoggedOn()
{
return true;
}
bool game_server::BSecure()
{
return false;
}
steam_id game_server::GetSteamID()
{
return SteamUser()->GetSteamID();
}
bool game_server::WasRestartRequested()
{
return false;
}
void game_server::SetMaxPlayerCount(int cPlayersMax)
{
}
void game_server::SetBotPlayerCount(int cBotPlayers)
{
}
void game_server::SetServerName(const char* pszServerName)
{
}
void game_server::SetMapName(const char* pszMapName)
{
}
void game_server::SetPasswordProtected(bool bPasswordProtected)
{
}
void game_server::SetSpectatorPort(unsigned short unSpectatorPort)
{
}
void game_server::SetSpectatorServerName(const char* pszSpectatorServerName)
{
}
void game_server::ClearAllKeyValues()
{
}
void game_server::SetKeyValue(const char* pKey, const char* pValue)
{
}
void game_server::SetGameTags(const char* pchGameTags)
{
}
void game_server::SetGameData(const char* pchGameData)
{
}
void game_server::SetRegion(const char* pchRegionName)
{
}
int game_server::SendUserConnectAndAuthenticate(unsigned int unIPClient, const void* pvAuthBlob,
unsigned int cubAuthBlobSize, steam_id* pSteamIDUser)
{
return 0;
}
steam_id game_server::CreateUnauthenticatedUserConnection()
{
return SteamUser()->GetSteamID();
}
void game_server::SendUserDisconnect(steam_id steamIDUser)
{
}
bool game_server::BUpdateUserData(steam_id steamIDUser, const char* pchPlayerName, unsigned int uScore)
{
return false;
}
int game_server::GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket)
{
return 0;
}
int game_server::BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, steam_id steamID)
{
return 0;
}
void game_server::EndAuthSession(steam_id steamID)
{
}
void game_server::CancelAuthTicket(int hAuthTicket)
{
}
int game_server::UserHasLicenseForApp(steam_id steamID, unsigned int appID)
{
return 0;
}
bool game_server::RequestUserGroupStatus(steam_id steamIDUser, steam_id steamIDGroup)
{
return false;
}
void game_server::GetGameplayStats()
{
}
unsigned long long game_server::GetServerReputation()
{
return 0;
}
unsigned int game_server::GetPublicIP()
{
return 0;
}
bool game_server::HandleIncomingPacket(const void* pData, int cbData, unsigned int srcIP, unsigned short srcPort)
{
return false;
}
int game_server::GetNextOutgoingPacket(void* pOut, int cbMaxOut, unsigned int* pNetAdr, unsigned short* pPort)
{
return 0;
}
void game_server::EnableHeartbeats(bool bActive)
{
}
void game_server::SetHeartbeatInterval(int iHeartbeatInterval)
{
}
void game_server::ForceHeartbeat()
{
}
unsigned long long game_server::AssociateWithClan(steam_id clanID)
{
return 0;
}
unsigned long long game_server::ComputeNewPlayerCompatibility(steam_id steamID)
{
return 0;
}
}

View File

@ -0,0 +1,57 @@
#pragma once
namespace steam
{
class game_server
{
public:
~game_server() = default;
virtual bool InitGameServer(unsigned int unGameIP, unsigned short unGamePort, unsigned short usQueryPort,
unsigned int unServerFlags, unsigned int nAppID, const char* pchVersion);
virtual void SetProduct(const char* pchProductName);
virtual void SetGameDescription(const char* pchGameDescription);
virtual void SetModDir(const char* pchModDir);
virtual void SetDedicatedServer(bool bDedicatedServer);
virtual void LogOn(const char* pszAccountName, const char* pszPassword);
virtual void LogOnAnonymous();
virtual void LogOff();
virtual bool BLoggedOn();
virtual bool BSecure();
virtual steam_id GetSteamID();
virtual bool WasRestartRequested();
virtual void SetMaxPlayerCount(int cPlayersMax);
virtual void SetBotPlayerCount(int cBotPlayers);
virtual void SetServerName(const char* pszServerName);
virtual void SetMapName(const char* pszMapName);
virtual void SetPasswordProtected(bool bPasswordProtected);
virtual void SetSpectatorPort(unsigned short unSpectatorPort);
virtual void SetSpectatorServerName(const char* pszSpectatorServerName);
virtual void ClearAllKeyValues();
virtual void SetKeyValue(const char* pKey, const char* pValue);
virtual void SetGameTags(const char* pchGameTags);
virtual void SetGameData(const char* pchGameData);
virtual void SetRegion(const char* pchRegionName);
virtual int SendUserConnectAndAuthenticate(unsigned int unIPClient, const void* pvAuthBlob,
unsigned int cubAuthBlobSize, steam_id* pSteamIDUser);
virtual steam_id CreateUnauthenticatedUserConnection();
virtual void SendUserDisconnect(steam_id steamIDUser);
virtual bool BUpdateUserData(steam_id steamIDUser, const char* pchPlayerName, unsigned int uScore);
virtual int GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket);
virtual int BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, steam_id steamID);
virtual void EndAuthSession(steam_id steamID);
virtual void CancelAuthTicket(int hAuthTicket);
virtual int UserHasLicenseForApp(steam_id steamID, unsigned int appID);
virtual bool RequestUserGroupStatus(steam_id steamIDUser, steam_id steamIDGroup);
virtual void GetGameplayStats();
virtual unsigned long long GetServerReputation();
virtual unsigned int GetPublicIP();
virtual bool HandleIncomingPacket(const void* pData, int cbData, unsigned int srcIP, unsigned short srcPort);
virtual int GetNextOutgoingPacket(void* pOut, int cbMaxOut, unsigned int* pNetAdr, unsigned short* pPort);
virtual void EnableHeartbeats(bool bActive);
virtual void SetHeartbeatInterval(int iHeartbeatInterval);
virtual void ForceHeartbeat();
virtual unsigned long long AssociateWithClan(steam_id clanID);
virtual unsigned long long ComputeNewPlayerCompatibility(steam_id steamID);
};
}

View File

@ -0,0 +1,230 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
int matchmaking::GetFavoriteGameCount()
{
return 0;
}
bool matchmaking::GetFavoriteGame(int iGame, unsigned int* pnAppID, unsigned int* pnIP, unsigned short* pnConnPort,
unsigned short* pnQueryPort, unsigned int* punFlags,
unsigned int* pRTime32LastPlayedOnServer)
{
return false;
}
int matchmaking::AddFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort,
unsigned short nQueryPort, unsigned int unFlags,
unsigned int rTime32LastPlayedOnServer)
{
return 0;
}
bool matchmaking::RemoveFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort,
unsigned short nQueryPort, unsigned int unFlags)
{
return false;
}
unsigned long long matchmaking::RequestLobbyList()
{
return 0;
}
void matchmaking::AddRequestLobbyListStringFilter(const char* pchKeyToMatch, const char* pchValueToMatch,
int eComparisonType)
{
}
void matchmaking::AddRequestLobbyListNumericalFilter(const char* pchKeyToMatch, int nValueToMatch,
int eComparisonType)
{
}
void matchmaking::AddRequestLobbyListNearValueFilter(const char* pchKeyToMatch, int nValueToBeCloseTo)
{
}
void matchmaking::AddRequestLobbyListFilterSlotsAvailable(int nSlotsAvailable)
{
}
void matchmaking::AddRequestLobbyListDistanceFilter(int eLobbyDistanceFilter)
{
}
void matchmaking::AddRequestLobbyListResultCountFilter(int cMaxResults)
{
}
void matchmaking::AddRequestLobbyListCompatibleMembersFilter(steam_id steamID)
{
}
steam_id matchmaking::GetLobbyByIndex(int iLobby)
{
steam_id id;
id.raw.account_id = SteamUser()->GetSteamID().raw.account_id;
id.raw.universe = 1;
id.raw.account_type = 8;
id.raw.account_instance = 0x40000;
return id;
}
unsigned long long matchmaking::CreateLobby(int eLobbyType, int cMaxMembers)
{
const auto result = callbacks::register_call();
auto retvals = static_cast<lobby_created*>(calloc(1, sizeof(lobby_created)));
//::Utils::Memory::AllocateArray<LobbyCreated>();
steam_id id;
id.raw.account_id = SteamUser()->GetSteamID().raw.account_id;
id.raw.universe = 1;
id.raw.account_type = 8;
id.raw.account_instance = 0x40000;
retvals->m_e_result = 1;
retvals->m_ul_steam_id_lobby = id;
callbacks::return_call(retvals, sizeof(lobby_created), lobby_created::callback_id, result);
matchmaking::JoinLobby(id);
return result;
}
unsigned long long matchmaking::JoinLobby(steam_id steamIDLobby)
{
const auto result = callbacks::register_call();
auto* retvals = static_cast<lobby_enter*>(calloc(1, sizeof(lobby_enter)));
//::Utils::Memory::AllocateArray<LobbyEnter>();
retvals->m_b_locked = false;
retvals->m_e_chat_room_enter_response = 1;
retvals->m_rgf_chat_permissions = 0xFFFFFFFF;
retvals->m_ul_steam_id_lobby = steamIDLobby;
callbacks::return_call(retvals, sizeof(lobby_enter), lobby_enter::callback_id, result);
return result;
}
void matchmaking::LeaveLobby(steam_id steamIDLobby)
{
}
bool matchmaking::InviteUserToLobby(steam_id steamIDLobby, steam_id steamIDInvitee)
{
return true;
}
int matchmaking::GetNumLobbyMembers(steam_id steamIDLobby)
{
return 1;
}
steam_id matchmaking::GetLobbyMemberByIndex(steam_id steamIDLobby, int iMember)
{
return SteamUser()->GetSteamID();
}
const char* matchmaking::GetLobbyData(steam_id steamIDLobby, const char* pchKey)
{
return "";
}
bool matchmaking::SetLobbyData(steam_id steamIDLobby, const char* pchKey, const char* pchValue)
{
return true;
}
int matchmaking::GetLobbyDataCount(steam_id steamIDLobby)
{
return 0;
}
bool matchmaking::GetLobbyDataByIndex(steam_id steamIDLobby, int iLobbyData, char* pchKey, int cchKeyBufferSize,
char* pchValue, int cchValueBufferSize)
{
return true;
}
bool matchmaking::DeleteLobbyData(steam_id steamIDLobby, const char* pchKey)
{
return true;
}
const char* matchmaking::GetLobbyMemberData(steam_id steamIDLobby, steam_id steamIDUser, const char* pchKey)
{
return "";
}
void matchmaking::SetLobbyMemberData(steam_id steamIDLobby, const char* pchKey, const char* pchValue)
{
}
bool matchmaking::SendLobbyChatMsg(steam_id steamIDLobby, const void* pvMsgBody, int cubMsgBody)
{
return true;
}
int matchmaking::GetLobbyChatEntry(steam_id steamIDLobby, int iChatID, steam_id* pSteamIDUser, void* pvData,
int cubData, int* peChatEntryType)
{
return 0;
}
bool matchmaking::RequestLobbyData(steam_id steamIDLobby)
{
return true;
}
void matchmaking::SetLobbyGameServer(steam_id steamIDLobby, unsigned int unGameServerIP,
unsigned short unGameServerPort, steam_id steamIDGameServer)
{
}
bool matchmaking::GetLobbyGameServer(steam_id steamIDLobby, unsigned int* punGameServerIP,
unsigned short* punGameServerPort, steam_id* psteamIDGameServer)
{
return true;
}
bool matchmaking::SetLobbyMemberLimit(steam_id steamIDLobby, int cMaxMembers)
{
return true;
}
int matchmaking::GetLobbyMemberLimit(steam_id steamIDLobby)
{
return 0;
}
bool matchmaking::SetLobbyType(steam_id steamIDLobby, int eLobbyType)
{
return true;
}
bool matchmaking::SetLobbyJoinable(steam_id steamIDLobby, bool bLobbyJoinable)
{
return true;
}
steam_id matchmaking::GetLobbyOwner(steam_id steamIDLobby)
{
return SteamUser()->GetSteamID();
}
bool matchmaking::SetLobbyOwner(steam_id steamIDLobby, steam_id steamIDNewOwner)
{
return true;
}
bool matchmaking::SetLinkedLobby(steam_id steamIDLobby, steam_id steamIDLobby2)
{
return true;
}
}

View File

@ -0,0 +1,79 @@
#pragma once
namespace steam
{
struct lobby_created final
{
enum { callback_id = 513 };
int m_e_result;
int m_pad;
steam_id m_ul_steam_id_lobby;
};
struct lobby_enter final
{
enum { callback_id = 504 };
steam_id m_ul_steam_id_lobby;
int m_rgf_chat_permissions;
bool m_b_locked;
int m_e_chat_room_enter_response;
};
class matchmaking
{
public:
~matchmaking() = default;
virtual int GetFavoriteGameCount();
virtual bool GetFavoriteGame(int iGame, unsigned int* pnAppID, unsigned int* pnIP, unsigned short* pnConnPort,
unsigned short* pnQueryPort, unsigned int* punFlags,
unsigned int* pRTime32LastPlayedOnServer);
virtual int AddFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort,
unsigned short nQueryPort, unsigned int unFlags,
unsigned int rTime32LastPlayedOnServer);
virtual bool RemoveFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort,
unsigned short nQueryPort, unsigned int unFlags);
virtual unsigned long long RequestLobbyList();
virtual void AddRequestLobbyListStringFilter(const char* pchKeyToMatch, const char* pchValueToMatch,
int eComparisonType);
virtual void AddRequestLobbyListNumericalFilter(const char* pchKeyToMatch, int nValueToMatch,
int eComparisonType);
virtual void AddRequestLobbyListNearValueFilter(const char* pchKeyToMatch, int nValueToBeCloseTo);
virtual void AddRequestLobbyListFilterSlotsAvailable(int nSlotsAvailable);
virtual void AddRequestLobbyListDistanceFilter(int eLobbyDistanceFilter);
virtual void AddRequestLobbyListResultCountFilter(int cMaxResults);
virtual void AddRequestLobbyListCompatibleMembersFilter(steam_id steamID);
virtual steam_id GetLobbyByIndex(int iLobby);
virtual unsigned long long CreateLobby(int eLobbyType, int cMaxMembers);
virtual unsigned long long JoinLobby(steam_id steamIDLobby);
virtual void LeaveLobby(steam_id steamIDLobby);
virtual bool InviteUserToLobby(steam_id steamIDLobby, steam_id steamIDInvitee);
virtual int GetNumLobbyMembers(steam_id steamIDLobby);
virtual steam_id GetLobbyMemberByIndex(steam_id steamIDLobby, int iMember);
virtual const char* GetLobbyData(steam_id steamIDLobby, const char* pchKey);
virtual bool SetLobbyData(steam_id steamIDLobby, const char* pchKey, const char* pchValue);
virtual int GetLobbyDataCount(steam_id steamIDLobby);
virtual bool GetLobbyDataByIndex(steam_id steamIDLobby, int iLobbyData, char* pchKey, int cchKeyBufferSize,
char* pchValue, int cchValueBufferSize);
virtual bool DeleteLobbyData(steam_id steamIDLobby, const char* pchKey);
virtual const char* GetLobbyMemberData(steam_id steamIDLobby, steam_id steamIDUser, const char* pchKey);
virtual void SetLobbyMemberData(steam_id steamIDLobby, const char* pchKey, const char* pchValue);
virtual bool SendLobbyChatMsg(steam_id steamIDLobby, const void* pvMsgBody, int cubMsgBody);
virtual int GetLobbyChatEntry(steam_id steamIDLobby, int iChatID, steam_id* pSteamIDUser, void* pvData,
int cubData, int* peChatEntryType);
virtual bool RequestLobbyData(steam_id steamIDLobby);
virtual void SetLobbyGameServer(steam_id steamIDLobby, unsigned int unGameServerIP,
unsigned short unGameServerPort, steam_id steamIDGameServer);
virtual bool GetLobbyGameServer(steam_id steamIDLobby, unsigned int* punGameServerIP,
unsigned short* punGameServerPort, steam_id* psteamIDGameServer);
virtual bool SetLobbyMemberLimit(steam_id steamIDLobby, int cMaxMembers);
virtual int GetLobbyMemberLimit(steam_id steamIDLobby);
virtual bool SetLobbyType(steam_id steamIDLobby, int eLobbyType);
virtual bool SetLobbyJoinable(steam_id steamIDLobby, bool bLobbyJoinable);
virtual steam_id GetLobbyOwner(steam_id steamIDLobby);
virtual bool SetLobbyOwner(steam_id steamIDLobby, steam_id steamIDNewOwner);
virtual bool SetLinkedLobby(steam_id steamIDLobby, steam_id steamIDLobby2);
};
}

View File

@ -0,0 +1,121 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
bool networking::SendP2PPacket(steam_id steamIDRemote, const void* pubData, unsigned int cubData, int eP2PSendType)
{
return false;
}
bool networking::IsP2PPacketAvailable(unsigned int* pcubMsgSize, int idk)
{
return false;
}
bool networking::ReadP2PPacket(void* pubDest, unsigned int cubDest, unsigned int* pcubMsgSize,
steam_id* psteamIDRemote)
{
return false;
}
bool networking::AcceptP2PSessionWithUser(steam_id steamIDRemote)
{
return false;
}
bool networking::CloseP2PSessionWithUser(steam_id steamIDRemote)
{
return false;
}
bool networking::CloseP2PChannelWithUser(steam_id steamIDRemote, int iVirtualPort)
{
return false;
}
bool networking::GetP2PSessionState(steam_id steamIDRemote, void* pConnectionState)
{
return false;
}
bool networking::AllowP2PPacketRelay(bool bAllow)
{
return false;
}
unsigned int networking::CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort,
bool bAllowUseOfPacketRelay)
{
return NULL;
}
unsigned int networking::CreateP2PConnectionSocket(steam_id steamIDTarget, int nVirtualPort, int nTimeoutSec,
bool bAllowUseOfPacketRelay)
{
return NULL;
}
unsigned int networking::CreateConnectionSocket(unsigned int nIP, unsigned short nPort, int nTimeoutSec)
{
return NULL;
}
bool networking::DestroySocket(unsigned int hSocket, bool bNotifyRemoteEnd)
{
return false;
}
bool networking::DestroyListenSocket(unsigned int hSocket, bool bNotifyRemoteEnd)
{
return false;
}
bool networking::SendDataOnSocket(unsigned int hSocket, void* pubData, unsigned int cubData, bool bReliable)
{
return false;
}
bool networking::IsDataAvailableOnSocket(unsigned int hSocket, unsigned int* pcubMsgSize)
{
return false;
}
bool networking::RetrieveDataFromSocket(unsigned int hSocket, void* pubDest, unsigned int cubDest,
unsigned int* pcubMsgSize)
{
return false;
}
bool networking::IsDataAvailable(unsigned int hListenSocket, unsigned int* pcubMsgSize, unsigned int* phSocket)
{
return false;
}
bool networking::RetrieveData(unsigned int hListenSocket, void* pubDest, unsigned int cubDest,
unsigned int* pcubMsgSize, unsigned int* phSocket)
{
return false;
}
bool networking::GetSocketInfo(unsigned int hSocket, steam_id* pSteamIDRemote, int* peSocketStatus,
unsigned int* punIPRemote, unsigned short* punPortRemote)
{
return false;
}
bool networking::GetListenSocketInfo(unsigned int hListenSocket, unsigned int* pnIP, unsigned short* pnPort)
{
return false;
}
int networking::GetSocketConnectionType(unsigned int hSocket)
{
return 0;
}
int networking::GetMaxPacketSize(unsigned int hSocket)
{
return 0;
}
}

View File

@ -0,0 +1,39 @@
#pragma once
namespace steam
{
class networking
{
public:
~networking() = default;
virtual bool SendP2PPacket(steam_id steamIDRemote, const void* pubData, unsigned int cubData, int eP2PSendType);
virtual bool IsP2PPacketAvailable(unsigned int* pcubMsgSize, int idk);
virtual bool ReadP2PPacket(void* pubDest, unsigned int cubDest, unsigned int* pcubMsgSize,
steam_id* psteamIDRemote);
virtual bool AcceptP2PSessionWithUser(steam_id steamIDRemote);
virtual bool CloseP2PSessionWithUser(steam_id steamIDRemote);
virtual bool CloseP2PChannelWithUser(steam_id steamIDRemote, int iVirtualPort);
virtual bool GetP2PSessionState(steam_id steamIDRemote, void* pConnectionState);
virtual bool AllowP2PPacketRelay(bool bAllow);
virtual unsigned int CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort,
bool bAllowUseOfPacketRelay);
virtual unsigned int CreateP2PConnectionSocket(steam_id steamIDTarget, int nVirtualPort, int nTimeoutSec,
bool bAllowUseOfPacketRelay);
virtual unsigned int CreateConnectionSocket(unsigned int nIP, unsigned short nPort, int nTimeoutSec);
virtual bool DestroySocket(unsigned int hSocket, bool bNotifyRemoteEnd);
virtual bool DestroyListenSocket(unsigned int hSocket, bool bNotifyRemoteEnd);
virtual bool SendDataOnSocket(unsigned int hSocket, void* pubData, unsigned int cubData, bool bReliable);
virtual bool IsDataAvailableOnSocket(unsigned int hSocket, unsigned int* pcubMsgSize);
virtual bool RetrieveDataFromSocket(unsigned int hSocket, void* pubDest, unsigned int cubDest,
unsigned int* pcubMsgSize);
virtual bool IsDataAvailable(unsigned int hListenSocket, unsigned int* pcubMsgSize, unsigned int* phSocket);
virtual bool RetrieveData(unsigned int hListenSocket, void* pubDest, unsigned int cubDest,
unsigned int* pcubMsgSize, unsigned int* phSocket);
virtual bool GetSocketInfo(unsigned int hSocket, steam_id* pSteamIDRemote, int* peSocketStatus,
unsigned int* punIPRemote, unsigned short* punPortRemote);
virtual bool GetListenSocketInfo(unsigned int hListenSocket, unsigned int* pnIP, unsigned short* pnPort);
virtual int GetSocketConnectionType(unsigned int hSocket);
virtual int GetMaxPacketSize(unsigned int hSocket);
};
}

View File

@ -0,0 +1,283 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
bool remote_storage::FileWrite(const char* pchFile, const void* pvData, int cubData)
{
return true;
}
int remote_storage::FileRead(const char* pchFile, void* pvData, int cubDataToRead)
{
return 0;
}
bool remote_storage::FileForget(const char* pchFile)
{
return true;
}
bool remote_storage::FileDelete(const char* pchFile)
{
return true;
}
unsigned long long remote_storage::FileShare(const char* pchFile)
{
return 0;
}
bool remote_storage::SetSyncPlatforms(const char* pchFile, unsigned int eRemoteStoragePlatform)
{
return true;
}
unsigned long long remote_storage::FileWriteStreamOpen(const char* pchFile)
{
return 0;
}
int remote_storage::FileWriteStreamWriteChunk(unsigned long long hStream, const void* pvData, int cubData)
{
return 1;
}
int remote_storage::FileWriteStreamClose(unsigned long long hStream)
{
return 1;
}
int remote_storage::FileWriteStreamCancel(unsigned long long hStream)
{
return 1;
}
bool remote_storage::FileExists(const char* pchFile)
{
return true;
}
bool remote_storage::FilePersisted(const char* pchFile)
{
return true;
}
int remote_storage::GetFileSize(const char* pchFile)
{
return 0;
}
long long remote_storage::GetFileTimestamp(const char* pchFile)
{
return 0;
}
unsigned remote_storage::GetSyncPlatforms(const char* pchFile)
{
return 0;
}
int remote_storage::GetFileCount()
{
return 0;
}
const char* remote_storage::GetFileNameAndSize(int iFile, int* pnFileSizeInBytes)
{
*pnFileSizeInBytes = 0;
return "";
}
bool remote_storage::GetQuota(int* pnTotalBytes, int* puAvailableBytes)
{
*pnTotalBytes = 0x10000000;
*puAvailableBytes = 0x10000000;
return false;
}
bool remote_storage::IsCloudEnabledForAccount()
{
return false;
}
bool remote_storage::IsCloudEnabledForApp()
{
return false;
}
void remote_storage::SetCloudEnabledForApp(bool bEnabled)
{
}
unsigned long long remote_storage::UGCDownload(unsigned long long hContent, unsigned int uUnk)
{
return 0;
}
bool remote_storage::GetUGCDownloadProgress(unsigned long long hContent, unsigned int* puDownloadedBytes,
unsigned int* puTotalBytes)
{
return false;
}
bool remote_storage::GetUGCDetails(unsigned long long hContent, unsigned int* pnAppID, char** ppchName,
int* pnFileSizeInBytes, steam_id* pSteamIDOwner)
{
return false;
}
int remote_storage::UGCRead(unsigned long long hContent, void* pvData, int cubDataToRead, unsigned int uOffset)
{
return 0;
}
int remote_storage::GetCachedUGCCount()
{
return 0;
}
unsigned long long remote_storage::GetCachedUGCHandle(int iCachedContent)
{
return 0;
}
unsigned long long remote_storage::PublishWorkshopFile(const char* pchFile, const char* pchPreviewFile,
unsigned int nConsumerAppId, const char* pchTitle,
const char* pchDescription, unsigned int eVisibility,
int* pTags, unsigned int eWorkshopFileType)
{
return 0;
}
unsigned long long remote_storage::CreatePublishedFileUpdateRequest(unsigned long long unPublishedFileId)
{
return 0;
}
bool remote_storage::UpdatePublishedFileFile(unsigned long long hUpdateRequest, const char* pchFile)
{
return false;
}
bool remote_storage::UpdatePublishedFilePreviewFile(unsigned long long hUpdateRequest, const char* pchPreviewFile)
{
return false;
}
bool remote_storage::UpdatePublishedFileTitle(unsigned long long hUpdateRequest, const char* pchTitle)
{
return false;
}
bool remote_storage::UpdatePublishedFileDescription(unsigned long long hUpdateRequest, const char* pchDescription)
{
return false;
}
bool remote_storage::UpdatePublishedFileVisibility(unsigned long long hUpdateRequest, unsigned int eVisibility)
{
return false;
}
bool remote_storage::UpdatePublishedFileTags(unsigned long long hUpdateRequest, int* pTags)
{
return false;
}
unsigned long long remote_storage::CommitPublishedFileUpdate(unsigned long long hUpdateRequest)
{
return 0;
}
unsigned long long remote_storage::GetPublishedFileDetails(unsigned long long unPublishedFileId)
{
return 0;
}
unsigned long long remote_storage::DeletePublishedFile(unsigned long long unPublishedFileId)
{
return 0;
}
unsigned long long remote_storage::EnumerateUserPublishedFiles(unsigned int uStartIndex)
{
return 0;
}
unsigned long long remote_storage::SubscribePublishedFile(unsigned long long unPublishedFileId)
{
return 0;
}
unsigned long long remote_storage::EnumerateUserSubscribedFiles(unsigned int uStartIndex)
{
return 0;
}
unsigned long long remote_storage::UnsubscribePublishedFile(unsigned long long unPublishedFileId)
{
return 0;
}
bool remote_storage::UpdatePublishedFileSetChangeDescription(unsigned long long hUpdateRequest,
const char* cszDescription)
{
return false;
}
unsigned long long remote_storage::GetPublishedItemVoteDetails(unsigned long long unPublishedFileId)
{
return 0;
}
unsigned long long remote_storage::UpdateUserPublishedItemVote(unsigned long long unPublishedFileId, bool bVoteUp)
{
return 0;
}
unsigned long long remote_storage::GetUserPublishedItemVoteDetails(unsigned long long unPublishedFileId)
{
return 0;
}
unsigned long long remote_storage::EnumerateUserSharedWorkshopFiles(unsigned int nAppId, steam_id creatorSteamID,
unsigned int uStartIndex, int* pRequiredTags,
int* pExcludedTags)
{
return 0;
}
unsigned long long remote_storage::PublishVideo(unsigned int eVideoProvider, const char* cszVideoAccountName,
const char* cszVideoIdentifier, const char* cszFileName,
unsigned int nConsumerAppId, const char* cszTitle,
const char* cszDescription, unsigned int eVisibility, int* pTags)
{
return 0;
}
unsigned long long remote_storage::SetUserPublishedFileAction(unsigned long long unPublishedFileId,
unsigned int eAction)
{
return 0;
}
unsigned long long remote_storage::EnumeratePublishedFilesByUserAction(
unsigned int eAction, unsigned int uStartIndex)
{
return 0;
}
unsigned long long remote_storage::EnumeratePublishedWorkshopFiles(unsigned int eType, unsigned int uStartIndex,
unsigned int cDays, unsigned int cCount,
int* pTags, int* pUserTags)
{
return 0;
}
unsigned long long remote_storage::UGCDownloadToLocation(unsigned long long hContent, const char* cszLocation,
unsigned int uUnk)
{
return 0;
}
}

View File

@ -0,0 +1,78 @@
#pragma once
namespace steam
{
class remote_storage
{
public:
~remote_storage() = default;
virtual bool FileWrite(const char* pchFile, const void* pvData, int cubData);
virtual int FileRead(const char* pchFile, void* pvData, int cubDataToRead);
virtual bool FileForget(const char* pchFile);
virtual bool FileDelete(const char* pchFile);
virtual unsigned long long FileShare(const char* pchFile);
virtual bool SetSyncPlatforms(const char* pchFile, unsigned int eRemoteStoragePlatform);
virtual unsigned long long FileWriteStreamOpen(const char* pchFile);
virtual int FileWriteStreamWriteChunk(unsigned long long hStream, const void* pvData, int cubData);
virtual int FileWriteStreamClose(unsigned long long hStream);
virtual int FileWriteStreamCancel(unsigned long long hStream);
virtual bool FileExists(const char* pchFile);
virtual bool FilePersisted(const char* pchFile);
virtual int GetFileSize(const char* pchFile);
virtual long long GetFileTimestamp(const char* pchFile);
virtual unsigned int GetSyncPlatforms(const char* pchFile);
virtual int GetFileCount();
virtual const char* GetFileNameAndSize(int iFile, int* pnFileSizeInBytes);
virtual bool GetQuota(int* pnTotalBytes, int* puAvailableBytes);
virtual bool IsCloudEnabledForAccount();
virtual bool IsCloudEnabledForApp();
virtual void SetCloudEnabledForApp(bool bEnabled);
virtual unsigned long long UGCDownload(unsigned long long hContent, unsigned int uUnk);
virtual bool GetUGCDownloadProgress(unsigned long long hContent, unsigned int* puDownloadedBytes,
unsigned int* puTotalBytes);
virtual bool GetUGCDetails(unsigned long long hContent, unsigned int* pnAppID, char** ppchName,
int* pnFileSizeInBytes, steam_id* pSteamIDOwner);
virtual int UGCRead(unsigned long long hContent, void* pvData, int cubDataToRead, unsigned int uOffset);
virtual int GetCachedUGCCount();
virtual unsigned long long GetCachedUGCHandle(int iCachedContent);
virtual unsigned long long PublishWorkshopFile(const char* pchFile, const char* pchPreviewFile,
unsigned int nConsumerAppId, const char* pchTitle,
const char* pchDescription, unsigned int eVisibility, int* pTags,
unsigned int eWorkshopFileType);
virtual unsigned long long CreatePublishedFileUpdateRequest(unsigned long long unPublishedFileId);
virtual bool UpdatePublishedFileFile(unsigned long long hUpdateRequest, const char* pchFile);
virtual bool UpdatePublishedFilePreviewFile(unsigned long long hUpdateRequest, const char* pchPreviewFile);
virtual bool UpdatePublishedFileTitle(unsigned long long hUpdateRequest, const char* pchTitle);
virtual bool UpdatePublishedFileDescription(unsigned long long hUpdateRequest, const char* pchDescription);
virtual bool UpdatePublishedFileVisibility(unsigned long long hUpdateRequest, unsigned int eVisibility);
virtual bool UpdatePublishedFileTags(unsigned long long hUpdateRequest, int* pTags);
virtual unsigned long long CommitPublishedFileUpdate(unsigned long long hUpdateRequest);
virtual unsigned long long GetPublishedFileDetails(unsigned long long unPublishedFileId);
virtual unsigned long long DeletePublishedFile(unsigned long long unPublishedFileId);
virtual unsigned long long EnumerateUserPublishedFiles(unsigned int uStartIndex);
virtual unsigned long long SubscribePublishedFile(unsigned long long unPublishedFileId);
virtual unsigned long long EnumerateUserSubscribedFiles(unsigned int uStartIndex);
virtual unsigned long long UnsubscribePublishedFile(unsigned long long unPublishedFileId);
virtual bool UpdatePublishedFileSetChangeDescription(unsigned long long hUpdateRequest,
const char* cszDescription);
virtual unsigned long long GetPublishedItemVoteDetails(unsigned long long unPublishedFileId);
virtual unsigned long long UpdateUserPublishedItemVote(unsigned long long unPublishedFileId, bool bVoteUp);
virtual unsigned long long GetUserPublishedItemVoteDetails(unsigned long long unPublishedFileId);
virtual unsigned long long EnumerateUserSharedWorkshopFiles(unsigned int nAppId, steam_id creatorSteamID,
unsigned int uStartIndex, int* pRequiredTags,
int* pExcludedTags);
virtual unsigned long long PublishVideo(unsigned int eVideoProvider, const char* cszVideoAccountName,
const char* cszVideoIdentifier, const char* cszFileName,
unsigned int nConsumerAppId, const char* cszTitle,
const char* cszDescription, unsigned int eVisibility, int* pTags);
virtual unsigned long long SetUserPublishedFileAction(unsigned long long unPublishedFileId,
unsigned int eAction);
virtual unsigned long long EnumeratePublishedFilesByUserAction(unsigned int eAction, unsigned int uStartIndex);
virtual unsigned long long EnumeratePublishedWorkshopFiles(unsigned int eType, unsigned int uStartIndex,
unsigned int cDays, unsigned int cCount, int* pTags,
int* pUserTags);
virtual unsigned long long UGCDownloadToLocation(unsigned long long hContent, const char* cszLocation,
unsigned int uUnk);
};
}

View File

@ -0,0 +1,164 @@
#include <std_include.hpp>
#include "../steam.hpp"
#include "component/auth.hpp"
namespace steam
{
namespace
{
std::string auth_ticket;
steam_id generate_steam_id()
{
steam_id id{};
id.bits = auth::get_guid();
return id;
}
}
int user::GetHSteamUser()
{
return NULL;
}
bool user::LoggedOn()
{
return true;
}
steam_id user::GetSteamID()
{
static auto id = generate_steam_id();
return id;
}
int user::InitiateGameConnection(void* pAuthBlob, int cbMaxAuthBlob, steam_id steamIDGameServer,
unsigned int unIPServer, unsigned short usPortServer, bool bSecure)
{
return 0;
}
void user::TerminateGameConnection(unsigned int unIPServer, unsigned short usPortServer)
{
}
void user::TrackAppUsageEvent(steam_id gameID, int eAppUsageEvent, const char* pchExtraInfo)
{
}
bool user::GetUserDataFolder(char* pchBuffer, int cubBuffer)
{
return false;
}
void user::StartVoiceRecording()
{
}
void user::StopVoiceRecording()
{
}
int user::GetAvailableVoice(unsigned int* pcbCompressed, unsigned int* pcbUncompressed,
unsigned int nUncompressedVoiceDesiredSampleRate)
{
return 0;
}
int user::GetVoice(bool bWantCompressed, void* pDestBuffer, unsigned int cbDestBufferSize,
unsigned int* nBytesWritten, bool bWantUncompressed, void* pUncompressedDestBuffer,
unsigned int cbUncompressedDestBufferSize, unsigned int* nUncompressBytesWritten,
unsigned int nUncompressedVoiceDesiredSampleRate)
{
return 0;
}
int user::DecompressVoice(void* pCompressed, unsigned int cbCompressed, void* pDestBuffer,
unsigned int cbDestBufferSize, unsigned int* nBytesWritten)
{
return 0;
}
unsigned int user::GetVoiceOptimalSampleRate()
{
return 0;
}
unsigned int user::GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket)
{
static uint32_t ticket = 0;
*pcbTicket = 1;
const auto result = callbacks::register_call();
auto* response = static_cast<get_auth_session_ticket_response*>(calloc(
1, sizeof(get_auth_session_ticket_response)));
response->m_h_auth_ticket = ++ticket;
response->m_e_result = 1; // k_EResultOK;
callbacks::return_call(response, sizeof(get_auth_session_ticket_response),
get_auth_session_ticket_response::callback_id, result);
return response->m_h_auth_ticket;
}
int user::BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, steam_id steamID)
{
return 0;
}
void user::EndAuthSession(steam_id steamID)
{
}
void user::CancelAuthTicket(unsigned int hAuthTicket)
{
}
unsigned int user::UserHasLicenseForApp(steam_id steamID, unsigned int appID)
{
return 0;
}
bool user::BIsBehindNAT()
{
return false;
}
void user::AdvertiseGame(steam_id steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer)
{
}
unsigned long long user::RequestEncryptedAppTicket(void* pUserData, int cbUserData)
{
const auto id = this->GetSteamID();
auth_ticket = "S1";
auth_ticket.resize(32);
auth_ticket.append(static_cast<char*>(pUserData), 24); // key
auth_ticket.append(reinterpret_cast<const char*>(&id.bits), sizeof(id.bits)); // user id
auth_ticket.append(&static_cast<char*>(pUserData)[24], 64); // user name
// Create the call response
const auto result = callbacks::register_call();
const auto retvals = static_cast<encrypted_app_ticket_response*>(calloc(1, sizeof(encrypted_app_ticket_response)));
//::Utils::Memory::AllocateArray<EncryptedAppTicketResponse>();
retvals->m_e_result = 1;
// Return the call response
callbacks::return_call(retvals, sizeof(encrypted_app_ticket_response),
encrypted_app_ticket_response::callback_id, result);
return result;
}
bool user::GetEncryptedAppTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket)
{
if (cbMaxTicket < 0 || auth_ticket.empty()) return false;
const auto size = std::min(size_t(cbMaxTicket), auth_ticket.size());
std::memcpy(pTicket, auth_ticket.data(), size);
*pcbTicket = static_cast<unsigned>(size);
return true;
}
}

View File

@ -0,0 +1,55 @@
#pragma once
namespace steam
{
struct encrypted_app_ticket_response final
{
enum { callback_id = 154 };
int m_e_result;
};
struct get_auth_session_ticket_response
{
enum { callback_id = 163 };
unsigned int m_h_auth_ticket;
int m_e_result;
};
class user
{
public:
~user() = default;
virtual int GetHSteamUser();
virtual bool LoggedOn();
virtual steam_id GetSteamID();
virtual int InitiateGameConnection(void* pAuthBlob, int cbMaxAuthBlob, steam_id steamIDGameServer,
unsigned int unIPServer, unsigned short usPortServer, bool bSecure);
virtual void TerminateGameConnection(unsigned int unIPServer, unsigned short usPortServer);
virtual void TrackAppUsageEvent(steam_id gameID, int eAppUsageEvent, const char* pchExtraInfo = "");
virtual bool GetUserDataFolder(char* pchBuffer, int cubBuffer);
virtual void StartVoiceRecording();
virtual void StopVoiceRecording();
virtual int GetAvailableVoice(unsigned int* pcbCompressed, unsigned int* pcbUncompressed,
unsigned int nUncompressedVoiceDesiredSampleRate);
virtual int GetVoice(bool bWantCompressed, void* pDestBuffer, unsigned int cbDestBufferSize,
unsigned int* nBytesWritten, bool bWantUncompressed, void* pUncompressedDestBuffer,
unsigned int cbUncompressedDestBufferSize, unsigned int* nUncompressBytesWritten,
unsigned int nUncompressedVoiceDesiredSampleRate);
virtual int DecompressVoice(void* pCompressed, unsigned int cbCompressed, void* pDestBuffer,
unsigned int cbDestBufferSize, unsigned int* nBytesWritten);
virtual unsigned int GetVoiceOptimalSampleRate();
virtual unsigned int GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket);
virtual int BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, steam_id steamID);
virtual void EndAuthSession(steam_id steamID);
virtual void CancelAuthTicket(unsigned int hAuthTicket);
virtual unsigned int UserHasLicenseForApp(steam_id steamID, unsigned int appID);
virtual bool BIsBehindNAT();
virtual void AdvertiseGame(steam_id steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer);
virtual unsigned long long RequestEncryptedAppTicket(void* pUserData, int cbUserData);
virtual bool GetEncryptedAppTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket);
};
}

View File

@ -0,0 +1,231 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
bool user_stats::RequestCurrentStats()
{
return true;
}
bool user_stats::GetStat(const char* pchName, int* pData)
{
return false;
}
bool user_stats::GetStat(const char* pchName, float* pData)
{
return false;
}
bool user_stats::SetStat(const char* pchName, int nData)
{
return false;
}
bool user_stats::SetStat(const char* pchName, float fData)
{
return false;
}
bool user_stats::UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength)
{
return false;
}
bool user_stats::GetAchievement(const char* pchName, bool* pbAchieved)
{
return true;
}
bool user_stats::SetAchievement(const char* pchName)
{
return true;
}
bool user_stats::ClearAchievement(const char* pchName)
{
return true;
}
bool user_stats::GetAchievementAndUnlockTime(const char* pchName, bool* pbAchieved, unsigned int* punUnlockTime)
{
return true;
}
bool user_stats::StoreStats()
{
return true;
}
int user_stats::GetAchievementIcon(const char* pchName)
{
return 0;
}
const char* user_stats::GetAchievementDisplayAttribute(const char* pchName, const char* pchKey)
{
return "";
}
bool user_stats::IndicateAchievementProgress(const char* pchName, unsigned int nCurProgress,
unsigned int nMaxProgress)
{
return true;
}
unsigned int user_stats::GetNumAchievements()
{
return 0;
}
const char* user_stats::GetAchievementName(unsigned int iAchievement)
{
return "";
}
unsigned long long user_stats::RequestUserStats(steam_id steamIDUser)
{
return 0;
}
bool user_stats::GetUserStat(steam_id steamIDUser, const char* pchName, int* pData)
{
return false;
}
bool user_stats::GetUserStat(steam_id steamIDUser, const char* pchName, float* pData)
{
return false;
}
bool user_stats::GetUserAchievement(steam_id steamIDUser, const char* pchName, bool* pbAchieved)
{
return true;
}
bool user_stats::GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char* pchName, bool* pbAchieved,
unsigned int* punUnlockTime)
{
return true;
}
bool user_stats::ResetAllStats(bool bAchievementsToo)
{
return false;
}
unsigned long long user_stats::FindOrCreateLeaderboard(const char* pchLeaderboardName, int eLeaderboardSortMethod,
int eLeaderboardDisplayType)
{
return 0;
}
unsigned long long user_stats::FindLeaderboard(const char* pchLeaderboardName)
{
return 0;
}
const char* user_stats::GetLeaderboardName(unsigned long long hSteamLeaderboard)
{
return "";
}
int user_stats::GetLeaderboardEntryCount(unsigned long long hSteamLeaderboard)
{
return 0;
}
int user_stats::GetLeaderboardSortMethod(unsigned long long hSteamLeaderboard)
{
return 0;
}
int user_stats::GetLeaderboardDisplayType(unsigned long long hSteamLeaderboard)
{
return 0;
}
unsigned long long user_stats::DownloadLeaderboardEntries(unsigned long long hSteamLeaderboard,
int eLeaderboardDataRequest, int nRangeStart,
int nRangeEnd)
{
return 0;
}
unsigned long long user_stats::DownloadLeaderboardEntriesForUsers(unsigned long long hSteamLeaderboard,
steam_id* prgUsers, int cUsers)
{
return 0;
}
bool user_stats::GetDownloadedLeaderboardEntry(unsigned long long hSteamLeaderboardEntries, int index,
int* pLeaderboardEntry, int* pDetails, int cDetailsMax)
{
return false;
}
unsigned long long user_stats::UploadLeaderboardScore(unsigned long long hSteamLeaderboard,
int eLeaderboardUploadScoreMethod, int nScore,
const int* pScoreDetails, int cScoreDetailsCount)
{
return 0;
}
unsigned long long user_stats::AttachLeaderboardUGC(unsigned long long hSteamLeaderboard, unsigned long long hUGC)
{
return 0;
}
unsigned long long user_stats::GetNumberOfCurrentPlayers()
{
return 0;
}
unsigned long long user_stats::RequestGlobalAchievementPercentages()
{
return 0;
}
int user_stats::GetMostAchievedAchievementInfo(char* pchName, unsigned int unNameBufLen, float* pflPercent,
bool* pbAchieved)
{
return 0;
}
int user_stats::GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char* pchName, unsigned int unNameBufLen,
float* pflPercent, bool* pbAchieved)
{
return 0;
}
bool user_stats::GetAchievementAchievedPercent(const char* pchName, float* pflPercent)
{
return true;
}
unsigned long long user_stats::RequestGlobalStats(int nHistoryDays)
{
return 0;
}
bool user_stats::GetGlobalStat(const char* pchStatName, long long* pData)
{
return false;
}
bool user_stats::GetGlobalStat(const char* pchStatName, double* pData)
{
return false;
}
int user_stats::GetGlobalStatHistory(const char* pchStatName, long long* pData, unsigned int cubData)
{
return 0;
}
int user_stats::GetGlobalStatHistory(const char* pchStatName, double* pData, unsigned int cubData)
{
return 0;
}
}

View File

@ -0,0 +1,65 @@
#pragma once
namespace steam
{
class user_stats
{
public:
~user_stats() = default;
virtual bool RequestCurrentStats();
virtual bool GetStat(const char* pchName, int* pData);
virtual bool GetStat(const char* pchName, float* pData);
virtual bool SetStat(const char* pchName, int nData);
virtual bool SetStat(const char* pchName, float fData);
virtual bool UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength);
virtual bool GetAchievement(const char* pchName, bool* pbAchieved);
virtual bool SetAchievement(const char* pchName);
virtual bool ClearAchievement(const char* pchName);
virtual bool GetAchievementAndUnlockTime(const char* pchName, bool* pbAchieved, unsigned int* punUnlockTime);
virtual bool StoreStats();
virtual int GetAchievementIcon(const char* pchName);
virtual const char* GetAchievementDisplayAttribute(const char* pchName, const char* pchKey);
virtual bool IndicateAchievementProgress(const char* pchName, unsigned int nCurProgress,
unsigned int nMaxProgress);
virtual unsigned int GetNumAchievements();
virtual const char* GetAchievementName(unsigned int iAchievement);
virtual unsigned long long RequestUserStats(steam_id steamIDUser);
virtual bool GetUserStat(steam_id steamIDUser, const char* pchName, int* pData);
virtual bool GetUserStat(steam_id steamIDUser, const char* pchName, float* pData);
virtual bool GetUserAchievement(steam_id steamIDUser, const char* pchName, bool* pbAchieved);
virtual bool GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char* pchName, bool* pbAchieved,
unsigned int* punUnlockTime);
virtual bool ResetAllStats(bool bAchievementsToo);
virtual unsigned long long FindOrCreateLeaderboard(const char* pchLeaderboardName, int eLeaderboardSortMethod,
int eLeaderboardDisplayType);
virtual unsigned long long FindLeaderboard(const char* pchLeaderboardName);
virtual const char* GetLeaderboardName(unsigned long long hSteamLeaderboard);
virtual int GetLeaderboardEntryCount(unsigned long long hSteamLeaderboard);
virtual int GetLeaderboardSortMethod(unsigned long long hSteamLeaderboard);
virtual int GetLeaderboardDisplayType(unsigned long long hSteamLeaderboard);
virtual unsigned long long DownloadLeaderboardEntries(unsigned long long hSteamLeaderboard,
int eLeaderboardDataRequest, int nRangeStart,
int nRangeEnd);
virtual unsigned long long DownloadLeaderboardEntriesForUsers(unsigned long long hSteamLeaderboard,
steam_id* prgUsers, int cUsers);
virtual bool GetDownloadedLeaderboardEntry(unsigned long long hSteamLeaderboardEntries, int index,
int* pLeaderboardEntry, int* pDetails, int cDetailsMax);
virtual unsigned long long UploadLeaderboardScore(unsigned long long hSteamLeaderboard,
int eLeaderboardUploadScoreMethod, int nScore,
const int* pScoreDetails, int cScoreDetailsCount);
virtual unsigned long long AttachLeaderboardUGC(unsigned long long hSteamLeaderboard, unsigned long long hUGC);
virtual unsigned long long GetNumberOfCurrentPlayers();
virtual unsigned long long RequestGlobalAchievementPercentages();
virtual int GetMostAchievedAchievementInfo(char* pchName, unsigned int unNameBufLen, float* pflPercent,
bool* pbAchieved);
virtual int GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char* pchName, unsigned int unNameBufLen,
float* pflPercent, bool* pbAchieved);
virtual bool GetAchievementAchievedPercent(const char* pchName, float* pflPercent);
virtual unsigned long long RequestGlobalStats(int nHistoryDays);
virtual bool GetGlobalStat(const char* pchStatName, long long* pData);
virtual bool GetGlobalStat(const char* pchStatName, double* pData);
virtual int GetGlobalStatHistory(const char* pchStatName, long long* pData, unsigned int cubData);
virtual int GetGlobalStatHistory(const char* pchStatName, double* pData, unsigned int cubData);
};
}

View File

@ -0,0 +1,118 @@
#include <std_include.hpp>
#include "../steam.hpp"
namespace steam
{
unsigned int utils::GetSecondsSinceAppActive()
{
return 0;
}
unsigned int utils::GetSecondsSinceComputerActive()
{
return (uint32_t)GetTickCount64() / 1000;
}
int utils::GetConnectedUniverse()
{
return 1;
}
unsigned int utils::GetServerRealTime()
{
return (uint32_t)time(NULL);
}
const char* utils::GetIPCountry()
{
return "US";
}
bool utils::GetImageSize(int iImage, unsigned int* pnWidth, unsigned int* pnHeight)
{
return false;
}
bool utils::GetImageRGBA(int iImage, unsigned char* pubDest, int nDestBufferSize)
{
return false;
}
bool utils::GetCSERIPPort(unsigned int* unIP, unsigned short* usPort)
{
return false;
}
unsigned char utils::GetCurrentBatteryPower()
{
return 255;
}
unsigned int utils::GetAppID()
{
return 209660;
}
void utils::SetOverlayNotificationPosition(int eNotificationPosition)
{
}
bool utils::IsAPICallCompleted(unsigned long long hSteamAPICall, bool* pbFailed)
{
return false;
}
int utils::GetAPICallFailureReason(unsigned long long hSteamAPICall)
{
return -1;
}
bool utils::GetAPICallResult(unsigned long long hSteamAPICall, void* pCallback, int cubCallback,
int iCallbackExpected, bool* pbFailed)
{
return false;
}
void utils::RunFrame()
{
}
unsigned int utils::GetIPCCallCount()
{
return 0;
}
void utils::SetWarningMessageHook(void (*pFunction)(int hpipe, const char* message))
{
}
bool utils::IsOverlayEnabled()
{
return false;
}
bool utils::BOverlayNeedsPresent()
{
return false;
}
unsigned long long utils::CheckFileSignature(const char* szFileName)
{
return 0;
}
bool utils::ShowGamepadTextInput(int eInputMode, int eInputLineMode, const char* szText, unsigned int uMaxLength)
{
return false;
}
unsigned int utils::GetEnteredGamepadTextLength()
{
return 0;
}
bool utils::GetEnteredGamepadTextInput(char* pchValue, unsigned int cchValueMax)
{
return false;
}
}

View File

@ -0,0 +1,37 @@
#pragma once
namespace steam
{
class utils
{
public:
~utils() = default;
virtual unsigned int GetSecondsSinceAppActive();
virtual unsigned int GetSecondsSinceComputerActive();
virtual int GetConnectedUniverse();
virtual unsigned int GetServerRealTime();
virtual const char* GetIPCountry();
virtual bool GetImageSize(int iImage, unsigned int* pnWidth, unsigned int* pnHeight);
virtual bool GetImageRGBA(int iImage, unsigned char* pubDest, int nDestBufferSize);
virtual bool GetCSERIPPort(unsigned int* unIP, unsigned short* usPort);
virtual unsigned char GetCurrentBatteryPower();
virtual unsigned int GetAppID();
virtual void SetOverlayNotificationPosition(int eNotificationPosition);
virtual bool IsAPICallCompleted(unsigned long long hSteamAPICall, bool* pbFailed);
virtual int GetAPICallFailureReason(unsigned long long hSteamAPICall);
virtual bool GetAPICallResult(unsigned long long hSteamAPICall, void* pCallback, int cubCallback,
int iCallbackExpected, bool* pbFailed);
virtual void RunFrame();
virtual unsigned int GetIPCCallCount();
virtual void SetWarningMessageHook(void (*pFunction)(int hpipe, const char* message));
virtual bool IsOverlayEnabled();
virtual bool BOverlayNeedsPresent();
virtual unsigned long long CheckFileSignature(const char* szFileName);
virtual bool ShowGamepadTextInput(int eInputMode, int eInputLineMode, const char* szText,
unsigned int uMaxLength);
virtual unsigned int GetEnteredGamepadTextLength();
virtual bool GetEnteredGamepadTextInput(char* pchValue, unsigned int cchValueMax);
};
}

238
src/client/steam/steam.cpp Normal file
View File

@ -0,0 +1,238 @@
#include <std_include.hpp>
#include "steam.hpp"
namespace steam
{
uint64_t callbacks::call_id_ = 0;
std::recursive_mutex callbacks::mutex_;
std::map<uint64_t, bool> callbacks::calls_;
std::map<uint64_t, callbacks::base*> callbacks::result_handlers_;
std::vector<callbacks::result> callbacks::results_;
std::vector<callbacks::base*> callbacks::callback_list_;
uint64_t callbacks::register_call()
{
std::lock_guard<std::recursive_mutex> _(mutex_);
calls_[++call_id_] = false;
return call_id_;
}
void callbacks::register_callback(base* handler, const int callback)
{
std::lock_guard<std::recursive_mutex> _(mutex_);
handler->set_i_callback(callback);
callback_list_.push_back(handler);
}
void callbacks::unregister_callback(base* handler)
{
std::lock_guard<std::recursive_mutex> _(mutex_);
for (auto i = callback_list_.begin(); i != callback_list_.end();)
{
if (*i == handler)
{
i = callback_list_.erase(i);
}
else
{
++i;
}
}
}
void callbacks::register_call_result(const uint64_t call, base* result)
{
std::lock_guard<std::recursive_mutex> _(mutex_);
result_handlers_[call] = result;
}
void callbacks::unregister_call_result(const uint64_t call, base* /*result*/)
{
std::lock_guard<std::recursive_mutex> _(mutex_);
const auto i = result_handlers_.find(call);
if (i != result_handlers_.end())
{
result_handlers_.erase(i);
}
}
void callbacks::return_call(void* data, const int size, const int type, const uint64_t call)
{
std::lock_guard<std::recursive_mutex> _(mutex_);
result result{};
result.call = call;
result.data = data;
result.size = size;
result.type = type;
calls_[call] = true;
results_.emplace_back(result);
}
void callbacks::run_callbacks()
{
std::lock_guard<std::recursive_mutex> _(mutex_);
for (const auto& result : results_)
{
if (result_handlers_.find(result.call) != result_handlers_.end())
{
result_handlers_[result.call]->run(result.data, false, result.call);
}
for (const auto& callback : callback_list_)
{
if (callback && callback->get_i_callback() == result.type)
{
callback->run(result.data, false, 0);
}
}
if (result.data)
{
free(result.data);
}
}
results_.clear();
}
extern "C" {
bool SteamAPI_RestartAppIfNecessary()
{
return false;
}
bool SteamAPI_Init()
{
return true;
}
void SteamAPI_RegisterCallResult(callbacks::base* result, const uint64_t call)
{
callbacks::register_call_result(call, result);
}
void SteamAPI_RegisterCallback(callbacks::base* handler, const int callback)
{
callbacks::register_callback(handler, callback);
}
void SteamAPI_RunCallbacks()
{
callbacks::run_callbacks();
}
void SteamAPI_Shutdown()
{
}
void SteamAPI_UnregisterCallResult(callbacks::base* result, const uint64_t call)
{
callbacks::unregister_call_result(call, result);
}
void SteamAPI_UnregisterCallback(callbacks::base* handler)
{
callbacks::unregister_callback(handler);
}
const char* SteamAPI_GetSteamInstallPath()
{
static std::string install_path{};
if (!install_path.empty())
{
return install_path.data();
}
HKEY reg_key;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\WOW6432Node\\Valve\\Steam", 0, KEY_QUERY_VALUE,
&reg_key) ==
ERROR_SUCCESS)
{
char path[MAX_PATH] = {0};
DWORD length = sizeof(path);
RegQueryValueExA(reg_key, "InstallPath", nullptr, nullptr, reinterpret_cast<BYTE*>(path),
&length);
RegCloseKey(reg_key);
install_path = path;
}
return install_path.data();
}
bool SteamGameServer_Init()
{
return true;
}
void SteamGameServer_RunCallbacks()
{
}
void SteamGameServer_Shutdown()
{
}
friends* SteamFriends()
{
static friends friends;
return &friends;
}
matchmaking* SteamMatchmaking()
{
static matchmaking matchmaking;
return &matchmaking;
}
game_server* SteamGameServer()
{
static game_server game_server;
return &game_server;
}
networking* SteamNetworking()
{
static networking networking;
return &networking;
}
remote_storage* SteamRemoteStorage()
{
static remote_storage remote_storage;
return &remote_storage;
}
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;
}
}
}

121
src/client/steam/steam.hpp Normal file
View File

@ -0,0 +1,121 @@
#pragma once
#define STEAM_EXPORT extern "C" __declspec(dllexport)
struct raw_steam_id final
{
unsigned int account_id : 32;
unsigned int account_instance : 20;
unsigned int account_type : 4;
int universe : 8;
};
typedef union
{
raw_steam_id raw;
unsigned long long bits;
} steam_id;
#pragma pack( push, 1 )
struct raw_game_id final
{
unsigned int app_id : 24;
unsigned int type : 8;
unsigned int mod_id : 32;
};
typedef union
{
raw_game_id raw;
unsigned long long bits;
} game_id;
#pragma pack( pop )
#include "interfaces/apps.hpp"
#include "interfaces/user.hpp"
#include "interfaces/utils.hpp"
#include "interfaces/friends.hpp"
#include "interfaces/user_stats.hpp"
#include "interfaces/game_server.hpp"
#include "interfaces/networking.hpp"
#include "interfaces/matchmaking.hpp"
#include "interfaces/remote_storage.hpp"
namespace steam
{
class callbacks
{
public:
class base
{
public:
base() : flags_(0), callback_(0)
{
}
virtual void run(void* pv_param) = 0;
virtual void run(void* pv_param, bool failure, uint64_t handle) = 0;
virtual int get_callback_size_bytes() = 0;
int get_i_callback() const { return callback_; }
void set_i_callback(const int i_callback) { callback_ = i_callback; }
protected:
~base() = default;
unsigned char flags_;
int callback_;
};
struct result final
{
void* data{};
int size{};
int type{};
uint64_t call{};
};
static uint64_t register_call();
static void register_callback(base* handler, int callback);
static void unregister_callback(base* handler);
static void register_call_result(uint64_t call, base* result);
static void unregister_call_result(uint64_t call, base* result);
static void return_call(void* data, int size, int type, uint64_t call);
static void run_callbacks();
private:
static uint64_t call_id_;
static std::recursive_mutex mutex_;
static std::map<uint64_t, bool> calls_;
static std::map<uint64_t, base*> result_handlers_;
static std::vector<result> results_;
static std::vector<base*> callback_list_;
};
STEAM_EXPORT bool SteamAPI_RestartAppIfNecessary();
STEAM_EXPORT bool SteamAPI_Init();
STEAM_EXPORT void SteamAPI_RegisterCallResult(callbacks::base* result, uint64_t call);
STEAM_EXPORT void SteamAPI_RegisterCallback(callbacks::base* handler, int callback);
STEAM_EXPORT void SteamAPI_RunCallbacks();
STEAM_EXPORT void SteamAPI_Shutdown();
STEAM_EXPORT void SteamAPI_UnregisterCallResult(callbacks::base* result, const uint64_t call);
STEAM_EXPORT void SteamAPI_UnregisterCallback(callbacks::base* handler);
STEAM_EXPORT const char* SteamAPI_GetSteamInstallPath();
STEAM_EXPORT bool SteamGameServer_Init();
STEAM_EXPORT void SteamGameServer_RunCallbacks();
STEAM_EXPORT void SteamGameServer_Shutdown();
STEAM_EXPORT friends* SteamFriends();
STEAM_EXPORT matchmaking* SteamMatchmaking();
STEAM_EXPORT game_server* SteamGameServer();
STEAM_EXPORT networking* SteamNetworking();
STEAM_EXPORT remote_storage* SteamRemoteStorage();
STEAM_EXPORT user* SteamUser();
STEAM_EXPORT utils* SteamUtils();
STEAM_EXPORT apps* SteamApps();
STEAM_EXPORT user_stats* SteamUserStats();
}