Use premake.

This commit is contained in:
momo5502
2015-12-29 02:52:31 +01:00
parent 93d1380139
commit 87c1c36943
85 changed files with 85 additions and 519 deletions

View File

@ -0,0 +1,120 @@
#include "..\..\STDInclude.hpp"
using namespace Components;
namespace Steam
{
const char *Friends::GetPersonaName()
{
return Dvar::Var("name").Get<const char*>();
}
void Friends::SetPersonaName(const char *pchPersonaName)
{
Dvar::Var("name").Set(pchPersonaName);
}
int Friends::GetPersonaState()
{
return 1;
}
int Friends::GetFriendCount(int eFriendFlags)
{
return 0;
}
SteamID Friends::GetFriendByIndex(int iFriend, int iFriendFlags)
{
return SteamID();
}
int Friends::GetFriendRelationship(SteamID steamIDFriend)
{
return 0;
}
int Friends::GetFriendPersonaState(SteamID steamIDFriend)
{
return 0;
}
const char *Friends::GetFriendPersonaName(SteamID steamIDFriend)
{
return "";
}
int Friends::GetFriendAvatar(SteamID steamIDFriend, int eAvatarSize)
{
return 0;
}
bool Friends::GetFriendGamePlayed(SteamID steamIDFriend, void *pFriendGameInfo)
{
return false;
}
const char *Friends::GetFriendPersonaNameHistory(SteamID steamIDFriend, int iPersonaName)
{
return "";
}
bool Friends::HasFriend(SteamID steamIDFriend, int eFriendFlags)
{
return false;
}
int Friends::GetClanCount()
{
return 0;
}
SteamID Friends::GetClanByIndex(int iClan)
{
return SteamID();
}
const char *Friends::GetClanName(SteamID steamIDClan)
{
return "3arc";
}
int Friends::GetFriendCountFromSource(SteamID steamIDSource)
{
return 0;
}
SteamID Friends::GetFriendFromSourceByIndex(SteamID steamIDSource, int iFriend)
{
return SteamID();
}
bool Friends::IsUserInSource(SteamID steamIDUser, SteamID steamIDSource)
{
return false;
}
void Friends::SetInGameVoiceSpeaking(SteamID steamIDUser, bool bSpeaking)
{
}
void Friends::ActivateGameOverlay(const char *pchDialog)
{
}
void Friends::ActivateGameOverlayToUser(const char *pchDialog, SteamID steamID)
{
}
void Friends::ActivateGameOverlayToWebPage(const char *pchURL)
{
}
void Friends::ActivateGameOverlayToStore(unsigned int nAppID)
{
}
void Friends::SetPlayedWith(SteamID steamIDUserPlayedWith)
{
}
}

View File

@ -0,0 +1,31 @@
namespace Steam
{
class Friends
{
public:
virtual const char *GetPersonaName();
virtual void SetPersonaName(const char *pchPersonaName);
virtual int GetPersonaState();
virtual int GetFriendCount(int eFriendFlags);
virtual SteamID GetFriendByIndex(int iFriend, int iFriendFlags);
virtual int GetFriendRelationship(SteamID steamIDFriend);
virtual int GetFriendPersonaState(SteamID steamIDFriend);
virtual const char *GetFriendPersonaName(SteamID steamIDFriend);
virtual int GetFriendAvatar(SteamID steamIDFriend, int eAvatarSize);
virtual bool GetFriendGamePlayed(SteamID steamIDFriend, void *pFriendGameInfo);
virtual const char *GetFriendPersonaNameHistory(SteamID steamIDFriend, int iPersonaName);
virtual bool HasFriend(SteamID steamIDFriend, int eFriendFlags);
virtual int GetClanCount();
virtual SteamID GetClanByIndex(int iClan);
virtual const char *GetClanName(SteamID steamIDClan);
virtual int GetFriendCountFromSource(SteamID steamIDSource);
virtual SteamID GetFriendFromSourceByIndex(SteamID steamIDSource, int iFriend);
virtual bool IsUserInSource(SteamID steamIDUser, SteamID steamIDSource);
virtual void SetInGameVoiceSpeaking(SteamID steamIDUser, bool bSpeaking);
virtual void ActivateGameOverlay(const char *pchDialog);
virtual void ActivateGameOverlayToUser(const char *pchDialog, SteamID steamID);
virtual void ActivateGameOverlayToWebPage(const char *pchURL);
virtual void ActivateGameOverlayToStore(unsigned int nAppID);
virtual void SetPlayedWith(SteamID steamIDUserPlayedWith);
};
}

