[Proxy] Enable In-Mod text

This commit is contained in:
momo5502 2017-02-17 03:27:38 +01:00
parent 7040c51fa1
commit b87a038008
8 changed files with 198 additions and 636 deletions

View File

@ -75,21 +75,21 @@ namespace Components
entry->online = Steam::Proxy::SteamFriends->GetFriendPersonaState(user) != 0;
entry->cleanName = Utils::String::ToLower(Colors::Strip(entry->name));
std::string guid = Steam::Proxy::SteamFriends->GetFriendRichPresence(user, "iw4x_guid");
std::string name = Steam::Proxy::SteamFriends->GetFriendRichPresence(user, "iw4x_name");
std::string experience = Steam::Proxy::SteamFriends->GetFriendRichPresence(user, "iw4x_experience");
std::string prestige = Steam::Proxy::SteamFriends->GetFriendRichPresence(user, "iw4x_prestige");
std::string guid = Friends::GetPresence(user, "iw4x_guid");
std::string name = Friends::GetPresence(user, "iw4x_name");
std::string experience = Friends::GetPresence(user, "iw4x_experience");
std::string prestige = Friends::GetPresence(user, "iw4x_prestige");
if (!guid.empty()) entry->guid.Bits = strtoull(guid.data(), nullptr, 16);
if (!name.empty()) entry->playerName = name;
if (!experience.empty()) entry->experience = atoi(experience.data());
if (!prestige.empty()) entry->prestige = atoi(prestige.data());
std::string server = Steam::Proxy::SteamFriends->GetFriendRichPresence(user, "iw4x_server");
std::string server = Friends::GetPresence(user, "iw4x_server");
Network::Address oldAddress = entry->server;
bool gotOnline = Friends::IsOnline(entry->lastTime);
entry->lastTime = static_cast<unsigned int>(atoi(Steam::Proxy::SteamFriends->GetFriendRichPresence(user, "iw4x_playing")));
entry->lastTime = static_cast<unsigned int>(atoi(Friends::GetPresence(user, "iw4x_playing").data()));
gotOnline = !gotOnline && Friends::IsOnline(entry->lastTime);
if (server.empty())
@ -174,6 +174,24 @@ namespace Components
}
}
void Friends::RequestPresence(SteamID user)
{
if(Steam::Proxy::ClientFriends)
{
Steam::Proxy::ClientFriends.invoke<void>("RequestFriendRichPresence", 0, user);
Steam::Proxy::ClientFriends.invoke<void>("RequestFriendRichPresence", Steam::Proxy::AppId, user);
}
}
std::string Friends::GetPresence(SteamID user, std::string key)
{
if (!Steam::Proxy::ClientFriends) return "";
std::string result = Steam::Proxy::ClientFriends.invoke<const char*>("GetFriendRichPresence", Steam::Proxy::AppId, user, key.data());
if (result.empty()) result = Steam::Proxy::ClientFriends.invoke<const char*>("GetFriendRichPresence", 0, user, key.data());
return result;
}
void Friends::SetServer()
{
Friends::SetPresence("iw4x_server", Network::Address(*Game::connectedHost).getString()); // reinterpret_cast<char*>(0x7ED3F8)
@ -291,7 +309,7 @@ namespace Components
++i;
Friends::UpdateUserInfo(id);
Steam::Proxy::SteamFriends->RequestFriendRichPresence(id);
Friends::RequestPresence(id);
}
}
}
@ -386,15 +404,15 @@ namespace Components
void Friends::AddFriend(SteamID user)
{
if(Steam::Proxy::ClientFriends)
if(Steam::Proxy::ClientFriends && Steam::Proxy::SteamFriends)
{
if(Steam::Proxy::ClientFriends->AddFriend(user))
if(Steam::Proxy::ClientFriends.invoke<bool>("AddFriend", user))
{
Toast::Show("cardicon_weed", Steam::Proxy::ClientFriends->GetFriendPersonaName(user), "friend request sent", 3000);
Toast::Show("cardicon_weed", Steam::Proxy::SteamFriends->GetFriendPersonaName(user), "friend request sent", 3000);
}
else
{
Toast::Show("cardicon_stop", Steam::Proxy::ClientFriends->GetFriendPersonaName(user), "unable to send friend request", 3000);
Toast::Show("cardicon_stop", Steam::Proxy::SteamFriends->GetFriendPersonaName(user), "unable to send friend request", 3000);
}
}
}
@ -464,7 +482,7 @@ namespace Components
Steam::Proxy::RegisterCallback(304, [](void* data)
{
Friends::PersonaStateChange* state = static_cast<Friends::PersonaStateChange*>(data);
if (Steam::Proxy::SteamFriends) Steam::Proxy::SteamFriends->RequestFriendRichPresence(state->m_ulSteamID);
Friends::RequestPresence(state->m_ulSteamID);
});
// Update state when connecting/disconnecting

View File

@ -20,6 +20,9 @@ namespace Components
static void SetPresence(std::string key, std::string value);
static void ClearPresence(std::string key);
static void RequestPresence(SteamID user);
static std::string GetPresence(SteamID user, std::string key);
static void AddFriend(SteamID user);
private:

View File

