diff --git a/src/steam/interfaces/SteamApps.cpp b/src/steam/interfaces/SteamApps.cpp new file mode 100644 index 0000000..e966817 --- /dev/null +++ b/src/steam/interfaces/SteamApps.cpp @@ -0,0 +1,72 @@ +#include + +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) + { + } +} diff --git a/src/steam/interfaces/SteamApps.hpp b/src/steam/interfaces/SteamApps.hpp new file mode 100644 index 0000000..123e4df --- /dev/null +++ b/src/steam/interfaces/SteamApps.hpp @@ -0,0 +1,23 @@ +#pragma once + +namespace steam +{ + class apps final + { + public: + 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); + }; +} diff --git a/src/steam/interfaces/SteamFriends.cpp b/src/steam/interfaces/SteamFriends.cpp new file mode 100644 index 0000000..555dffb --- /dev/null +++ b/src/steam/interfaces/SteamFriends.cpp @@ -0,0 +1,217 @@ +#include + +namespace steam +{ + const char *friends::GetPersonaName() + { + return "GlaDos"; + } + + void friends::SetPersonaName(const char *pchPersonaName) + { + + } + + 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); + } + + 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) + { + OutputDebugStringA("Store requested!"); + } + + 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 __int64 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"; + } + + 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; + } +} diff --git a/src/steam/interfaces/SteamFriends.hpp b/src/steam/interfaces/SteamFriends.hpp new file mode 100644 index 0000000..c97850f --- /dev/null +++ b/src/steam/interfaces/SteamFriends.hpp @@ -0,0 +1,53 @@ +#pragma once + +namespace steam +{ + class friends final + { + public: + virtual const char *GetPersonaName(); + virtual void 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 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); + 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 __int64 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 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); + }; +} diff --git a/src/steam/interfaces/SteamGameServer.cpp b/src/steam/interfaces/SteamGameServer.cpp new file mode 100644 index 0000000..d3b580e --- /dev/null +++ b/src/steam/interfaces/SteamGameServer.cpp @@ -0,0 +1,96 @@ +#include + +namespace steam +{ + void game_server::LogOn() + { + } + + void game_server::LogOff() + { + } + + bool game_server::LoggedOn() + { + return true; + } + + bool game_server::Secure() + { + return false; + } + + steam_id game_server::GetSteamID() + { + return steam_id(); + } + + bool game_server::SendUserConnectAndAuthenticate(unsigned int unIPClient, const void *pvAuthBlob, unsigned int cubAuthBlobSize, steam_id *pSteamIDUser) + { + return true; + } + + steam_id game_server::CreateUnauthenticatedUserConnection() + { + return steam_id(); + } + + void game_server::SendUserDisconnect(steam_id steamIDUser) + { + } + + bool game_server::UpdateUserData(steam_id steamIDUser, const char *pchPlayerName, unsigned int uScore) + { + return true; + } + + bool game_server::SetServerType(unsigned int unServerFlags, unsigned int unGameIP, unsigned short unGamePort, unsigned short unSpectatorPort, unsigned short usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode) + { + return true; + } + + void game_server::UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char *pchServerName, const char *pSpectatorServerName, const char *pchMapName) + { + } + + void game_server::UpdateSpectatorPort(unsigned short unSpectatorPort) + { + } + + void game_server::SetGameType(const char *pchGameType) + { + } + + bool game_server::GetUserAchievementStatus(steam_id steamID, const char *pchAchievementName) + { + return false; + } + + void game_server::GetGameplayStats() + { + } + + unsigned __int64 game_server::GetServerReputation() + { + return 0; + } + + bool game_server::RequestUserGroupStatus(steam_id steamIDUser, steam_id steamIDGroup) + { + return false; + } + + unsigned int game_server::GetPublicIP() + { + return 0; + } + + void game_server::SetGameData(const char *pchGameData) + { + } + + int game_server::UserHasLicenseForApp(steam_id steamID, unsigned int appID) + { + return 0; + } +} diff --git a/src/steam/interfaces/SteamGameServer.hpp b/src/steam/interfaces/SteamGameServer.hpp new file mode 100644 index 0000000..8f1c70e --- /dev/null +++ b/src/steam/interfaces/SteamGameServer.hpp @@ -0,0 +1,29 @@ +#pragma once + +namespace steam +{ + class game_server final + { + public: + virtual void LogOn(); + virtual void LogOff(); + virtual bool LoggedOn(); + virtual bool Secure(); + virtual steam_id GetSteamID(); + virtual bool 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 UpdateUserData(steam_id steamIDUser, const char *pchPlayerName, unsigned int uScore); + virtual bool SetServerType(unsigned int unServerFlags, unsigned int unGameIP, unsigned short unGamePort, unsigned short unSpectatorPort, unsigned short usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode); + virtual void UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char *pchServerName, const char *pSpectatorServerName, const char *pchMapName); + virtual void UpdateSpectatorPort(unsigned short unSpectatorPort); + virtual void SetGameType(const char *pchGameType); + virtual bool GetUserAchievementStatus(steam_id steamID, const char *pchAchievementName); + virtual void GetGameplayStats(); + virtual unsigned __int64 GetServerReputation(); + virtual bool RequestUserGroupStatus(steam_id steamIDUser, steam_id steamIDGroup); + virtual unsigned int GetPublicIP(); + virtual void SetGameData(const char *pchGameData); + virtual int UserHasLicenseForApp(steam_id steamID, unsigned int appID); + }; +} diff --git a/src/steam/interfaces/SteamMasterServerUpdater.cpp b/src/steam/interfaces/SteamMasterServerUpdater.cpp new file mode 100644 index 0000000..ab6778b --- /dev/null +++ b/src/steam/interfaces/SteamMasterServerUpdater.cpp @@ -0,0 +1,67 @@ +#include + +namespace steam +{ + void master_server_updater::SetActive(bool bActive) + { + } + + void master_server_updater::SetHeartbeatInterval(int iHeartbeatInterval) + { + } + + bool master_server_updater::HandleIncomingPacket(const void *pData, int cbData, unsigned int srcIP, unsigned short srcPort) + { + return true; + } + + int master_server_updater::GetNextOutgoingPacket(void *pOut, int cbMaxOut, unsigned int *pNetAdr, unsigned short *pPort) + { + return 0; + } + + void master_server_updater::SetBasicServerData(unsigned short nProtocolVersion, bool bDedicatedServer, const char *pRegionName, const char *pProductName, unsigned short nMaxReportedClients, bool bPasswordProtected, const char *pGameDescription) + { + } + + void master_server_updater::ClearAllKeyValues() + { + } + + void master_server_updater::SetKeyValue(const char *pKey, const char *pValue) + { + } + + void master_server_updater::NotifyShutdown() + { + } + + bool master_server_updater::WasRestartRequested() + { + return false; + } + + void master_server_updater::ForceHeartbeat() + { + } + + bool master_server_updater::AddMasterServer(const char *pServerAddress) + { + return true; + } + + bool master_server_updater::RemoveMasterServer(const char *pServerAddress) + { + return true; + } + + int master_server_updater::GetNumMasterServers() + { + return 0; + } + + int master_server_updater::GetMasterServerAddress(int iServer, char *pOut, int outBufferSize) + { + return 0; + } +} diff --git a/src/steam/interfaces/SteamMasterServerUpdater.hpp b/src/steam/interfaces/SteamMasterServerUpdater.hpp new file mode 100644 index 0000000..ffb9c6e --- /dev/null +++ b/src/steam/interfaces/SteamMasterServerUpdater.hpp @@ -0,0 +1,23 @@ +#pragma once + +namespace steam +{ + class master_server_updater final + { + public: + virtual void SetActive(bool bActive); + virtual void SetHeartbeatInterval(int iHeartbeatInterval); + 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 SetBasicServerData(unsigned short nProtocolVersion, bool bDedicatedServer, const char *pRegionName, const char *pProductName, unsigned short nMaxReportedClients, bool bPasswordProtected, const char *pGameDescription); + virtual void ClearAllKeyValues(); + virtual void SetKeyValue(const char *pKey, const char *pValue); + virtual void NotifyShutdown(); + virtual bool WasRestartRequested(); + virtual void ForceHeartbeat(); + virtual bool AddMasterServer(const char *pServerAddress); + virtual bool RemoveMasterServer(const char *pServerAddress); + virtual int GetNumMasterServers(); + virtual int GetMasterServerAddress(int iServer, char *pOut, int outBufferSize); + }; +} diff --git a/src/steam/interfaces/SteamMatchmaking.cpp b/src/steam/interfaces/SteamMatchmaking.cpp new file mode 100644 index 0000000..040ab09 --- /dev/null +++ b/src/steam/interfaces/SteamMatchmaking.cpp @@ -0,0 +1,201 @@ +#include + +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 __int64 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) + { + } + + steam_id matchmaking::GetLobbyByIndex(int iLobby) + { + return steam_id(); + } + + unsigned __int64 matchmaking::CreateLobby(int eLobbyType, int cMaxMembers) + { + const auto result = callbacks::register_call(); + auto retvals = static_cast(calloc(1, sizeof(lobby_created)));//::Utils::Memory::AllocateArray(); + steam_id id; + + id.raw.account_id = 1337132; + 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 __int64 matchmaking::JoinLobby(steam_id steamIDLobby) + { + const auto result = callbacks::register_call(); + auto* retvals = static_cast(calloc(1, sizeof(lobby_enter)));//::Utils::Memory::AllocateArray(); + 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) + { + //Components::Party::RemoveLobby(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 "212";//Components::Party::GetLobbyInfo(steamIDLobby, pchKey); + } + + 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 false; + } + + bool matchmaking::DeleteLobbyData(steam_id steamIDLobby, const char *pchKey) + { + return false; + } + + 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 false; + } + + 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 false; + } + + 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; + } +} diff --git a/src/steam/interfaces/SteamMatchmaking.hpp b/src/steam/interfaces/SteamMatchmaking.hpp new file mode 100644 index 0000000..350a6c5 --- /dev/null +++ b/src/steam/interfaces/SteamMatchmaking.hpp @@ -0,0 +1,64 @@ +#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 final + { + public: + 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 __int64 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 steam_id GetLobbyByIndex(int iLobby); + virtual unsigned __int64 CreateLobby(int eLobbyType, int cMaxMembers); + virtual unsigned __int64 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); + }; +} diff --git a/src/steam/interfaces/SteamMatchmakingServers.cpp b/src/steam/interfaces/SteamMatchmakingServers.cpp new file mode 100644 index 0000000..0445566 --- /dev/null +++ b/src/steam/interfaces/SteamMatchmakingServers.cpp @@ -0,0 +1,84 @@ +#include + +namespace steam +{ + void* matchmaking_servers::RequestInternetServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* matchmaking_servers::RequestLANServerList(unsigned int iApp, void *pRequestServersResponse) + { + return nullptr; + } + + void* matchmaking_servers::RequestFriendsServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* matchmaking_servers::RequestFavoritesServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* matchmaking_servers::RequestHistoryServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* matchmaking_servers::RequestSpectatorServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void matchmaking_servers::ReleaseRequest(void* hServerListRequest) + { + } + + void *matchmaking_servers::GetServerDetails(void* hRequest, int iServer) + { + return nullptr; + } + + void matchmaking_servers::CancelQuery(void* hRequest) + { + } + + void matchmaking_servers::RefreshQuery(void* hRequest) + { + } + + bool matchmaking_servers::IsRefreshing(void* hRequest) + { + return false; + } + + int matchmaking_servers::GetServerCount(void* hRequest) + { + return 0; + } + + void matchmaking_servers::RefreshServer(void* hRequest, int iServer) + { + } + + int matchmaking_servers::PingServer(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + { + return 0; + } + + int matchmaking_servers::PlayerDetails(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + { + return 0; + } + + int matchmaking_servers::ServerRules(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + { + return 0; + } + + void matchmaking_servers::CancelServerQuery(int hServerQuery) + { + } +} diff --git a/src/steam/interfaces/SteamMatchmakingServers.hpp b/src/steam/interfaces/SteamMatchmakingServers.hpp new file mode 100644 index 0000000..453fcdb --- /dev/null +++ b/src/steam/interfaces/SteamMatchmakingServers.hpp @@ -0,0 +1,26 @@ +#pragma once + +namespace steam +{ + class matchmaking_servers final + { + public: + virtual void* RequestInternetServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); + virtual void* RequestLANServerList(unsigned int iApp, void *pRequestServersResponse); + virtual void* RequestFriendsServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); + virtual void* RequestFavoritesServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); + virtual void* RequestHistoryServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); + virtual void* RequestSpectatorServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); + virtual void ReleaseRequest(void* hServerListRequest); + virtual void *GetServerDetails(void* hRequest, int iServer); + virtual void CancelQuery(void* hRequest); + virtual void RefreshQuery(void* hRequest); + virtual bool IsRefreshing(void* hRequest); + virtual int GetServerCount(void* hRequest); + virtual void RefreshServer(void* hRequest, int iServer); + virtual int PingServer(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse); + virtual int PlayerDetails(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse); + virtual int ServerRules(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse); + virtual void CancelServerQuery(int hServerQuery); + }; +} diff --git a/src/steam/interfaces/SteamNetworking.cpp b/src/steam/interfaces/SteamNetworking.cpp new file mode 100644 index 0000000..c1c43ed --- /dev/null +++ b/src/steam/interfaces/SteamNetworking.cpp @@ -0,0 +1,114 @@ +#include + +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; + } +} diff --git a/src/steam/interfaces/SteamNetworking.hpp b/src/steam/interfaces/SteamNetworking.hpp new file mode 100644 index 0000000..613fa6e --- /dev/null +++ b/src/steam/interfaces/SteamNetworking.hpp @@ -0,0 +1,31 @@ +#pragma once + +namespace steam +{ + class networking final + { + public: + 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); + }; +} diff --git a/src/steam/interfaces/SteamRemoteStorage.cpp b/src/steam/interfaces/SteamRemoteStorage.cpp new file mode 100644 index 0000000..c2f5602 --- /dev/null +++ b/src/steam/interfaces/SteamRemoteStorage.cpp @@ -0,0 +1,43 @@ +#include + +namespace steam +{ + bool remote_storage::FileWrite(const char *pchFile, const void *pvData, int cubData) + { + return true; + } + + int remote_storage::GetFileSize(const char *pchFile) + { + return 0; + } + + int remote_storage::FileRead(const char *pchFile, void *pvData, int cubDataToRead) + { + OutputDebugStringA(pchFile); + return 0; + } + + bool remote_storage::FileExists(const char *pchFile) + { + return false; + } + + 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; + } +} diff --git a/src/steam/interfaces/SteamRemoteStorage.hpp b/src/steam/interfaces/SteamRemoteStorage.hpp new file mode 100644 index 0000000..06a553c --- /dev/null +++ b/src/steam/interfaces/SteamRemoteStorage.hpp @@ -0,0 +1,16 @@ +#pragma once + +namespace steam +{ + class remote_storage final + { + public: + virtual bool FileWrite(const char *pchFile, const void *pvData, int cubData); + virtual int GetFileSize(const char *pchFile); + virtual int FileRead(const char *pchFile, void *pvData, int cubDataToRead); + virtual bool FileExists(const char *pchFile); + virtual int GetFileCount(); + virtual const char *GetFileNameAndSize(int iFile, int *pnFileSizeInBytes); + virtual bool GetQuota(int *pnTotalBytes, int *puAvailableBytes); + }; +} diff --git a/src/steam/interfaces/SteamUser.cpp b/src/steam/interfaces/SteamUser.cpp new file mode 100644 index 0000000..4ab8c6c --- /dev/null +++ b/src/steam/interfaces/SteamUser.cpp @@ -0,0 +1,121 @@ +#include + +namespace steam +{ + int user::GetHSteamUser() + { + return NULL; + } + + bool user::LoggedOn() + { + return true; + } + + steam_id user::GetSteamID() + { + steam_id id; + id.bits = 0x110000100000000 | (0x1377 & ~0x80000000); + 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) + { + return 0; + } + + 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 __int64 user::RequestEncryptedAppTicket(void *pUserData, int cbUserData) + { + // Generate the authentication ticket + //Components::DemonWare::GenerateAuthTicket(std::string(reinterpret_cast(pUserData), cbUserData)); + + // Create the call response + const auto result = callbacks::register_call(); + auto retvals = static_cast(calloc(1, sizeof(encrypted_app_ticket_response)));//::Utils::Memory::AllocateArray(); + 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) return false; + return false;//Components::DemonWare::GetAuthTicket(pTicket, static_cast(cbMaxTicket), pcbTicket); + } +} diff --git a/src/steam/interfaces/SteamUser.hpp b/src/steam/interfaces/SteamUser.hpp new file mode 100644 index 0000000..7e1a5bd --- /dev/null +++ b/src/steam/interfaces/SteamUser.hpp @@ -0,0 +1,39 @@ +#pragma once + +namespace steam +{ + struct encrypted_app_ticket_response final + { + enum { callback_id = 154 }; + + int m_e_result; + }; + + class user final + { + public: + 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 __int64 RequestEncryptedAppTicket(void *pUserData, int cbUserData); + virtual bool GetEncryptedAppTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket); + }; +} diff --git a/src/steam/interfaces/SteamUserStats.cpp b/src/steam/interfaces/SteamUserStats.cpp new file mode 100644 index 0000000..8a2c2c5 --- /dev/null +++ b/src/steam/interfaces/SteamUserStats.cpp @@ -0,0 +1,209 @@ +#include + +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 false; + } + + bool user_stats::SetAchievement(const char *pchName) + { + return false; + } + + bool user_stats::ClearAchievement(const char *pchName) + { + return false; + } + + bool user_stats::GetAchievementAndUnlockTime(const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime) + { + return false; + } + + bool user_stats::StoreStats() + { + return false; + } + + 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 false; + } + + unsigned __int64 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 false; + } + + bool user_stats::GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime) + { + return false; + } + + bool user_stats::ResetAllStats(bool bAchievementsToo) + { + return false; + } + + unsigned __int64 user_stats::FindOrCreateLeaderboard(const char *pchLeaderboardName, int eLeaderboardSortMethod, int eLeaderboardDisplayType) + { + return 0; + } + + unsigned __int64 user_stats::FindLeaderboard(const char *pchLeaderboardName) + { + return 0; + } + + const char *user_stats::GetLeaderboardName(unsigned __int64 hSteamLeaderboard) + { + return ""; + } + + int user_stats::GetLeaderboardEntryCount(unsigned __int64 hSteamLeaderboard) + { + return 0; + } + + int user_stats::GetLeaderboardSortMethod(unsigned __int64 hSteamLeaderboard) + { + return 0; + } + + int user_stats::GetLeaderboardDisplayType(unsigned __int64 hSteamLeaderboard) + { + return 0; + } + + unsigned __int64 user_stats::DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, int eLeaderboardDataRequest, int nRangeStart, int nRangeEnd) + { + return 0; + } + + unsigned __int64 user_stats::DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, steam_id *prgUsers, int cUsers) + { + return 0; + } + + bool user_stats::GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, int *pLeaderboardEntry, int *pDetails, int cDetailsMax) + { + return false; + } + + unsigned __int64 user_stats::UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, int eLeaderboardUploadScoreMethod, int nScore, const int *pScoreDetails, int cScoreDetailsCount) + { + return 0; + } + + unsigned __int64 user_stats::AttachLeaderboardUGC(unsigned __int64 hSteamLeaderboard, unsigned __int64 hUGC) + { + return 0; + } + + unsigned __int64 user_stats::GetNumberOfCurrentPlayers() + { + return 0; + } + + unsigned __int64 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 false; + } + + unsigned __int64 user_stats::RequestGlobalStats(int nHistoryDays) + { + return 0; + } + + bool user_stats::GetGlobalStat(const char *pchStatName, __int64 *pData) + { + return false; + } + + bool user_stats::GetGlobalStat(const char *pchStatName, double *pData) + { + return false; + } + + int user_stats::GetGlobalStatHistory(const char *pchStatName, __int64 *pData, unsigned int cubData) + { + return 0; + } + + int user_stats::GetGlobalStatHistory(const char *pchStatName, double *pData, unsigned int cubData) + { + return 0; + } +} diff --git a/src/steam/interfaces/SteamUserStats.hpp b/src/steam/interfaces/SteamUserStats.hpp new file mode 100644 index 0000000..ebe67f3 --- /dev/null +++ b/src/steam/interfaces/SteamUserStats.hpp @@ -0,0 +1,50 @@ +#pragma once + +namespace steam +{ + class user_stats final + { + public: + 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 __int64 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 __int64 FindOrCreateLeaderboard(const char *pchLeaderboardName, int eLeaderboardSortMethod, int eLeaderboardDisplayType); + virtual unsigned __int64 FindLeaderboard(const char *pchLeaderboardName); + virtual const char *GetLeaderboardName(unsigned __int64 hSteamLeaderboard); + virtual int GetLeaderboardEntryCount(unsigned __int64 hSteamLeaderboard); + virtual int GetLeaderboardSortMethod(unsigned __int64 hSteamLeaderboard); + virtual int GetLeaderboardDisplayType(unsigned __int64 hSteamLeaderboard); + virtual unsigned __int64 DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, int eLeaderboardDataRequest, int nRangeStart, int nRangeEnd); + virtual unsigned __int64 DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, steam_id *prgUsers, int cUsers); + virtual bool GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, int *pLeaderboardEntry, int *pDetails, int cDetailsMax); + virtual unsigned __int64 UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, int eLeaderboardUploadScoreMethod, int nScore, const int *pScoreDetails, int cScoreDetailsCount); + virtual unsigned __int64 AttachLeaderboardUGC(unsigned __int64 hSteamLeaderboard, unsigned __int64 hUGC); + virtual unsigned __int64 GetNumberOfCurrentPlayers(); + virtual unsigned __int64 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 __int64 RequestGlobalStats(int nHistoryDays); + virtual bool GetGlobalStat(const char *pchStatName, __int64 *pData); + virtual bool GetGlobalStat(const char *pchStatName, double *pData); + virtual int GetGlobalStatHistory(const char *pchStatName, __int64 *pData, unsigned int cubData); + virtual int GetGlobalStatHistory(const char *pchStatName, double *pData, unsigned int cubData); + }; +} diff --git a/src/steam/interfaces/SteamUtils.cpp b/src/steam/interfaces/SteamUtils.cpp new file mode 100644 index 0000000..c879065 --- /dev/null +++ b/src/steam/interfaces/SteamUtils.cpp @@ -0,0 +1,110 @@ +#include + +namespace steam +{ + unsigned int utils::GetSecondsSinceAppActive() + { + return 0; + } + + unsigned int utils::GetSecondsSinceComputerActive() + { + return 0; + } + + int utils::GetConnectedUniverse() + { + return 1; + } + + unsigned int utils::GetServerRealTime() + { + return 0; + } + + 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 42690; + } + + void utils::SetOverlayNotificationPosition(int eNotificationPosition) + { + if (steam::overlay) + { + const auto set_position = GetProcAddress(steam::overlay, "SetNotificationPosition"); + + if (set_position) + { + reinterpret_cast(set_position)(eNotificationPosition); + } + } + } + + bool utils::IsAPICallCompleted(unsigned __int64 hSteamAPICall, bool *pbFailed) + { + return false; + } + + int utils::GetAPICallFailureReason(unsigned __int64 hSteamAPICall) + { + return -1; + } + + bool utils::GetAPICallResult(unsigned __int64 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 __int64 utils::CheckFileSignature(const char *szFileName) + { + return 0; + } +} diff --git a/src/steam/interfaces/SteamUtils.hpp b/src/steam/interfaces/SteamUtils.hpp new file mode 100644 index 0000000..d40ce68 --- /dev/null +++ b/src/steam/interfaces/SteamUtils.hpp @@ -0,0 +1,29 @@ +#pragma once + +namespace steam +{ + class utils final + { + public: + 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 __int64 hSteamAPICall, bool *pbFailed); + virtual int GetAPICallFailureReason(unsigned __int64 hSteamAPICall); + virtual bool GetAPICallResult(unsigned __int64 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 __int64 CheckFileSignature(const char *szFileName); + }; +} diff --git a/src/steam/steam.cpp b/src/steam/steam.cpp new file mode 100644 index 0000000..e058797 --- /dev/null +++ b/src/steam/steam.cpp @@ -0,0 +1,218 @@ +#include + +namespace steam +{ + HMODULE overlay = nullptr; + + uint64_t callbacks::call_id_ = 0; + std::recursive_mutex callbacks::mutex_; + std::map callbacks::calls_; + std::map callbacks::result_handlers_; + std::vector callbacks::results_; + std::vector callbacks::callback_list_; + + uint64_t callbacks::register_call() + { + std::lock_guard _(callbacks::mutex_); + callbacks::calls_[++callbacks::call_id_] = false; + return callbacks::call_id_; + } + + void callbacks::register_callback(callbacks::base* handler, const int callback) + { + std::lock_guard _(callbacks::mutex_); + handler->set_i_callback(callback); + callbacks::callback_list_.push_back(handler); + } + + void callbacks::register_call_result(const uint64_t call, callbacks::base* result) + { + std::lock_guard _(callbacks::mutex_); + callbacks::result_handlers_[call] = result; + } + + void callbacks::return_call(void* data, const int size, const int type, const uint64_t call) + { + std::lock_guard _(callbacks::mutex_); + + callbacks::result result; + + result.call = call; + result.data = data; + result.size = size; + result.type = type; + + callbacks::calls_[call] = true; + + callbacks::results_.push_back(result); + } + + void callbacks::run_callbacks() + { + std::lock_guard _(callbacks::mutex_); + + for (auto result : callbacks::results_) + { + if (callbacks::result_handlers_.find(result.call) != callbacks::result_handlers_.end()) + { + callbacks::result_handlers_[result.call]->run(result.data, false, result.call); + } + + for (auto callback : callbacks::callback_list_) + { + if (callback && callback->get_i_callback() == result.type) + { + callback->run(result.data, false, 0); + } + } + + if (result.data) + { + free(result.data); + } + } + + callbacks::results_.clear(); + } + + extern "C" + { + bool SteamAPI_RestartAppIfNecessary() + { + return false; + } + + bool SteamAPI_Init() + { + overlay = GetModuleHandleA("gameoverlayrenderer.dll"); + + if (!overlay) + { + HKEY reg_key; + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS) + { + char steam_path[MAX_PATH] = { 0 }; + DWORD length = sizeof(steam_path); + RegQueryValueExA(reg_key, "InstallPath", nullptr, nullptr, reinterpret_cast(steam_path), &length); + RegCloseKey(reg_key); + + SetDllDirectoryA(steam_path); + + strcat_s(steam_path, "gameoverlayrenderer.dll"); + + overlay = LoadLibraryA(steam_path); + } + } + + return true; + } + + void SteamAPI_RegisterCallResult(callbacks::base* result, uint64_t call) + { + callbacks::register_call_result(call, result); + } + + void SteamAPI_RegisterCallback(callbacks::base* handler, int callback) + { + callbacks::register_callback(handler, callback); + } + + void SteamAPI_RunCallbacks() + { + callbacks::run_callbacks(); + } + + void SteamAPI_Shutdown() + { + } + + void SteamAPI_UnregisterCallResult() + { + } + + void SteamAPI_UnregisterCallback() + { + } + + + bool SteamGameServer_Init() + { + return true; + } + + void SteamGameServer_RunCallbacks() + { + } + + void SteamGameServer_Shutdown() + { + } + + + steam::friends* SteamFriends() + { + static steam::friends friends; + return &friends; + } + + steam::matchmaking* SteamMatchmaking() + { + static steam::matchmaking matchmaking; + return &matchmaking; + } + + steam::matchmaking_servers* SteamMatchmakingServers() + { + static steam::matchmaking_servers matchmaking_servers; + return &matchmaking_servers; + } + + steam::game_server* SteamGameServer() + { + static steam::game_server game_server; + return &game_server; + } + + steam::master_server_updater* SteamMasterServerUpdater() + { + static steam::master_server_updater master_server_updater; + return &master_server_updater; + } + + steam::networking* SteamNetworking() + { + static steam::networking networking; + return &networking; + } + + steam::remote_storage* SteamRemoteStorage() + { + static steam::remote_storage remote_storage; + return &remote_storage; + } + + steam::user* SteamUser() + { + static steam::user user; + return &user; + } + + steam::utils* SteamUtils() + { + static steam::utils utils; + return &utils; + } + + steam::apps* SteamApps() + { + static steam::apps apps; + return &apps; + } + + steam::user_stats* SteamUserStats() + { + static steam::user_stats user_stats; + return &user_stats; + } + } +} diff --git a/src/steam/steam.hpp b/src/steam/steam.hpp new file mode 100644 index 0000000..e1730bc --- /dev/null +++ b/src/steam/steam.hpp @@ -0,0 +1,102 @@ +#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; + +#include "interfaces/SteamApps.hpp" +#include "interfaces/SteamUser.hpp" +#include "interfaces/SteamUtils.hpp" +#include "interfaces/SteamFriends.hpp" +#include "interfaces/SteamUserStats.hpp" +#include "interfaces/SteamGameServer.hpp" +#include "interfaces/SteamNetworking.hpp" +#include "interfaces/SteamMatchmaking.hpp" +#include "interfaces/SteamRemoteStorage.hpp" +#include "interfaces/SteamMatchmakingServers.hpp" +#include "interfaces/SteamMasterServerUpdater.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: + 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 register_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 calls_; + static std::map result_handlers_; + static std::vector results_; + static std::vector 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(); + STEAM_EXPORT void SteamAPI_UnregisterCallback(); + + STEAM_EXPORT bool SteamGameServer_Init(); + STEAM_EXPORT void SteamGameServer_RunCallbacks(); + STEAM_EXPORT void SteamGameServer_Shutdown(); + + STEAM_EXPORT steam::friends* SteamFriends(); + STEAM_EXPORT steam::matchmaking* SteamMatchmaking(); + STEAM_EXPORT steam::matchmaking_servers* SteamMatchmakingServers(); + STEAM_EXPORT steam::game_server* SteamGameServer(); + STEAM_EXPORT steam::master_server_updater* SteamMasterServerUpdater(); + STEAM_EXPORT steam::networking* SteamNetworking(); + STEAM_EXPORT steam::remote_storage* SteamRemoteStorage(); + STEAM_EXPORT steam::user* SteamUser(); + STEAM_EXPORT steam::utils* SteamUtils(); + STEAM_EXPORT steam::apps* SteamApps(); + STEAM_EXPORT steam::user_stats* SteamUserStats(); + + extern HMODULE overlay; +}