View File

@ -0,0 +1,91 @@
#include "..\..\STDInclude.hpp"
namespace Steam
{
void GameServer::LogOn()
{
}
void GameServer::LogOff()
{
}
bool GameServer::LoggedOn()
{
return true;
}
bool GameServer::Secure()
{
return false;
}
SteamID GameServer::GetSteamID()
{
return SteamID();
}
bool GameServer::SendUserConnectAndAuthenticate(unsigned int unIPClient, const void *pvAuthBlob, unsigned int cubAuthBlobSize, SteamID *pSteamIDUser)
{
return true;
}
SteamID GameServer::CreateUnauthenticatedUserConnection()
{
return SteamID();
}
void GameServer::SendUserDisconnect(SteamID steamIDUser)
{
}
bool GameServer::UpdateUserData(SteamID steamIDUser, const char *pchPlayerName, unsigned int uScore)
{
return true;
}
bool GameServer::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 GameServer::UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char *pchServerName, const char *pSpectatorServerName, const char *pchMapName)
{
}
void GameServer::UpdateSpectatorPort(unsigned short unSpectatorPort)
{
}
void GameServer::SetGameType(const char *pchGameType)
{
}
bool GameServer::GetUserAchievementStatus(SteamID steamID, const char *pchAchievementName)
{
return false;
}
void GameServer::GetGameplayStats()
{
}
bool GameServer::RequestUserGroupStatus(SteamID steamIDUser, SteamID steamIDGroup)
{
return false;
}
unsigned int GameServer::GetPublicIP()
{
return 0;
}
void GameServer::SetGameData(const char *pchGameData)
{
}
int GameServer::UserHasLicenseForApp(SteamID steamID, unsigned int appID)
{
return 0;
}
}

View File

@ -0,0 +1,26 @@
namespace Steam
{
class GameServer
{
public:
virtual void LogOn();
virtual void LogOff();
virtual bool LoggedOn();
virtual bool Secure();
virtual SteamID GetSteamID();
virtual bool SendUserConnectAndAuthenticate(unsigned int unIPClient, const void *pvAuthBlob, unsigned int cubAuthBlobSize, SteamID *pSteamIDUser);
virtual SteamID CreateUnauthenticatedUserConnection();
virtual void SendUserDisconnect(SteamID steamIDUser);
virtual bool UpdateUserData(SteamID 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(SteamID steamID, const char *pchAchievementName);
virtual void GetGameplayStats();
virtual bool RequestUserGroupStatus(SteamID steamIDUser, SteamID steamIDGroup);
virtual unsigned int GetPublicIP();
virtual void SetGameData(const char *pchGameData);
virtual int UserHasLicenseForApp(SteamID steamID, unsigned int appID);
};
}

View File

@ -0,0 +1,67 @@
#include "..\..\STDInclude.hpp"
namespace Steam
{
void MasterServerUpdater::SetActive(bool bActive)
{
}
void MasterServerUpdater::SetHeartbeatInterval(int iHeartbeatInterval)
{
}
bool MasterServerUpdater::HandleIncomingPacket(const void *pData, int cbData, unsigned int srcIP, unsigned short srcPort)
{
return true;
}
int MasterServerUpdater::GetNextOutgoingPacket(void *pOut, int cbMaxOut, unsigned int *pNetAdr, unsigned short *pPort)
{
return 0;
}
void MasterServerUpdater::SetBasicServerData(unsigned short nProtocolVersion, bool bDedicatedServer, const char *pRegionName, const char *pProductName, unsigned short nMaxReportedClients, bool bPasswordProtected, const char *pGameDescription)
{
}
void MasterServerUpdater::ClearAllKeyValues()
{
}
void MasterServerUpdater::SetKeyValue(const char *pKey, const char *pValue)
{
}
void MasterServerUpdater::NotifyShutdown()
{
}
bool MasterServerUpdater::WasRestartRequested()
{
return false;
}
void MasterServerUpdater::ForceHeartbeat()
{
}
bool MasterServerUpdater::AddMasterServer(const char *pServerAddress)
{
return true;
}
bool MasterServerUpdater::RemoveMasterServer(const char *pServerAddress)
{
return true;
}
int MasterServerUpdater::GetNumMasterServers()
{
return 0;
}
int MasterServerUpdater::GetMasterServerAddress(int iServer, char *pOut, int outBufferSize)
{
return 0;
}
}

View File

@ -0,0 +1,21 @@
namespace Steam
{
class MasterServerUpdater
{
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);
};
}