@ -50,6 +50,8 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
Steam::Proxy::RunMod();
// Ensure we're working with our desired binary
if (Utils::Hook::Get<DWORD>(0x4C0FFF) != 0x6824748B)
{

View File

@ -121,373 +121,4 @@ namespace Steam
virtual void SetPersonaState(int ePersonaState) = 0;
// [...]
};
class IClientFriends
{
public:
// returns the local players name - guaranteed to not be NULL.
virtual const char *GetPersonaName() = 0;
// sets the player name, stores it on the server and publishes the changes to all friends who are online
virtual void SetPersonaName(const char *pchPersonaName) = 0;
virtual uint64_t SetPersonaNameEx(const char *pchPersonaName, bool bSendCallback) = 0;
virtual bool IsPersonaNameSet() = 0;
// gets the friend status of the current user
virtual int GetPersonaState() = 0;
// sets the status, communicates to server, tells all friends
virtual void SetPersonaState(int ePersonaState) = 0;
virtual bool NotifyUIOfMenuChange(bool bShowAvatars, bool bSortByName, bool bShowOnlineOnly, bool bShowUntaggedFriends) = 0;
// friend iteration
virtual int32_t GetFriendCount(int iFriendFlags) = 0;
virtual uint32_t GetFriendArray(SteamID *, int8_t *, int32_t, int32_t) = 0;
virtual uint32_t GetFriendArrayInGame(SteamID *, int8_t *, int32_t) = 0;
virtual SteamID GetFriendByIndex(int32_t iFriend, int iFriendFlags) = 0;
virtual int32_t GetOnlineFriendCount() = 0;
// gets the relationship to a user
virtual int GetFriendRelationship(SteamID steamIDFriend) = 0;
virtual int GetFriendPersonaState(SteamID steamIDFriend) = 0;
// returns the name of a friend - guaranteed to not be NULL.
virtual const char *GetFriendPersonaName(SteamID steamIDFriend) = 0;
// gets the avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
virtual int32_t GetSmallFriendAvatar(SteamID steamIDFriend) = 0;
virtual int32_t GetMediumFriendAvatar(SteamID steamIDFriend) = 0;
virtual int32_t GetLargeFriendAvatar(SteamID steamIDFriend) = 0;
virtual int32_t BGetFriendAvatarURL(void *, size_t, int, int, int) = 0;
// steam registry, accessed by friend
virtual void SetFriendRegValue(SteamID steamIDFriend, const char *pchKey, const char *pchValue) = 0;
virtual const char *GetFriendRegValue(SteamID steamIDFriend, const char *pchKey) = 0;
virtual bool DeleteFriendRegValue(SteamID steamID, const char *pchKey) = 0;
virtual bool GetFriendGamePlayed(SteamID steamID, void *pGamePlayInfo) = 0;
virtual const char *GetFriendGamePlayedExtraInfo(SteamID steamIDFriend) = 0;
virtual SteamID GetFriendGameServer(SteamID steamIDFriend) = 0;
virtual int GetFriendPersonaStateFlags(SteamID steamIDFriend) = 0;
virtual bool IsFriendGameOnConsole(SteamID steamIDFriend) = 0;
virtual FriendSessionStateInfo_t GetFriendSessionStateInfo(SteamID steamIDFriend) = 0;
virtual int GetFriendRestrictions(SteamID steamIDFriend) = 0;
// accesses old friends names - returns an empty string when their are no more items in the history
virtual const char *GetFriendPersonaNameHistory(SteamID steamIDFriend, int32_t iPersonaName) = 0;
//virtual uint32_t GetFriendSteamLevel(SteamID steamIDFriend) = 0;
virtual uint64_t RequestPersonaNameHistory(SteamID steamIDFriend) = 0;
virtual const char * GetFriendPersonaNameHistoryAndDate(SteamID steamIDFriend, int32_t iPersonaName, int * puTime) = 0;
virtual bool AddFriend(SteamID steamID) = 0;
virtual bool RemoveFriend(SteamID steamID) = 0;
virtual bool HasFriend(SteamID steamID, int iFriendFlags) = 0;
// adds a friend by email address or account name - value returned in callback
virtual int AddFriendByName(const char *pchEmailOrAccountName) = 0;
virtual bool InviteFriendByEmail(const char *pchEmailAddress) = 0;
virtual bool RequestUserInformation(SteamID steamIDUser, bool bRequireNameOnly) = 0;
virtual bool SetIgnoreFriend(SteamID steamIDFriend, bool bIgnore) = 0;
virtual bool ReportChatDeclined(SteamID steamID) = 0;
virtual bool CreateFriendsGroup(const char* pchGroupName) = 0;
virtual bool DeleteFriendsGroup(int16_t iGroupID) = 0;
virtual bool RenameFriendsGroup(const char* pchNewGroupName, int16_t iGroupID) = 0;
virtual bool AddFriendToGroup(SteamID steamID, int16_t iGroupID) = 0;
virtual bool RemoveFriendFromGroup(SteamID steamID, int16_t iGroupID) = 0;
virtual bool IsFriendMemberOfFriendsGroup(SteamID steamID, int16_t iGroupID) = 0;
virtual int16_t GetFriendsGroupCount() = 0;
virtual int16_t GetFriendsGroupIDByIndex(int16_t iGroupIndex) = 0;
virtual const char * GetFriendsGroupName(int16_t iGroupID) = 0;
virtual int16_t GetFriendsGroupMembershipCount(int16_t iGroupID) = 0;
virtual SteamID GetFirstFriendsGroupMember(int16_t iGroupID) = 0;
virtual SteamID GetNextFriendsGroupMember(int16_t iGroupID) = 0;
virtual int16_t GetGroupFriendsMembershipCount(SteamID steamID) = 0;
virtual int16_t GetFirstGroupFriendsMember(SteamID steamID) = 0;
virtual int16_t GetNextGroupFriendsMember(SteamID steamID) = 0;
virtual const char * GetPlayerNickname(SteamID playerSteamID) = 0;
virtual bool SetPlayerNickname(SteamID playerSteamID, const char *cszNickname) = 0;
virtual uint32_t GetFriendsSteamLevel(SteamID steamIDFriend) = 0;
virtual int32_t GetChatMessagesCount(SteamID steamIDFriend) = 0;
// chat message iteration
// returns the number of bytes in the message, filling pvData with as many of those bytes as possible
// returns 0 if the steamID or iChatID are invalid
virtual int32_t GetChatMessage(SteamID steamIDFriend, int32_t iChatID, void *pvData, int32_t cubData, int *peChatEntryType, SteamID* pSteamIDChatter, int *puTime) = 0;
// generic friend->friend message sending, takes a sized buffer
virtual bool SendMsgToFriend(SteamID steamIDFriend, int eChatEntryType, const void *pvMsgBody, int32_t cubMsgBody) = 0;
// clears the chat history - should be called when a chat dialog closes
virtual void ClearChatHistory(SteamID steamIDFriend) = 0;
virtual int32_t GetKnownClanCount() = 0;
virtual SteamID GetKnownClanByIndex(int32_t iClan) = 0;
virtual int32_t GetClanCount() = 0;
virtual SteamID GetClanByIndex(int32_t iClan) = 0;
virtual const char *GetClanName(SteamID steamIDClan) = 0;
virtual const char *GetClanTag(SteamID steamIDClan) = 0;
virtual bool GetFriendActivityCounts(int32_t *pnOnline, int32_t *pnInGame, bool bExcludeTaggedFriends) = 0;
virtual bool GetClanActivityCounts(SteamID steamID, int32_t *pnOnline, int32_t *pnInGame, int32_t *pnChatting) = 0;
virtual uint64_t DownloadClanActivityCounts(SteamID groupIDs[], int32_t nIds) = 0;
virtual bool GetFriendsGroupActivityCounts(int16_t iGroupID, int32_t *pnOnline, int32_t *pnInGame) = 0;
virtual bool IsClanPublic(SteamID steamID) = 0;
virtual uint64_t JoinClanChatRoom(SteamID groupID) = 0;
virtual bool LeaveClanChatRoom(SteamID groupID) = 0;
virtual int32_t GetClanChatMemberCount(SteamID groupID) = 0;
virtual SteamID GetChatMemberByIndex(SteamID groupID, int32_t iIndex) = 0;
virtual bool SendClanChatMessage(SteamID groupID, const char *cszMessage) = 0;
virtual int32_t GetClanChatMessage(SteamID groupID, int32_t iChatID, void *pvData, int32_t cubData, int *peChatEntryType, SteamID *pSteamIDChatter) = 0;
virtual bool IsClanChatAdmin(SteamID groupID, SteamID userID) = 0;
virtual bool IsClanChatWindowOpenInSteam(SteamID groupID) = 0;
virtual bool OpenClanChatWindowInSteam(SteamID groupID) = 0;
virtual bool CloseClanChatWindowInSteam(SteamID groupID) = 0;
virtual bool SetListenForFriendsMessages(bool bListen) = 0;
virtual bool ReplyToFriendMessage(SteamID friendID, const char *cszMessage) = 0;
virtual int32_t GetFriendMessage(SteamID friendID, int32_t iChatID, void *pvData, int32_t cubData, int *peChatEntryType) = 0;
virtual bool InviteFriendToClan(SteamID steamIDfriend, SteamID steamIDclan) = 0;
virtual bool AcknowledgeInviteToClan(SteamID steamID, bool bAcceptOrDenyClanInvite) = 0;
// iterators for any source
virtual int32_t GetFriendCountFromSource(SteamID steamIDSource) = 0;
virtual SteamID GetFriendFromSourceByIndex(SteamID steamIDSource, int32_t iFriend) = 0;
virtual bool IsUserInSource(SteamID steamIDUser, SteamID steamIDSource) = 0;
virtual int32_t GetCoplayFriendCount() = 0;
virtual SteamID GetCoplayFriend(int32_t iCoplayEvent) = 0;
virtual int GetFriendCoplayTime(SteamID steamIDFriend) = 0;
virtual int GetFriendCoplayGame(SteamID steamIDFriend) = 0;
virtual bool SetRichPresence(int nAppId, const char *pchKey, const char *pchValue) = 0;
virtual void ClearRichPresence(int nAppId) = 0;
virtual const char* GetFriendRichPresence(int nAppId, SteamID steamIDFriend, const char *pchKey) = 0;
virtual int32_t GetFriendRichPresenceKeyCount(int nAppId, SteamID steamIDFriend) = 0;
virtual const char* GetFriendRichPresenceKeyByIndex(int nAppId, SteamID steamIDFriend, int32_t iIndex) = 0;
virtual void RequestFriendRichPresence(int nAppId, SteamID steamIDFriend) = 0;
virtual bool JoinChatRoom(SteamID steamIDChat) = 0;
virtual void LeaveChatRoom(SteamID steamIDChat) = 0;
virtual bool InviteUserToChatRoom(SteamID steamIDChat, SteamID steamIDInvitee) = 0;
virtual bool SendChatMsg(SteamID steamIDChat, int eChatEntryType, const void *pvMsgBody, int32_t cubMsgBody) = 0;
virtual int32_t GetChatRoomMessagesCount(SteamID steamIDChat) = 0;
virtual int32_t GetChatRoomEntry(SteamID steamIDChat, int32_t iChatID, SteamID *steamIDuser, void *pvData, int32_t cubData, int *peChatEntryType) = 0;
virtual void ClearChatRoomHistory(SteamID steamID) = 0;
virtual bool SerializeChatRoomDlg(SteamID steamIDChat, void const* pvHistory, int32_t cubHistory) = 0;
virtual int32_t GetSizeOfSerializedChatRoomDlg(SteamID steamIDChat) = 0;
virtual bool GetSerializedChatRoomDlg(SteamID steamIDChat, void* pvHistory, int32_t cubBuffer, int32_t* pcubData) = 0;
virtual bool ClearSerializedChatRoomDlg(SteamID steamIDChat) = 0;
virtual bool KickChatMember(SteamID steamIDChat, SteamID steamIDUserToActOn) = 0;
virtual bool BanChatMember(SteamID steamIDChat, SteamID steamIDUserToActOn) = 0;
virtual bool UnBanChatMember(SteamID steamIDChat, SteamID steamIDUserToActOn) = 0;
virtual bool SetChatRoomType(SteamID steamIDChat, int eLobbyType) = 0;
virtual bool GetChatRoomLockState(SteamID steamIDChat, bool *pbLocked) = 0;
virtual bool GetChatRoomPermissions(SteamID steamIDChat, uint32_t *prgfChatRoomPermissions) = 0;
virtual bool SetChatRoomModerated(SteamID steamIDChat, bool bModerated) = 0;
virtual bool BChatRoomModerated(SteamID steamIDChat) = 0;
virtual bool NotifyChatRoomDlgsOfUIChange(SteamID steamIDChat, bool bShowAvatars, bool bBeepOnNewMsg, bool bShowSteamIDs, bool bShowTimestampOnNewMsg) = 0;
virtual bool TerminateChatRoom(SteamID steamIDChat) = 0;
virtual int32_t GetChatRoomCount() = 0;
virtual SteamID GetChatRoomByIndex(int32_t iChatRoom) = 0;
virtual const char *GetChatRoomName(SteamID steamIDChat) = 0;
virtual bool BGetChatRoomMemberDetails(SteamID steamIDChat, SteamID steamIDUser, uint32_t* prgfChatMemberDetails, uint32_t* prgfChatMemberDetailsLocal) = 0;
virtual void CreateChatRoom(int eType, uint64_t ulGameID, const char *pchName, int eLobbyType, SteamID steamIDClan, SteamID steamIDFriendChat, SteamID steamIDInvited, uint32_t rgfChatPermissionOfficer, uint32_t rgfChatPermissionMember, uint32_t rgfChatPermissionAll) = 0;
virtual void VoiceCallNew(SteamID steamIDLocalPeer, SteamID steamIDRemotePeer) = 0;
virtual void VoiceCall(SteamID steamIDLocalPeer, SteamID steamIDRemotePeer) = 0;
virtual void VoiceHangUp(SteamID steamIDLocalPeer, int hVoiceCall) = 0;
virtual void SetVoiceSpeakerVolume(float flVolume) = 0;
virtual void SetVoiceMicrophoneVolume(float flVolume) = 0;
virtual void SetAutoAnswer(bool bAutoAnswer) = 0;
virtual void VoiceAnswer(int hVoiceCall) = 0;
virtual void AcceptVoiceCall(SteamID steamIDLocalPeer, SteamID steamIDRemotePeer) = 0;
virtual void VoicePutOnHold(int hVoiceCall, bool bLocalHold) = 0;
virtual bool BVoiceIsLocalOnHold(int hVoiceCall) = 0;
virtual bool BVoiceIsRemoteOnHold(int hVoiceCall) = 0;
virtual void SetDoNotDisturb(bool bDoNotDisturb) = 0;
virtual void EnableVoiceNotificationSounds(bool bEnable) = 0;
virtual void SetPushToTalkEnabled(bool bEnable) = 0;
virtual bool IsPushToTalkEnabled() = 0;
virtual void SetPushToTalkKey(int32_t nVirtualKey) = 0;
virtual int32_t GetPushToTalkKey() = 0;
virtual bool IsPushToTalkKeyDown() = 0;
virtual void EnableVoiceCalibration(bool bState) = 0;
virtual bool IsVoiceCalibrating() = 0;
virtual float GetVoiceCalibrationSamplePeak() = 0;
virtual void SetMicBoost(bool bBoost) = 0;
virtual bool GetMicBoost() = 0;
virtual bool HasHardwareMicBoost() = 0;
virtual const char *GetMicDeviceName() = 0;
virtual void StartTalking(int hVoiceCall) = 0;
virtual void EndTalking(int hVoiceCall) = 0;
virtual bool VoiceIsValid(int hVoiceCall) = 0;
virtual void SetAutoReflectVoice(bool bState) = 0;
virtual int GetCallState(int hVoiceCall) = 0;
virtual float GetVoiceMicrophoneVolume() = 0;
virtual float GetVoiceSpeakerVolume() = 0;
virtual float TimeSinceLastVoiceDataReceived(int hVoiceCall) = 0;
virtual float TimeSinceLastVoiceDataSend(int hVoiceCall) = 0;
virtual bool BCanSend(int hVoiceCall) = 0;
virtual bool BCanReceive(int hVoiceCall) = 0;
virtual float GetEstimatedBitsPerSecond(int hVoiceCall, bool bIncoming) = 0;
virtual float GetPeakSample(int hVoiceCall, bool bIncoming) = 0;
virtual void SendResumeRequest(int hVoiceCall) = 0;
virtual void OpenChatDialog(SteamID steamID) = 0;
virtual void StartChatRoomVoiceSpeaking(SteamID steamIDChat, SteamID steamIDMember) = 0;
virtual void EndChatRoomVoiceSpeaking(SteamID steamIDChat, SteamID steamIDMember) = 0;
virtual int GetFriendLastLogonTime(SteamID steamIDFriend) = 0;
virtual int GetFriendLastLogoffTime(SteamID steamIDFriend) = 0;
virtual int32_t GetChatRoomVoiceTotalSlotCount(SteamID steamIDChat) = 0;
virtual int32_t GetChatRoomVoiceUsedSlotCount(SteamID steamIDChat) = 0;
virtual SteamID GetChatRoomVoiceUsedSlot(SteamID steamIDChat, int32_t iSlot) = 0;
virtual int GetChatRoomVoiceStatus(SteamID steamIDChat, SteamID steamIDSpeaker) = 0;
virtual bool BChatRoomHasAvailableVoiceSlots(SteamID steamIDChat) = 0;
virtual bool BIsChatRoomVoiceSpeaking(SteamID steamIDChat, SteamID steamIDSpeaker) = 0;
virtual float GetChatRoomPeakSample(SteamID steamIDChat, SteamID steamIDSpeaker, bool bIncoming) = 0;
virtual void ChatRoomVoiceRetryConnections(SteamID steamIDChat) = 0;
virtual void SetPortTypes(uint32_t unFlags) = 0;
virtual void ReinitAudio() = 0;
virtual void SetInGameVoiceSpeaking(SteamID steamIDUser, bool bSpeaking) = 0;
virtual bool IsInGameVoiceSpeaking() = 0;
virtual void ActivateGameOverlay(const char *pchDialog) = 0;
virtual void ActivateGameOverlayToUser(const char *pchDialog, SteamID steamID) = 0;
virtual void ActivateGameOverlayToWebPage(const char *pchURL) = 0;
virtual void ActivateGameOverlayToStore(int nAppId, int eFlag) = 0;
virtual void ActivateGameOverlayInviteDialog(SteamID steamIDLobby) = 0;
virtual void NotifyGameOverlayStateChanged(bool bActive) = 0;
virtual void NotifyGameServerChangeRequested(const char *pchServerAddress, const char *pchPassword) = 0;
virtual bool NotifyLobbyJoinRequested(int nAppId, SteamID steamIDLobby, SteamID steamIDFriend) = 0;
virtual bool NotifyRichPresenceJoinRequested(int nAppId, SteamID steamIDFriend, const char *pchConnectString) = 0;
virtual int GetClanRelationship(SteamID steamIDclan) = 0;
virtual int GetFriendClanRank(SteamID steamIDUser, SteamID steamIDClan) = 0;
virtual bool VoiceIsAvailable() = 0;
virtual void TestVoiceDisconnect(int hVoiceCall) = 0;
virtual void TestChatRoomPeerDisconnect(SteamID steamIDChat, SteamID steamIDSpeaker) = 0;
virtual void TestVoicePacketLoss(float flFractionOfIncomingPacketsToDrop) = 0;
virtual int FindFriendVoiceChatHandle(SteamID steamIDFriend) = 0;
virtual void RequestFriendsWhoPlayGame(int gameID) = 0;
virtual uint32_t GetCountFriendsWhoPlayGame(int gameID) = 0;
virtual SteamID GetFriendWhoPlaysGame(uint32_t iIndex, int gameID) = 0;
virtual void SetPlayedWith(SteamID steamIDUserPlayedWith) = 0;
virtual uint64_t RequestClanOfficerList(SteamID steamIDClan) = 0;
virtual SteamID GetClanOwner(SteamID steamIDClan) = 0;
virtual int32_t GetClanOfficerCount(SteamID steamIDClan) = 0;
virtual SteamID GetClanOfficerByIndex(SteamID steamIDClan, int32_t iOfficer) = 0;
virtual int GetUserRestrictions() = 0;
virtual uint64_t RequestFriendProfileInfo(SteamID steamIDFriend) = 0;
// Available keys: TimeCreated, RealName, CityName, StateName, CountryName, Headline, Playtime, Summary
virtual const char* GetFriendProfileInfo(SteamID steamIDFriend, const char* pchKey) = 0;
virtual bool InviteUserToGame(SteamID steamIDFriend, const char *pchConnectString) = 0;
virtual int32_t GetOnlineConsoleFriendCount() = 0;
virtual uint64_t RequestTrade(SteamID steamIDPartner) = 0;
virtual void TradeResponse(uint32_t unTradeRequestID, bool bAccept) = 0;
virtual void CancelTradeRequest(SteamID steamIDPartner) = 0;
virtual bool HideFriend(SteamID steamIDFriend, bool bHide) = 0;
virtual const char * GetFriendFacebookName(SteamID steamIDFriend) = 0;
virtual uint64_t GetFriendFacebookID(SteamID steamIDFriend) = 0;
virtual uint64_t GetFollowerCount(SteamID steamID) = 0;
virtual uint64_t IsFollowing(SteamID steamID) = 0;
virtual uint64_t EnumerateFollowingList(uint32_t uStartIndex) = 0;
virtual void RequestFriendMessageHistory(SteamID steamIDFriend) = 0;
virtual void RequestFriendMessageHistoryForOfflineMessages() = 0;
virtual int32_t GetCountFriendsWithOfflineMessages() = 0;
virtual uint32_t GetFriendWithOfflineMessage(int32_t iFriend) = 0;
virtual void ClearFriendHasOfflineMessage(uint32_t uFriend) = 0;
virtual void RequestEmoticonList() = 0;
virtual int32_t GetEmoticonCount() = 0;
virtual const char *GetEmoticonName(int32_t iEmoticon) = 0;
virtual void ClientLinkFilterInit() = 0;
virtual uint32_t LinkDisposition(const char *) = 0;
};
}