View File

@ -0,0 +1,193 @@
#include "..\..\STDInclude.hpp"
namespace Steam
{
int Matchmaking::GetFavoriteGameCount()
{
return 0;
}
bool Matchmaking::GetFavoriteGame(int iGame, unsigned int *pnAppID, unsigned int *pnIP, unsigned short *pnConnPort, unsigned short *pnQueryPort, unsigned int *punFlags, unsigned int *pRTime32LastPlayedOnServer)
{
return false;
}
int Matchmaking::AddFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort, unsigned short nQueryPort, unsigned int unFlags, unsigned int rTime32LastPlayedOnServer)
{
return 0;
}
bool Matchmaking::RemoveFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort, unsigned short nQueryPort, unsigned int unFlags)
{
return false;
}
unsigned __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)
{
}
SteamID Matchmaking::GetLobbyByIndex(int iLobby)
{
return SteamID();
}
unsigned __int64 Matchmaking::CreateLobby(int eLobbyType, int cMaxMembers)
{
uint64_t result = Callbacks::RegisterCall();
LobbyCreated* retvals = new LobbyCreated;
SteamID id;
id.AccountID = 1337132;
id.Universe = 1;
id.AccountType = 8;
id.AccountInstance = 0x40000;
retvals->m_eResult = 1;
retvals->m_ulSteamIDLobby = id;
Callbacks::ReturnCall(retvals, sizeof(LobbyCreated), LobbyCreated::CallbackID, result);
Matchmaking::JoinLobby(id);
return result;
}
unsigned __int64 Matchmaking::JoinLobby(SteamID steamIDLobby)
{
uint64_t result = Callbacks::RegisterCall();
LobbyEnter* retvals = new LobbyEnter;
retvals->m_bLocked = false;
retvals->m_EChatRoomEnterResponse = 1;
retvals->m_rgfChatPermissions = 0xFFFFFFFF;
retvals->m_ulSteamIDLobby = steamIDLobby;
Callbacks::ReturnCall(retvals, sizeof(LobbyEnter), LobbyEnter::CallbackID, result);
return result;
}
void Matchmaking::LeaveLobby(SteamID steamIDLobby)
{
Components::Party::RemoveLobby(steamIDLobby);
}
bool Matchmaking::InviteUserToLobby(SteamID steamIDLobby, SteamID steamIDInvitee)
{
return true;
}
int Matchmaking::GetNumLobbyMembers(SteamID steamIDLobby)
{
return 1;
}
SteamID Matchmaking::GetLobbyMemberByIndex(SteamID steamIDLobby, int iMember)
{
return SteamUser()->GetSteamID();
}
const char *Matchmaking::GetLobbyData(SteamID steamIDLobby, const char *pchKey)
{
return Components::Party::GetLobbyInfo(steamIDLobby, pchKey);
}
bool Matchmaking::SetLobbyData(SteamID steamIDLobby, const char *pchKey, const char *pchValue)
{
return true;
}
int Matchmaking::GetLobbyDataCount(SteamID steamIDLobby)
{
return 0;
}
bool Matchmaking::GetLobbyDataByIndex(SteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize)
{
return false;
}
bool Matchmaking::DeleteLobbyData(SteamID steamIDLobby, const char *pchKey)
{
return false;
}
const char *Matchmaking::GetLobbyMemberData(SteamID steamIDLobby, SteamID steamIDUser, const char *pchKey)
{
return "";
}
void Matchmaking::SetLobbyMemberData(SteamID steamIDLobby, const char *pchKey, const char *pchValue)
{
}
bool Matchmaking::SendLobbyChatMsg(SteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody)
{
return true;
}
int Matchmaking::GetLobbyChatEntry(SteamID steamIDLobby, int iChatID, SteamID *pSteamIDUser, void *pvData, int cubData, int *peChatEntryType)
{
return 0;
}
bool Matchmaking::RequestLobbyData(SteamID steamIDLobby)
{
return false;
}
void Matchmaking::SetLobbyGameServer(SteamID steamIDLobby, unsigned int unGameServerIP, unsigned short unGameServerPort, SteamID steamIDGameServer)
{
}
bool Matchmaking::GetLobbyGameServer(SteamID steamIDLobby, unsigned int *punGameServerIP, unsigned short *punGameServerPort, SteamID *psteamIDGameServer)
{
return false;
}
bool Matchmaking::SetLobbyMemberLimit(SteamID steamIDLobby, int cMaxMembers)
{
return true;
}
int Matchmaking::GetLobbyMemberLimit(SteamID steamIDLobby)
{
return 0;
}
bool Matchmaking::SetLobbyType(SteamID steamIDLobby, int eLobbyType)
{
return true;
}
bool Matchmaking::SetLobbyJoinable(SteamID steamIDLobby, bool bLobbyJoinable)
{
return true;
}
SteamID Matchmaking::GetLobbyOwner(SteamID steamIDLobby)
{
return SteamUser()->GetSteamID();
}
bool Matchmaking::SetLobbyOwner(SteamID steamIDLobby, SteamID steamIDNewOwner)
{
return true;
}
}

View File

@ -0,0 +1,60 @@
namespace Steam
{
struct LobbyCreated
{
enum { CallbackID = 513 };
int m_eResult;
int m_pad;
SteamID m_ulSteamIDLobby;
};
struct LobbyEnter
{
enum { CallbackID = 504 };
SteamID m_ulSteamIDLobby;
int m_rgfChatPermissions;
bool m_bLocked;
int m_EChatRoomEnterResponse;
};
class Matchmaking
{
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 SteamID GetLobbyByIndex(int iLobby);
virtual unsigned __int64 CreateLobby(int eLobbyType, int cMaxMembers);
virtual unsigned __int64 JoinLobby(SteamID steamIDLobby);
virtual void LeaveLobby(SteamID steamIDLobby);
virtual bool InviteUserToLobby(SteamID steamIDLobby, SteamID steamIDInvitee);
virtual int GetNumLobbyMembers(SteamID steamIDLobby);
virtual SteamID GetLobbyMemberByIndex(SteamID steamIDLobby, int iMember);
virtual const char *GetLobbyData(SteamID steamIDLobby, const char *pchKey);
virtual bool SetLobbyData(SteamID steamIDLobby, const char *pchKey, const char *pchValue);
virtual int GetLobbyDataCount(SteamID steamIDLobby);
virtual bool GetLobbyDataByIndex(SteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize);
virtual bool DeleteLobbyData(SteamID steamIDLobby, const char *pchKey);
virtual const char *GetLobbyMemberData(SteamID steamIDLobby, SteamID steamIDUser, const char *pchKey);
virtual void SetLobbyMemberData(SteamID steamIDLobby, const char *pchKey, const char *pchValue);
virtual bool SendLobbyChatMsg(SteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody);
virtual int GetLobbyChatEntry(SteamID steamIDLobby, int iChatID, SteamID *pSteamIDUser, void *pvData, int cubData, int *peChatEntryType);
virtual bool RequestLobbyData(SteamID steamIDLobby);
virtual void SetLobbyGameServer(SteamID steamIDLobby, unsigned int unGameServerIP, unsigned short unGameServerPort, SteamID steamIDGameServer);
virtual bool GetLobbyGameServer(SteamID steamIDLobby, unsigned int *punGameServerIP, unsigned short *punGameServerPort, SteamID *psteamIDGameServer);
virtual bool SetLobbyMemberLimit(SteamID steamIDLobby, int cMaxMembers);
virtual int GetLobbyMemberLimit(SteamID steamIDLobby);
virtual bool SetLobbyType(SteamID steamIDLobby, int eLobbyType);
virtual bool SetLobbyJoinable(SteamID steamIDLobby, bool bLobbyJoinable);
virtual SteamID GetLobbyOwner(SteamID steamIDLobby);
virtual bool SetLobbyOwner(SteamID steamIDLobby, SteamID steamIDNewOwner);
};
}

View File