View File

@ -7,8 +7,8 @@ namespace Steam
ISteamClient008* Proxy::SteamClient = nullptr;
IClientEngine* Proxy::ClientEngine = nullptr;
IClientUser* Proxy::ClientUser = nullptr;
IClientFriends* Proxy::ClientFriends = nullptr;
Interface Proxy::ClientUser;
Interface Proxy::ClientFriends;
void* Proxy::SteamPipe = nullptr;
void* Proxy::SteamUser = nullptr;
@ -16,6 +16,7 @@ namespace Steam
Friends15* Proxy::SteamFriends = nullptr;
Friends2* Proxy::SteamLegacyFriends = nullptr;
Utils* Proxy::SteamUtils = nullptr;
User* Proxy::SteamUser_ = nullptr;
uint32_t Proxy::AppId = 0;
@ -27,19 +28,113 @@ namespace Steam
std::function<Proxy::SteamFreeLastCallbackFn> Proxy::SteamFreeLastCallback;
std::function<Proxy::SteamGetAPICallResultFn> Proxy::SteamGetAPICallResult;
void* Interface::getMethod(std::string method)
{
if(this->methodCache.find(method) != this->methodCache.end())
{
return this->methodCache[method];
}
void* methodPtr = Interface::lookupMethod(method);
this->methodCache[method] = methodPtr;
return methodPtr;
}
void* Interface::lookupMethod(std::string method)
{
if (IsBadReadPtr(this->interfacePtr, 4)) return nullptr;
unsigned char** vftbl = *static_cast<unsigned char***>(this->interfacePtr);
while (!IsBadReadPtr(vftbl, 4) && !IsBadCodePtr((FARPROC(*vftbl))))
{
if(this->getMethodName(*vftbl) == method) return *vftbl;
++vftbl;
}
return nullptr;
}
std::string Interface::getMethodName(unsigned char* methodPtr)
{
for(;!IsBadReadPtr(methodPtr, 1); ++methodPtr)
{
if(methodPtr[0] == 0x68) // Push
{
char* name = *reinterpret_cast<char**>(&methodPtr[1]);
if(!IsBadReadPtr(name, 1)) return name;
}
else if(methodPtr[0] == 0xC2 && methodPtr[2] == 0) // __stdcall return
{
break;
}
}
return "";
}
void Proxy::SetGame(uint32_t appId)
{
Proxy::AppId = appId;
// if (!Components::Flags::HasFlag("nosteam"))
// {
// SetEnvironmentVariableA("SteamAppId", ::Utils::String::VA("%lu", appId));
// SetEnvironmentVariableA("SteamGameId", ::Utils::String::VA("%llu", appId & 0xFFFFFF));
//
// ::Utils::IO::WriteFile("steam_appid.txt", ::Utils::String::VA("%lu", appId), false);
// }
if (!Components::Flags::HasFlag("nosteam"))
{
SetEnvironmentVariableA("SteamAppId", ::Utils::String::VA("%lu", appId));
SetEnvironmentVariableA("SteamGameId", ::Utils::String::VA("%llu", appId & 0xFFFFFF));
remove("steam_appid.txt");
::Utils::IO::WriteFile("steam_appid.txt", ::Utils::String::VA("%lu", appId), false);
}
else
{
remove("steam_appid.txt");
}
}
class KeyValuesBuilder { private: std::stringstream m_buffer; inline void PackBytes(const void* bytes, size_t size) { m_buffer << std::string(reinterpret_cast<const char*>(bytes), size); } inline void PackDataType(uint8_t type) { PackBytes(&type, 1); } inline void PackNullTerminated(const char* string) { PackBytes(string, strlen(string) + 1); } public: inline void PackString(const char* key, const char* value) { PackDataType(1); PackNullTerminated(key); PackNullTerminated(value); } inline void PackUint64(const char* key, uint64_t value) { PackDataType(7); PackNullTerminated(key); PackBytes(&value, sizeof(value)); } inline void PackEnd() { PackDataType(8); } inline std::string GetString() { return m_buffer.str(); } };
void Proxy::SetMod(std::string mod)
{
if (!Proxy::ClientUser || Components::Flags::HasFlag("nosteam")) return;
GameID_t gameID;
gameID.m_nType = 1; // k_EGameIDTypeGameMod
gameID.m_nAppID = Proxy::AppId & 0xFFFFFF;
gameID.m_nModID = 0xBAADF00D;
Interface clientApps(Proxy::ClientEngine->GetIClientApps(Proxy::SteamUser, Proxy::SteamPipe, "CLIENTAPPS_INTERFACE_VERSION001"));
clientApps.invoke<bool>("SetLocalAppConfig", 0, nullptr, 0);
char ourPath[MAX_PATH] = { 0 };
GetModuleFileNameA(GetModuleHandle(nullptr), ourPath, sizeof(ourPath));
char ourDirectory[MAX_PATH] = { 0 };
GetCurrentDirectoryA(sizeof(ourDirectory), ourDirectory);
std::string cmdline = ::Utils::String::VA("\"%s\" -parentProc %d", ourPath, GetCurrentProcessId());
Proxy::ClientUser.invoke<bool>("SpawnProcess", ourPath, cmdline.data(), 0, ourDirectory, gameID.Bits, Proxy::AppId, mod.data(), 0, 0);
}
void Proxy::RunMod()
{
char* command = "-parentProc ";
char* parentProc = strstr(GetCommandLineA(), command);
if (parentProc)
{
FreeConsole();
parentProc += strlen(command);
int pid = atoi(parentProc);
HANDLE processHandle = OpenProcess(SYNCHRONIZE, FALSE, pid);
if (processHandle && processHandle != INVALID_HANDLE_VALUE)
{
WaitForSingleObject(processHandle, INFINITE);
CloseHandle(processHandle);
}
TerminateProcess(GetCurrentProcess(), 0);
}
}
void Proxy::RegisterCall(int32_t callId, uint32_t size, uint64_t call)
@ -213,9 +308,12 @@ namespace Steam
Proxy::SteamLegacyFriends = reinterpret_cast<Friends2*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamFriends002"));
if (!Proxy::SteamLegacyFriends) return false;
Proxy::SteamUtils = reinterpret_cast<Utils*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamUtils005"));
Proxy::SteamUtils = reinterpret_cast<Utils*>(Proxy::SteamClient->GetISteamUtils(Proxy::SteamPipe, "SteamUtils005"));
if (!Proxy::SteamUtils) return false;
Proxy::SteamUser_ = reinterpret_cast<User*>(Proxy::SteamClient->GetISteamUser(Proxy::SteamUser, Proxy::SteamPipe, "SteamUser012"));
if (!Proxy::SteamUser_) return false;
return true;
}