@ -0,0 +1,104 @@
#include "..\..\STDInclude.hpp"
namespace Steam
{
bool Networking::SendP2PPacket(SteamID steamIDRemote, const void *pubData, unsigned int cubData, int eP2PSendType)
{
return false;
}
bool Networking::IsP2PPacketAvailable(unsigned int *pcubMsgSize)
{
return false;
}
bool Networking::ReadP2PPacket(void *pubDest, unsigned int cubDest, unsigned int *pcubMsgSize, SteamID *psteamIDRemote)
{
return false;
}
bool Networking::AcceptP2PSessionWithUser(SteamID steamIDRemote)
{
return false;
}
bool Networking::CloseP2PSessionWithUser(SteamID steamIDRemote)
{
return false;
}
bool Networking::GetP2PSessionState(SteamID steamIDRemote, void *pConnectionState)
{
return false;
}
unsigned int Networking::CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort, bool bAllowUseOfPacketRelay)
{
return NULL;
}
unsigned int Networking::CreateP2PConnectionSocket(SteamID 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, SteamID *pSteamIDRemote, int *peSocketStatus, unsigned int *punIPRemote, unsigned short *punPortRemote)
{
return false;
}
bool Networking::GetListenSocketInfo(unsigned int hListenSocket, unsigned int *pnIP, unsigned short *pnPort)
{
return false;
}
int Networking::GetSocketConnectionType(unsigned int hSocket)
{
return 0;
}
int Networking::GetMaxPacketSize(unsigned int hSocket)
{
return 0;
}
}

View File

@ -0,0 +1,27 @@
namespace Steam
{
class Networking
{
public:
virtual bool SendP2PPacket(SteamID steamIDRemote, const void *pubData, unsigned int cubData, int eP2PSendType);
virtual bool IsP2PPacketAvailable(unsigned int *pcubMsgSize);
virtual bool ReadP2PPacket(void *pubDest, unsigned int cubDest, unsigned int *pcubMsgSize, SteamID *psteamIDRemote);
virtual bool AcceptP2PSessionWithUser(SteamID steamIDRemote);
virtual bool CloseP2PSessionWithUser(SteamID steamIDRemote);
virtual bool GetP2PSessionState(SteamID steamIDRemote, void *pConnectionState);
virtual unsigned int CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort, bool bAllowUseOfPacketRelay);
virtual unsigned int CreateP2PConnectionSocket(SteamID 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, SteamID *pSteamIDRemote, int *peSocketStatus, unsigned int *punIPRemote, unsigned short *punPortRemote);
virtual bool GetListenSocketInfo(unsigned int hListenSocket, unsigned int *pnIP, unsigned short *pnPort);
virtual int GetSocketConnectionType(unsigned int hSocket);
virtual int GetMaxPacketSize(unsigned int hSocket);
};
}

View File

@ -0,0 +1,43 @@
#include "..\..\STDInclude.hpp"
namespace Steam
{
bool RemoteStorage::FileWrite(const char *pchFile, const void *pvData, int cubData)
{
return true;
}
int RemoteStorage::GetFileSize(const char *pchFile)
{
return 0;
}
int RemoteStorage::FileRead(const char *pchFile, void *pvData, int cubDataToRead)
{
OutputDebugStringA(pchFile);
return 0;
}
bool RemoteStorage::FileExists(const char *pchFile)
{
return false;
}
int RemoteStorage::GetFileCount()
{
return 0;
}
const char *RemoteStorage::GetFileNameAndSize(int iFile, int *pnFileSizeInBytes)
{
*pnFileSizeInBytes = 0;
return "";
}
bool RemoteStorage::GetQuota(int *pnTotalBytes, int *puAvailableBytes)
{
*pnTotalBytes = 0x10000000;
*puAvailableBytes = 0x10000000;
return false;
}
}

View File

@ -0,0 +1,14 @@
namespace Steam
{
class RemoteStorage
{
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);
};
}

View File

@ -0,0 +1,106 @@
#include "..\..\STDInclude.hpp"
namespace Steam
{
int User::GetHSteamUser()
{
return NULL;
}
bool User::LoggedOn()
{
return true;
}
SteamID User::GetSteamID()
{
static int subId = 0;
SteamID id;
if (!subId)
{
if (Components::Dedicated::IsDedicated()) // Dedi guid
{
subId = ~0xDED1CADE;
}
else if (Components::Singleton::IsFirstInstance()) // Hardware guid
{
DATA_BLOB Data[2];
Data[0].pbData = (BYTE *)"AAAAAAAAAA";
Data[0].cbData = 10;
CryptProtectData(&Data[0], NULL, NULL, NULL, NULL, CRYPTPROTECT_LOCAL_MACHINE, &Data[1]);
subId = ::Utils::OneAtATime((char*)Data[1].pbData, 52);
}
else // Random guid
{
subId = (Game::Com_Milliseconds() + timeGetTime());
}
}
id.Bits = 0x110000100000000 | subId;
return id;
}
int User::InitiateGameConnection(void *pAuthBlob, int cbMaxAuthBlob, SteamID steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer, bool bSecure)
{
// TODO: Generate auth ticket!
return 0;
}
void User::TerminateGameConnection(unsigned int unIPServer, unsigned short usPortServer)
{
}
void User::TrackAppUsageEvent(SteamID gameID, int eAppUsageEvent, const char *pchExtraInfo)
{
}
bool User::GetUserDataFolder(char *pchBuffer, int cubBuffer)
{
return false;
}
void User::StartVoiceRecording()
{
}
void User::StopVoiceRecording()
{
}
int User::GetCompressedVoice(void *pDestBuffer, unsigned int cbDestBufferSize, unsigned int *nBytesWritten)
{
return 0;
}
int User::DecompressVoice(void *pCompressed, unsigned int cbCompressed, void *pDestBuffer, unsigned int cbDestBufferSize, unsigned int *nBytesWritten)
{
return 0;
}
unsigned int User::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket)
{
return 0;
}
int User::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, SteamID steamID)
{
return 0;
}
void User::EndAuthSession(SteamID steamID)
{
}
void User::CancelAuthTicket(unsigned int hAuthTicket)
{
}
unsigned int User::UserHasLicenseForApp(SteamID steamID, unsigned int appID)
{
return 1;
}
}

View File

@ -0,0 +1,24 @@
namespace Steam
{
class User
{
public:
virtual int GetHSteamUser();
virtual bool LoggedOn();
virtual SteamID GetSteamID();
virtual int InitiateGameConnection(void *pAuthBlob, int cbMaxAuthBlob, SteamID steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer, bool bSecure);
virtual void TerminateGameConnection(unsigned int unIPServer, unsigned short usPortServer);
virtual void TrackAppUsageEvent(SteamID gameID, int eAppUsageEvent, const char *pchExtraInfo = "");
virtual bool GetUserDataFolder(char *pchBuffer, int cubBuffer);
virtual void StartVoiceRecording();
virtual void StopVoiceRecording();
virtual int GetCompressedVoice(void *pDestBuffer, unsigned int cbDestBufferSize, unsigned int *nBytesWritten);
virtual int DecompressVoice(void *pCompressed, unsigned int cbCompressed, void *pDestBuffer, unsigned int cbDestBufferSize, unsigned int *nBytesWritten);
virtual unsigned int GetAuthSessionTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket);
virtual int BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, SteamID steamID);
virtual void EndAuthSession(SteamID steamID);
virtual void CancelAuthTicket(unsigned int hAuthTicket);
virtual unsigned int UserHasLicenseForApp(SteamID steamID, unsigned int appID);
};
}

View File

@ -0,0 +1,96 @@
#include "..\..\STDInclude.hpp"
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 10190;
}
void Utils::SetOverlayNotificationPosition(int 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;
}
}

View File

@ -0,0 +1,26 @@
namespace Steam
{
class Utils
{
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();
};
}

166
src/Steam/Steam.cpp Normal file
View File