View File

@ -14,9 +14,6 @@ namespace Steam
{
class ISteamClient008
{
protected:
~ISteamClient008() = default;
public:
virtual void* CreateSteamPipe() = 0;
virtual bool ReleaseSteamPipe(void* hSteamPipe) = 0;
@ -41,236 +38,8 @@ namespace Steam
virtual void SetWarningMessageHook(void* pFunction) = 0;
};
class IClientUser
{
protected:
~IClientUser() = default;
public:
virtual int32_t GetHSteamUser() = 0;
virtual void LogOn(bool bInteractive, SteamID steamID) = 0;
virtual void LogOnWithPassword(bool bInteractive, const char * pchLogin, const char * pchPassword) = 0;
virtual void LogOnAndCreateNewSteamAccountIfNeeded(bool bInteractive) = 0;
virtual int LogOnConnectionless() = 0;
virtual void LogOff() = 0;
virtual bool BLoggedOn() = 0;
virtual int GetLogonState() = 0;
virtual bool BConnected() = 0;
virtual bool BTryingToLogin() = 0;
virtual SteamID GetSteamID() = 0;
virtual SteamID GetConsoleSteamID() = 0;
virtual bool IsVACBanned(uint32_t nGameID) = 0;
virtual bool RequireShowVACBannedMessage(uint32_t nAppID) = 0;
virtual void AcknowledgeVACBanning(uint32_t nAppID) = 0;
virtual void SetSteam2Ticket(uint8_t* pubTicket, int32_t cubTicket) = 0;
virtual bool BExistsSteam2Ticket() = 0;
virtual bool SetEmail(const char *pchEmail) = 0;
virtual bool SetConfigString(int eRegistrySubTree, const char *pchKey, const char *pchValue) = 0;
virtual bool GetConfigString(int eRegistrySubTree, const char *pchKey, char *pchValue, int32_t cbValue) = 0;
virtual bool SetConfigInt(int eRegistrySubTree, const char *pchKey, int32_t iValue) = 0;
virtual bool GetConfigInt(int eRegistrySubTree, const char *pchKey, int32_t *pValue) = 0;
virtual bool GetConfigStoreKeyName(int eRegistrySubTree, const char *pchKey, char *pchStoreName, int32_t cbStoreName) = 0;
virtual int32_t InitiateGameConnection(void *pOutputBlob, int32_t cbBlobMax, SteamID steamIDGS, uint64_t gameID, uint32_t unIPServer, uint16_t usPortServer, bool bSecure) = 0;
virtual int32_t InitiateGameConnectionOld(void *pOutputBlob, int32_t cbBlobMax, SteamID steamIDGS, uint64_t gameID, uint32_t unIPServer, uint16_t usPortServer, bool bSecure, void *pvSteam2GetEncryptionKey, int32_t cbSteam2GetEncryptionKey) = 0;
virtual void TerminateGameConnection(uint32_t unIPServer, uint16_t usPortServer) = 0;
virtual bool TerminateAppMultiStep(uint32_t, uint32_t) = 0;
virtual void SetSelfAsPrimaryChatDestination() = 0;
virtual bool IsPrimaryChatDestination() = 0;
virtual void RequestLegacyCDKey(uint32_t iAppID) = 0;
virtual bool AckGuestPass(const char *pchGuestPassCode) = 0;
virtual bool RedeemGuestPass(const char *pchGuestPassCode) = 0;
virtual uint32_t GetGuestPassToGiveCount() = 0;
virtual uint32_t GetGuestPassToRedeemCount() = 0;
virtual bool GetGuestPassToGiveInfo(uint32_t nPassIndex, uint64_t *pgidGuestPassID, uint32_t* pnPackageID, uint32_t* pRTime32Created, uint32_t* pRTime32Expiration, uint32_t* pRTime32Sent, uint32_t* pRTime32Redeemed, char* pchRecipientAddress, int32_t cRecipientAddressSize) = 0;
virtual bool GetGuestPassToRedeemInfo(uint32_t nPassIndex, uint64_t *pgidGuestPassID, uint32_t* pnPackageID, uint32_t* pRTime32Created, uint32_t* pRTime32Expiration, uint32_t* pRTime32Sent, uint32_t* pRTime32Redeemed) = 0;
virtual bool GetGuestPassToRedeemSenderName(uint32_t nPassIndex, char* pchSenderName, int32_t cSenderNameSize) = 0;
virtual void AcknowledgeMessageByGID(const char *pchMessageGID) = 0;
virtual bool SetLanguage(const char *pchLanguage) = 0;
virtual void TrackAppUsageEvent(uint64_t gameID, int32_t eAppUsageEvent, const char *pchExtraInfo = "") = 0;
virtual int32_t RaiseConnectionPriority(int eConnectionPriority) = 0;
virtual void ResetConnectionPriority(int32_t hRaiseConnectionPriorityPrev) = 0;
virtual void SetAccountNameFromSteam2(const char *pchAccountName) = 0;
virtual bool SetPasswordFromSteam2(const char *pchPassword) = 0;
virtual bool BHasCachedCredentials(const char * pchUnk) = 0;
virtual bool SetAccountNameForCachedCredentialLogin(const char *pchAccountName, bool bUnk) = 0;
virtual void SetLoginInformation(const char *pchAccountName, const char *pchPassword, bool bRememberPassword) = 0;
virtual void ClearAllLoginInformation() = 0;
virtual void SetAccountCreationTime(uint32_t rtime32Time) = 0;
virtual uint64_t RequestWebAuthToken() = 0;
virtual bool GetCurrentWebAuthToken(char *pchBuffer, int32_t cubBuffer) = 0;
virtual bool GetLanguage(char* pchLanguage, int32_t cbLanguage) = 0;
virtual bool BIsCyberCafe() = 0;
virtual bool BIsAcademicAccount() = 0;
virtual void CreateAccount(const char *pchAccountName, const char *pchNewPassword, const char *pchNewEmail, int32_t iQuestion, const char *pchNewQuestion, const char *pchNewAnswer) = 0;
virtual uint64_t ResetPassword(const char *pchAccountName, const char *pchOldPassword, const char *pchNewPassword, const char *pchValidationCode, const char *pchAnswer) = 0;
virtual void TrackNatTraversalStat(const void *pNatStat) = 0;
virtual void TrackSteamUsageEvent(int eSteamUsageEvent, const uint8_t *pubKV, uint32_t cubKV) = 0;
virtual void TrackSteamGUIUsage(const char *) = 0;
virtual void SetComputerInUse() = 0;
virtual bool BIsGameRunning(uint64_t gameID) = 0;
virtual uint64_t GetCurrentSessionToken() = 0;
virtual bool BUpdateAppOwnershipTicket(uint32_t nAppID, bool bOnlyUpdateIfStale, bool bIsDepot) = 0;
virtual bool RequestCustomBinary(const char *pszAbsolutePath, uint32_t nAppID, bool bForceUpdate, bool bAppLaunchRequest) = 0;
virtual int GetCustomBinariesState(uint32_t unAppID, uint32_t *punProgress) = 0;
virtual int RequestCustomBinaries(uint32_t unAppID, bool, bool, uint32_t *) = 0;
virtual void SetCellID(uint32_t cellID) = 0;
virtual void SetWinningPingTimeForCellID(uint32_t uPing) = 0;
virtual const char *GetUserBaseFolder() = 0;
virtual bool GetUserDataFolder(uint64_t gameID, char* pchBuffer, int32_t cubBuffer) = 0;
virtual bool GetUserConfigFolder(char *pchBuffer, int32_t cubBuffer) = 0;
virtual bool GetAccountName(char* pchAccountName, uint32_t cb) = 0;
virtual bool GetAccountName(SteamID userID, char * pchAccountName, uint32_t cb) = 0;
virtual bool IsPasswordRemembered() = 0;
virtual bool RequiresLegacyCDKey(uint32_t nAppID, bool * pbUnk) = 0;
virtual bool GetLegacyCDKey(uint32_t nAppID, char* pchKeyData, int32_t cbKeyData) = 0;
virtual bool SetLegacyCDKey(uint32_t nAppID, const char* pchKeyData) = 0;
virtual bool WriteLegacyCDKey(uint32_t nAppID) = 0;
virtual void RemoveLegacyCDKey(uint32_t nAppID) = 0;
virtual void RequestLegacyCDKeyFromApp(uint32_t nMainAppID, uint32_t nDLCAppID) = 0;
virtual bool BIsAnyGameRunning() = 0;
virtual void TestAvailablePassword(const uint8_t *pubDigestPassword, int32_t cubDigestPassword) = 0;
virtual void GetSteamGuardDetails() = 0;
virtual void ChangePassword(const char *pchOldPassword, const char *pchNewPassword) = 0;
virtual void ChangeEmail(const char *, const char *pchEmail) = 0;
virtual void ChangeSecretQuestionAndAnswer(const char *, int32_t iQuestion, const char *pchNewQuestion, const char *pchNewAnswer) = 0;
virtual void SetSteam2FullASTicket(uint8_t* pubTicket, int32_t cubTicket) = 0;
virtual int32_t GetSteam2FullASTicket(uint8_t* pubTicket, int32_t cubTicket) = 0;
virtual bool GetEmail(char* pchEmail, int32_t cchEmail, bool* pbValidated) = 0;
virtual void RequestForgottenPasswordEmail(const char *pchAccountName, const char *pchTriedPassword) = 0;
virtual void FindAccountsByEmailAddress(const char *pchEmailAddress) = 0;
virtual void FindAccountsByCdKey(const char *pchCdKey) = 0;
virtual void GetNumAccountsWithEmailAddress(const char * pchEmailAddress) = 0;
virtual void IsAccountNameInUse(const char * pchAccountName) = 0;
virtual void Test_FakeConnectionTimeout() = 0;
virtual bool RunInstallScript(uint32_t *pAppIDs, int32_t cAppIDs, const char *pchInstallPath, const char *pchLanguage, bool bUninstall) = 0;
virtual uint32_t IsInstallScriptRunning() = 0;
virtual bool GetInstallScriptState(char* pchDescription, uint32_t cchDescription, uint32_t* punNumSteps, uint32_t* punCurrStep) = 0;
virtual void Test1() = 0;
virtual void Test2() = 0;
virtual bool SpawnProcess(void *lpVACBlob, uint32_t cbBlobSize, const char *lpApplicationName, const char *lpCommandLine, uint32_t dwCreationFlags, const char *lpCurrentDirectory, GameID_t gameID, uint32_t nAppID, const char *pchGameName, uint32_t uUnk) = 0;
virtual uint32_t GetAppOwnershipTicketLength(uint32_t nAppID) = 0;
virtual uint32_t GetAppOwnershipTicketData(uint32_t nAppID, void *pvBuffer, uint32_t cbBufferLength) = 0;
virtual uint32_t GetAppOwnershipTicketExtendedData(uint32_t nAppID, void *pvBuffer, uint32_t cbBufferLength, uint32_t* piAppId, uint32_t* piSteamId, uint32_t* piSignature, uint32_t* pcbSignature) = 0;
virtual int32_t GetMarketingMessageCount() = 0;
virtual bool GetMarketingMessage(int32_t cMarketingMessage, uint64_t* gidMarketingMessageID, char* pubMsgUrl, int32_t cubMessageUrl, int *eMarketingMssageFlags) = 0;
virtual uint32_t GetAuthSessionTicket(void *pMyAuthTicket, int32_t cbMaxMyAuthTicket, uint32_t* pcbAuthTicket) = 0;
virtual int BeginAuthSession(void const* pTheirAuthTicket, int32_t cbTicket, SteamID steamID) = 0;
virtual void EndAuthSession(SteamID steamID) = 0;
virtual void CancelAuthTicket(uint32_t hAuthTicket) = 0;
virtual int IsUserSubscribedAppInTicket(SteamID steamID, uint32_t appID) = 0;
virtual void AdvertiseGame(uint64_t gameID, SteamID steamIDGameServer, uint32_t unIPServer, uint16_t usPortServer) = 0;
virtual uint64_t RequestEncryptedAppTicket(const void *pUserData, int32_t cbUserData) = 0;
virtual bool GetEncryptedAppTicket(void *pTicket, int32_t cbMaxTicket, uint32_t *pcbTicket) = 0;
virtual int32_t GetGameBadgeLevel(int32_t nSeries, bool bFoil) = 0;
virtual int32_t GetPlayerSteamLevel() = 0;
virtual void SetAccountLimited(bool bAccountLimited) = 0;
virtual bool BIsAccountLimited() = 0;
virtual void SetAccountCommunityBanned(bool bBanned) = 0;
virtual bool BIsAccountCommunityBanned() = 0;
virtual void SetLimitedAccountCanInviteFriends(bool bCanInviteFriends) = 0;
virtual bool BLimitedAccountCanInviteFriends() = 0;
virtual void SendValidationEmail() = 0;
virtual bool BGameConnectTokensAvailable() = 0;
virtual int32_t NumGamesRunning() = 0;
virtual uint64_t GetRunningGameID(int32_t iGame) = 0;
virtual uint32_t GetAccountSecurityPolicyFlags() = 0;
virtual void RequestChangeEmail(const char *pchPassword, int32_t eRequestType) = 0;
virtual void ChangePasswordWithCode(const char *pchOldPassword, const char *pchCode, const char *pchNewPassword) = 0;
virtual void ChangeEmailWithCode(const char *pchPassword, const char *pchCode, const char *pchEmail, bool bFinal) = 0;
virtual void ChangeSecretQuestionAndAnswerWithCode(const char *pchPassword, const char *pchCode, const char *pchNewQuestion, const char *pchNewAnswer) = 0;
virtual void SetClientStat(int eStat, int64_t llValue, uint32_t nAppID, uint32_t nDepotID, uint32_t nCellID) = 0;
virtual void VerifyPassword(const char *pchPassword) = 0;
virtual bool BSupportUser() = 0;
virtual bool BNeedsSSANextSteamLogon() = 0;
virtual void ClearNeedsSSANextSteamLogon() = 0;
virtual bool BIsAppOverlayEnabled(uint64_t gameID) = 0;
virtual bool BIsBehindNAT() = 0;
virtual uint32_t GetMicroTxnAppID(uint64_t gidTransID) = 0;
virtual uint64_t GetMicroTxnOrderID(uint64_t gidTransID) = 0;
virtual bool BGetMicroTxnPrice(uint64_t gidTransID, uint64_t *pamtTotal, uint64_t *pamtTax, bool *pbVat, uint64_t * pUnk) = 0;
virtual int32_t GetMicroTxnLineItemCount(uint64_t gidTransID) = 0;
virtual bool BGetMicroTxnLineItem(uint64_t gidTransID, uint32_t unLineItem, uint64_t *pamt, uint32_t *punQuantity, char *pchDescription, uint32_t cubDescriptionLength, int32_t *pRecurringTimeUnit, uint8_t *pRecurringFrequency, uint64_t *pRecurringAmount, bool * pbUnk) = 0;
virtual bool BIsSandboxMicroTxn(uint64_t gidTransID, bool* pbSandbox) = 0;
virtual bool BMicroTxnRequiresCachedPmtMethod(uint64_t gidTransID, bool *pbRequired) = 0;
virtual uint64_t AuthorizeMicroTxn(uint64_t gidTransID, int eMicroTxnAuthResponse) = 0;
virtual bool BGetWalletBalance(bool *pbHasWallet, uint64_t *pamtBalance) = 0;
virtual uint64_t RequestMicroTxnInfo(uint64_t gidTransID) = 0;
virtual bool BGetAppMinutesPlayed(uint32_t nAppId, int32_t *pnForever, int32_t *pnLastTwoWeeks) = 0;
virtual uint32_t GetAppLastPlayedTime(uint32_t nAppId) = 0;
virtual bool BGetGuideURL(uint32_t uAppID, char *pchURL, uint32_t cchURL) = 0;
virtual void PostUIResultToClientJob(uint64_t ulJobID, int eResult) = 0;
virtual bool BPromptToVerifyEmail() = 0;
virtual bool BPromptToChangePassword() = 0;
virtual bool BAccountLocked() = 0;
virtual bool BAccountShouldShowLockUI() = 0;
virtual bool BAccountLockedByIPT() = 0;
virtual int32_t GetCountAuthedComputers() = 0;
virtual int GetSteamGuardProvider() = 0;
virtual bool GetSteamGuardRequireCodeByDefault() = 0;
virtual bool ShowSteamGuardProviderOptions() = 0;
virtual bool SteamGuardProviderMobileIsOption() = 0;
virtual bool BSteamGuardNewMachineNotification() = 0;
virtual uint32_t GetSteamGuardEnabledTime() = 0;
virtual bool GetSteamGuardHistoryEntry(int32_t iEntryIndex, uint32_t *puTimestamp, uint32_t *puIP, bool *pbIsRemembered, char *pchGeolocInfo, int32_t cchGeolocInfo, char * pchUnk, int32_t cbUnk) = 0;
virtual void SetSteamGuardNewMachineDialogResponse(bool bIsApproved, bool bIsWizardComplete) = 0;
virtual void RequestSteamGuardCodeForOtherLogin() = 0;
virtual bool BAccountCanUseIPT() = 0;
virtual void ChangeTwoFactorAuthOptions(int32_t eOption) = 0;
virtual void ChangeSteamGuardOptions(const char * pchUnk, int eProvider, bool bRequireCode) = 0;
virtual void Set2ndFactorAuthCode(const char* pchAuthCode, bool bDontRememberComputer) = 0;
virtual void SetUserMachineName(const char * pchMachineName) = 0;
virtual bool GetUserMachineName(char * pchMachineName, int32_t cbMachineName) = 0;
virtual bool BAccountHasIPTConfig() = 0;
virtual bool GetEmailDomainFromLogonFailure(char * pchEmailDomain, int32_t cbEmailDomain) = 0;
virtual bool BIsSubscribedApp(uint32_t nAppId) = 0;
virtual uint64_t RegisterActivationCode(const char * pchActivationCode) = 0;
virtual void OptionalDLCInstallation(uint32_t nAppID, uint32_t uUnk, bool bInstall) = 0;
virtual void AckSystemIM(uint64_t) = 0;
virtual uint64_t RequestSpecialSurvey(uint32_t uSurveyId) = 0;
virtual uint64_t SendSpecialSurveyResponse(uint32_t uSurveyId, const uint8_t * pubData, uint32_t cubData) = 0;
virtual void RequestNotifications() = 0;
virtual bool GetAppOwnershipInfo(uint32_t unAppId, uint32_t* pRTime32Created, char* pchCountry) = 0;
virtual void SendGameWebCallback(uint32_t unAppId, const char *szData) = 0;
virtual bool BIsCurrentlyStreaming() = 0;
virtual void RequestStopStreaming() = 0;
virtual void OnBigPictureStreamingResult(bool, void *) = 0;
virtual void OnBigPictureStreamingDone() = 0;
virtual void OnBigPictureStreamRestarting() = 0;
virtual void LockParentalLock() = 0;
virtual bool UnlockParentalLock(const char * pchUnk) = 0;
virtual bool BIsParentalLockEnabled() = 0;
virtual bool BIsParentalLockLocked() = 0;
virtual void BlockApp(uint32_t unAppID) = 0;
virtual void UnblockApp(uint32_t unAppID) = 0;
virtual bool BIsAppBlocked(uint32_t unAppID) = 0;
virtual bool BIsAppInBlockList(uint32_t unAppID) = 0;
virtual void BlockFeature(int eParentalFeature) = 0;
virtual void UnblockFeature(int eParentalFeature) = 0;
virtual bool BIsFeatureBlocked(int eParentalFeature) = 0;
virtual bool BIsFeatureInBlockList(int eParentalFeature) = 0;
virtual uint32_t GetParentalUnlockTime() = 0;
virtual bool BGetSerializedParentalSettings(void * pBuffer) = 0;
virtual bool BSetParentalSettings(void * pBuffer) = 0;
virtual bool BDisableParentalSettings() = 0;
virtual bool BGetParentalWebToken(void *, void *) = 0;
virtual bool BCanLogonOfflineMode() = 0;
virtual int LogOnOfflineMode() = 0;
virtual int ValidateOfflineLogonTicket(const char * pchUnk) = 0;
virtual bool BGetOfflineLogonTicket(const char * pchUnk, void * pTicket) = 0;
virtual void UploadLocalClientLogs() = 0;
virtual void SetAsyncNotificationEnabled(uint32_t, bool) = 0;
virtual bool BIsOtherSessionPlaying(uint32_t *) = 0;
virtual bool BKickOtherPlayingSession() = 0;
virtual uint32_t GetStreamPortForGame(uint64_t gameID) = 0;
};
class IClientEngine
{
protected:
~IClientEngine() = default;
public:
virtual void* CreateSteamPipe() = 0;
virtual bool BReleaseSteamPipe(void* hSteamPipe) = 0;
@ -280,11 +49,11 @@ namespace Steam
virtual void CreatePipeToLocalUser(void* hSteamUser, void** phSteamPipe) = 0;
virtual void ReleaseUser(void* hSteamPipe, void* hUser) = 0;
virtual bool IsValidHSteamUserPipe(void* hSteamPipe, void* hUser) = 0;
virtual IClientUser *GetIClientUser(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientUser(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientGameServer(void* hSteamUser, void* hSteamPipe, const char *pchVersion) = 0;
virtual void SetLocalIPBinding(uint32_t unIP, uint16_t usPort) = 0;
virtual char const *GetUniverseName(int eUniverse) = 0;
virtual IClientFriends *GetIClientFriends(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientFriends(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientUtils(void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientBilling(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientMatchmaking(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
@ -322,6 +91,7 @@ namespace Steam
virtual void *GetIClientStreamLauncher(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientDeviceAuth(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientRemoteClientManager(void* hSteamPipe, char const* pchVersion) = 0;
virtual void test() = 0; // Too lazy to correct the struct
virtual void *GetIClientStreamClient(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientShortcuts(void* hSteamUser, void* hSteamPipe, char const* pchVersion) = 0;
virtual void *GetIClientRemoteControlManager(void* hSteamPipe, char const* pchVersion) = 0;
@ -331,6 +101,36 @@ namespace Steam
virtual void *GetIClientVR(char const * pchVersion) = 0;
};
class Interface
{
public:
Interface() : interfacePtr(nullptr) {}
Interface(void* _interfacePtr) : interfacePtr(_interfacePtr) {}
template<typename T, typename... Args>
T invoke(std::string methodName, Args... args)
{
if(!this->interfacePtr) throw std::runtime_error("No valid interface provided!");
void* method = this->getMethod(methodName);
if (!method) throw std::runtime_error("Method not found!");
return reinterpret_cast<T(__thiscall*)(void*, Args ...)>(method)(this->interfacePtr, args...);
}
explicit operator bool() const
{
return this->interfacePtr != nullptr;
}
private:
void* interfacePtr;
std::unordered_map<std::string, void*> methodCache;
void* getMethod(std::string method);
void* lookupMethod(std::string method);
std::string getMethodName(unsigned char* methodPtr);
};
class Proxy
{
public:
@ -338,6 +138,8 @@ namespace Steam
static void Uninititalize();
static void SetGame(uint32_t appId);
static void SetMod(std::string mod);
static void RunMod();
//Overlay related proxies
static void SetOverlayNotificationPosition(uint32_t eNotificationPosition);
@ -355,7 +157,10 @@ namespace Steam
static Friends15* SteamFriends;
static Friends2* SteamLegacyFriends;
static Utils* SteamUtils;
static IClientFriends* ClientFriends;
static User* SteamUser_;
static Interface ClientFriends;
static uint32_t AppId;
private:
typedef bool(SteamBGetCallbackFn)(void* hpipe, void *pCallbackMsg);
@ -383,13 +188,11 @@ namespace Steam
static ISteamClient008* SteamClient;
static IClientEngine* ClientEngine;
static IClientUser* ClientUser;
static Interface ClientUser;
static void* SteamPipe;
static void* SteamUser;
static uint32_t AppId;
static std::recursive_mutex CallMutex;
static std::vector<CallContainer> Calls;
static std::unordered_map<int32_t, void*> Callbacks;

View File

@ -111,7 +111,11 @@ namespace Steam
if (!Proxy::Inititalize())
{
OutputDebugStringA("Steamproxy not initialized properly");
Components::StartupMessages::AddMessage("Warning:\nUnable to connet to Steam. Steam features will be unavailable");
Components::StartupMessages::AddMessage("Warning:\nUnable to connect to Steam. Steam features will be unavailable");
}
else
{
Steam::Proxy::SetMod("IW4x - Modern Warfare 2");
}
return true;

View File

@ -22,14 +22,17 @@ typedef union
#pragma pack( push, 1 )
struct GameID_t
typedef union
{
unsigned int m_nAppID : 24;
unsigned int m_nType : 8;
unsigned int m_nModID : 32;
};
struct
{
unsigned int m_nAppID : 24;
unsigned int m_nType : 8;
unsigned int m_nModID : 32;
};
unsigned long long Bits;
} GameID_t;
#pragma pack( pop )
#include "Interfaces/SteamUser.hpp"