@ -0,0 +1,166 @@
#include "..\STDInclude.hpp"
#include "Steam.hpp"
namespace Steam
{
uint64_t Callbacks::CallID = 0;
std::map<uint64_t, bool> Callbacks::Calls;
std::map<uint64_t, Callbacks::Base*> Callbacks::ResultHandlers;
std::vector<Callbacks::Result> Callbacks::Results;
std::vector<Callbacks::Base*> Callbacks::CallbackList;
uint64_t Callbacks::RegisterCall()
{
Callbacks::Calls[Callbacks::CallID] = false;
return Callbacks::CallID++;
}
void Callbacks::RegisterCallback(Callbacks::Base* handler, int callback)
{
handler->SetICallback(callback);
Callbacks::CallbackList.push_back(handler);
}
void Callbacks::RegisterCallResult(uint64_t call, Callbacks::Base* result)
{
Callbacks::ResultHandlers[call] = result;
}
void Callbacks::ReturnCall(void* data, int size, int type, uint64_t call)
{
Callbacks::Result result;
Callbacks::Calls[call] = true;
result.call = call;
result.data = data;
result.size = size;
result.type = type;
Callbacks::Results.push_back(result);
}
void Callbacks::RunCallbacks()
{
for (auto result : Callbacks::Results)
{
if (Callbacks::ResultHandlers.find(result.call) != Callbacks::ResultHandlers.end())
{
Callbacks::ResultHandlers[result.call]->Run(result.data, false, result.call);
}
for (auto callback : Callbacks::CallbackList)
{
if (callback && callback->GetICallback() == result.type)
{
callback->Run(result.data, false, 0);
}
}
if (result.data)
{
delete[] result.data;
}
}
Callbacks::Results.clear();
}
extern "C"
{
bool SteamAPI_Init()
{
return true;
}
void SteamAPI_RegisterCallResult(Callbacks::Base* result, uint64_t call)
{
Callbacks::RegisterCallResult(call, result);
}
void SteamAPI_RegisterCallback(Callbacks::Base* handler, int callback)
{
Callbacks::RegisterCallback(handler, callback);
}
void SteamAPI_RunCallbacks()
{
Callbacks::RunCallbacks();
}
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 iFriends;
return &iFriends;
}
Steam::Matchmaking* SteamMatchmaking()
{
static Steam::Matchmaking iMatchmaking;
return &iMatchmaking;
}
Steam::GameServer* SteamGameServer()
{
static Steam::GameServer iGameServer;
return &iGameServer;
}
Steam::MasterServerUpdater* SteamMasterServerUpdater()
{
static Steam::MasterServerUpdater iMasterServerUpdater;
return &iMasterServerUpdater;
}
Steam::Networking* SteamNetworking()
{
static Steam::Networking iNetworking;
return &iNetworking;
}
Steam::RemoteStorage* SteamRemoteStorage()
{
static Steam::RemoteStorage iRemoteStorage;
return &iRemoteStorage;
}
Steam::User* SteamUser()
{
static Steam::User iUser;
return &iUser;
}
Steam::Utils* SteamUtils()
{
static Steam::Utils iUtils;
return &iUtils;
}
}
}

91
src/Steam/Steam.hpp Normal file
View File

@ -0,0 +1,91 @@
#pragma once
#define STEAM_EXPORT extern "C" __declspec(dllexport)
typedef union
{
struct
{
unsigned int AccountID : 32;
unsigned int AccountInstance : 20;
unsigned int AccountType : 4;
int Universe : 8;
};
unsigned long long Bits;
} SteamID;
#include "Interfaces\SteamUser.hpp"
#include "Interfaces\SteamUtils.hpp"
#include "Interfaces\SteamFriends.hpp"
#include "Interfaces\SteamGameServer.hpp"
#include "Interfaces\SteamNetworking.hpp"
#include "Interfaces\SteamMatchmaking.hpp"
#include "Interfaces\SteamRemoteStorage.hpp"
#include "Interfaces\SteamMasterServerUpdater.hpp"
namespace Steam
{
class Callbacks
{
public:
class Base
{
public:
Base() : Flags(0), Callback(0) {};
virtual void Run(void *pvParam) = 0;
virtual void Run(void *pvParam, bool bIOFailure, uint64_t hSteamAPICall) = 0;
virtual int GetCallbackSizeBytes() = 0;
int GetICallback() { return Callback; }
void SetICallback(int iCallback) { Callback = iCallback; }
protected:
unsigned char Flags;
int Callback;
};
struct Result
{
void* data;
int size;
int type;
uint64_t call;
};
static uint64_t RegisterCall();
static void RegisterCallback(Base* handler, int callback);
static void RegisterCallResult(uint64_t call, Base* result);
static void ReturnCall(void* data, int size, int type, uint64_t call);
static void RunCallbacks();
private:
static uint64_t CallID;
static std::map<uint64_t, bool> Calls;
static std::map<uint64_t, Base*> ResultHandlers;
static std::vector<Result> Results;
static std::vector<Base*> CallbackList;
};
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::GameServer* SteamGameServer();
STEAM_EXPORT Steam::MasterServerUpdater* SteamMasterServerUpdater();
STEAM_EXPORT Steam::Networking* SteamNetworking();
STEAM_EXPORT Steam::RemoteStorage* SteamRemoteStorage();
STEAM_EXPORT Steam::User* SteamUser();
STEAM_EXPORT Steam::Utils* SteamUtils();
}