diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..130a33a --- /dev/null +++ b/.gitignore @@ -0,0 +1,150 @@ +### Windows + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Shortcuts +*.lnk + +### OSX + +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Visual Studio + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +build + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +### IDA +*.id0 +*.id1 +*.id2 +*.nam +*.til + +### Custom user files +# User scripts +user*.bat + +# Premake binary +#premake5.exe \ No newline at end of file diff --git a/generate.bat b/generate.bat new file mode 100644 index 0000000..d745a2e --- /dev/null +++ b/generate.bat @@ -0,0 +1,3 @@ +@echo off +git submodule update --init --recursive +tools\premake5 %* vs2017 \ No newline at end of file diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 0000000..4635b57 --- /dev/null +++ b/premake5.lua @@ -0,0 +1,72 @@ +workspace "open-mw3" + location "./build" + objdir "%{wks.location}/obj" + targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}" + + configurations { + "Debug", + "Release", + } + + architecture "x32" + platforms "x32" + + buildoptions "/std:c++latest" + systemversion "latest" + symbols "On" + staticruntime "On" + warnings "Extra" + + configuration "windows" + defines { + "_WINDOWS", + "WIN32", + } + + configuration "Release" + optimize "Full" + + defines { + "NDEBUG", + } + + flags { + "MultiProcessorCompile", + "LinkTimeOptimization", + "FatalCompileWarnings", + } + + configuration "Debug" + optimize "Debug" + + defines { + "DEBUG", + "_DEBUG", + } + + flags { + "MultiProcessorCompile", + } + + configuration {} + + project "open-mw3" + kind "SharedLib" + language "C++" + + pchheader "std_include.hpp" + pchsource "src/std_include.cpp" + + files { + "./src/**.rc", + "./src/**.hpp", + "./src/**.cpp" + } + + includedirs { + "./src" + } + + resincludedirs { + "$(ProjectDir)src" + } diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..0466143 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,28 @@ +#include + +namespace main +{ + void initialize() + { + + } + + void uninitialize() + { + + } +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + if (ul_reason_for_call == DLL_PROCESS_ATTACH) + { + main::initialize(); + } + else if (ul_reason_for_call == DLL_PROCESS_DETACH) + { + main::uninitialize(); + } + + return TRUE; +} diff --git a/src/resource.rc b/src/resource.rc new file mode 100644 index 0000000..817486b --- /dev/null +++ b/src/resource.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "windows.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "#include ""windows.h""\r\n" + "\0" +END + +2 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "momo5502" +#ifdef _DEBUG + VALUE "FileDescription", "Open-IW5 (DEBUG)" +#else + VALUE "FileDescription", "Open-IW5" +#endif + VALUE "FileVersion", "1.0.0.0" + VALUE "InternalName", "Open-IW5" + VALUE "LegalCopyright", "All rights reserved." + VALUE "OriginalFilename", "oiw5.dll" + VALUE "ProductName", "oiw5" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/std_include.cpp b/src/std_include.cpp new file mode 100644 index 0000000..3306de2 --- /dev/null +++ b/src/std_include.cpp @@ -0,0 +1 @@ +#include diff --git a/src/std_include.hpp b/src/std_include.hpp new file mode 100644 index 0000000..1a53d23 --- /dev/null +++ b/src/std_include.hpp @@ -0,0 +1,12 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN + +#include + +#include +#include + +#pragma warning(disable: 4100) + +#include "steam\Steam.hpp" diff --git a/src/steam/Interfaces/SteamApps.cpp b/src/steam/Interfaces/SteamApps.cpp new file mode 100644 index 0000000..a191c90 --- /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..643076d --- /dev/null +++ b/src/steam/Interfaces/SteamApps.hpp @@ -0,0 +1,21 @@ +namespace Steam +{ + class Apps + { + 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..de3ca50 --- /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; + } + + 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 ""; + } + + 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"; + } + + const char *Friends::GetClanTag(SteamID steamIDClan) + { + return this->GetClanName(steamIDClan); + } + + 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) + { + OutputDebugStringA("Store requested!"); + } + + void Friends::SetPlayedWith(SteamID steamIDUserPlayedWith) + { + } + + void Friends::ActivateGameOverlayInviteDialog(SteamID steamIDLobby) + { + } + + int Friends::GetSmallFriendAvatar(SteamID steamIDFriend) + { + return 0; + } + + int Friends::GetMediumFriendAvatar(SteamID steamIDFriend) + { + return 0; + } + + int Friends::GetLargeFriendAvatar(SteamID steamIDFriend) + { + return 0; + } + + bool Friends::RequestUserInformation(SteamID steamIDUser, bool bRequireNameOnly) + { + return false; + } + + unsigned __int64 Friends::RequestClanOfficerList(SteamID steamIDClan) + { + return 0; + } + + SteamID Friends::GetClanOwner(SteamID steamIDClan) + { + return SteamID(); + } + + int Friends::GetClanOfficerCount(SteamID steamIDClan) + { + return 0; + } + + SteamID Friends::GetClanOfficerByIndex(SteamID steamIDClan, int iOfficer) + { + return SteamID(); + } + + int Friends::GetUserRestrictions() + { + return 0; + } + + bool Friends::SetRichPresence(const char *pchKey, const char *pchValue) + { + return true; + } + + void Friends::ClearRichPresence() + { + } + + const char *Friends::GetFriendRichPresence(SteamID steamIDFriend, const char *pchKey) + { + return ""; + } + + int Friends::GetFriendRichPresenceKeyCount(SteamID steamIDFriend) + { + return 0; + } + + const char *Friends::GetFriendRichPresenceKeyByIndex(SteamID steamIDFriend, int iKey) + { + return "a"; + } + + bool Friends::InviteUserToGame(SteamID steamIDFriend, const char *pchConnectString) + { + return false; + } + + int Friends::GetCoplayFriendCount() + { + return 0; + } + + SteamID Friends::GetCoplayFriend(int iCoplayFriend) + { + return SteamID(); + } + + int Friends::GetFriendCoplayTime(SteamID steamIDFriend) + { + return 0; + } + + unsigned int Friends::GetFriendCoplayGame(SteamID steamIDFriend) + { + return 0; + } +} diff --git a/src/steam/Interfaces/SteamFriends.hpp b/src/steam/Interfaces/SteamFriends.hpp new file mode 100644 index 0000000..d8c34d5 --- /dev/null +++ b/src/steam/Interfaces/SteamFriends.hpp @@ -0,0 +1,51 @@ +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 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 const char *GetClanTag(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); + virtual void ActivateGameOverlayInviteDialog(SteamID steamIDLobby); + virtual int GetSmallFriendAvatar(SteamID steamIDFriend); + virtual int GetMediumFriendAvatar(SteamID steamIDFriend); + virtual int GetLargeFriendAvatar(SteamID steamIDFriend); + virtual bool RequestUserInformation(SteamID steamIDUser, bool bRequireNameOnly); + virtual unsigned __int64 RequestClanOfficerList(SteamID steamIDClan); + virtual SteamID GetClanOwner(SteamID steamIDClan); + virtual int GetClanOfficerCount(SteamID steamIDClan); + virtual SteamID GetClanOfficerByIndex(SteamID steamIDClan, int iOfficer); + virtual int GetUserRestrictions(); + virtual bool SetRichPresence(const char *pchKey, const char *pchValue); + virtual void ClearRichPresence(); + virtual const char *GetFriendRichPresence(SteamID steamIDFriend, const char *pchKey); + virtual int GetFriendRichPresenceKeyCount(SteamID steamIDFriend); + virtual const char *GetFriendRichPresenceKeyByIndex(SteamID steamIDFriend, int iKey); + virtual bool InviteUserToGame(SteamID steamIDFriend, const char *pchConnectString); + virtual int GetCoplayFriendCount(); + virtual SteamID GetCoplayFriend(int iCoplayFriend); + virtual int GetFriendCoplayTime(SteamID steamIDFriend); + virtual unsigned int GetFriendCoplayGame(SteamID steamIDFriend); + }; +} diff --git a/src/steam/Interfaces/SteamGameServer.cpp b/src/steam/Interfaces/SteamGameServer.cpp new file mode 100644 index 0000000..d6a7cdf --- /dev/null +++ b/src/steam/Interfaces/SteamGameServer.cpp @@ -0,0 +1,96 @@ +#include + +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() + { + } + + unsigned __int64 GameServer::GetServerReputation() + { + return 0; + } + + 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; + } +} diff --git a/src/steam/Interfaces/SteamGameServer.hpp b/src/steam/Interfaces/SteamGameServer.hpp new file mode 100644 index 0000000..909ba08 --- /dev/null +++ b/src/steam/Interfaces/SteamGameServer.hpp @@ -0,0 +1,27 @@ +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 unsigned __int64 GetServerReputation(); + 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); + }; +} diff --git a/src/steam/Interfaces/SteamMasterServerUpdater.cpp b/src/steam/Interfaces/SteamMasterServerUpdater.cpp new file mode 100644 index 0000000..fa6c872 --- /dev/null +++ b/src/steam/Interfaces/SteamMasterServerUpdater.cpp @@ -0,0 +1,67 @@ +#include + +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; + } +} diff --git a/src/steam/Interfaces/SteamMasterServerUpdater.hpp b/src/steam/Interfaces/SteamMasterServerUpdater.hpp new file mode 100644 index 0000000..4ded5df --- /dev/null +++ b/src/steam/Interfaces/SteamMasterServerUpdater.hpp @@ -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); + }; +} diff --git a/src/steam/Interfaces/SteamMatchmaking.cpp b/src/steam/Interfaces/SteamMatchmaking.cpp new file mode 100644 index 0000000..9557bf7 --- /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) + { + } + + SteamID Matchmaking::GetLobbyByIndex(int iLobby) + { + return SteamID(); + } + + unsigned __int64 Matchmaking::CreateLobby(int eLobbyType, int cMaxMembers) + { + uint64_t result = Callbacks::RegisterCall(); + LobbyCreated* retvals = (LobbyCreated*)calloc(1, sizeof(LobbyCreated));//::Utils::Memory::AllocateArray(); + 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 = (LobbyEnter*)calloc(1, sizeof(LobbyEnter));//::Utils::Memory::AllocateArray(); + 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 "212";//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; + } +} diff --git a/src/steam/Interfaces/SteamMatchmaking.hpp b/src/steam/Interfaces/SteamMatchmaking.hpp new file mode 100644 index 0000000..6d91445 --- /dev/null +++ b/src/steam/Interfaces/SteamMatchmaking.hpp @@ -0,0 +1,62 @@ +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 void AddRequestLobbyListDistanceFilter(int eLobbyDistanceFilter); + virtual void AddRequestLobbyListResultCountFilter(int cMaxResults); + 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); + }; +} diff --git a/src/steam/Interfaces/SteamMatchmakingServers.cpp b/src/steam/Interfaces/SteamMatchmakingServers.cpp new file mode 100644 index 0000000..08741e2 --- /dev/null +++ b/src/steam/Interfaces/SteamMatchmakingServers.cpp @@ -0,0 +1,84 @@ +#include + +namespace Steam +{ + void* MatchmakingServers::RequestInternetServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* MatchmakingServers::RequestLANServerList(unsigned int iApp, void *pRequestServersResponse) + { + return nullptr; + } + + void* MatchmakingServers::RequestFriendsServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* MatchmakingServers::RequestFavoritesServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* MatchmakingServers::RequestHistoryServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void* MatchmakingServers::RequestSpectatorServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + { + return nullptr; + } + + void MatchmakingServers::ReleaseRequest(void* hServerListRequest) + { + } + + void *MatchmakingServers::GetServerDetails(void* hRequest, int iServer) + { + return nullptr; + } + + void MatchmakingServers::CancelQuery(void* hRequest) + { + } + + void MatchmakingServers::RefreshQuery(void* hRequest) + { + } + + bool MatchmakingServers::IsRefreshing(void* hRequest) + { + return false; + } + + int MatchmakingServers::GetServerCount(void* hRequest) + { + return 0; + } + + void MatchmakingServers::RefreshServer(void* hRequest, int iServer) + { + } + + int MatchmakingServers::PingServer(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + { + return 0; + } + + int MatchmakingServers::PlayerDetails(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + { + return 0; + } + + int MatchmakingServers::ServerRules(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + { + return 0; + } + + void MatchmakingServers::CancelServerQuery(int hServerQuery) + { + } +} diff --git a/src/steam/Interfaces/SteamMatchmakingServers.hpp b/src/steam/Interfaces/SteamMatchmakingServers.hpp new file mode 100644 index 0000000..d3918ca --- /dev/null +++ b/src/steam/Interfaces/SteamMatchmakingServers.hpp @@ -0,0 +1,24 @@ +namespace Steam +{ + class MatchmakingServers + { + 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..7786fc5 --- /dev/null +++ b/src/steam/Interfaces/SteamNetworking.cpp @@ -0,0 +1,114 @@ +#include + +namespace Steam +{ + bool Networking::SendP2PPacket(SteamID 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, SteamID *psteamIDRemote) + { + return false; + } + + bool Networking::AcceptP2PSessionWithUser(SteamID steamIDRemote) + { + return false; + } + + bool Networking::CloseP2PSessionWithUser(SteamID steamIDRemote) + { + return false; + } + + bool Networking::CloseP2PChannelWithUser(SteamID steamIDRemote, int iVirtualPort) + { + return false; + } + + bool Networking::GetP2PSessionState(SteamID 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(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; + } +} diff --git a/src/steam/Interfaces/SteamNetworking.hpp b/src/steam/Interfaces/SteamNetworking.hpp new file mode 100644 index 0000000..4f6de67 --- /dev/null +++ b/src/steam/Interfaces/SteamNetworking.hpp @@ -0,0 +1,29 @@ +namespace Steam +{ + class Networking + { + public: + virtual bool SendP2PPacket(SteamID 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, SteamID *psteamIDRemote); + virtual bool AcceptP2PSessionWithUser(SteamID steamIDRemote); + virtual bool CloseP2PSessionWithUser(SteamID steamIDRemote); + virtual bool CloseP2PChannelWithUser(SteamID steamIDRemote, int iVirtualPort); + virtual bool GetP2PSessionState(SteamID 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(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); + }; +} diff --git a/src/steam/Interfaces/SteamRemoteStorage.cpp b/src/steam/Interfaces/SteamRemoteStorage.cpp new file mode 100644 index 0000000..15c9315 --- /dev/null +++ b/src/steam/Interfaces/SteamRemoteStorage.cpp @@ -0,0 +1,43 @@ +#include + +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; + } +} diff --git a/src/steam/Interfaces/SteamRemoteStorage.hpp b/src/steam/Interfaces/SteamRemoteStorage.hpp new file mode 100644 index 0000000..d256541 --- /dev/null +++ b/src/steam/Interfaces/SteamRemoteStorage.hpp @@ -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); + }; +} diff --git a/src/steam/Interfaces/SteamUser.cpp b/src/steam/Interfaces/SteamUser.cpp new file mode 100644 index 0000000..4b057d6 --- /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; + } + + SteamID User::GetSteamID() + { + SteamID id; + id.Bits = 0x110000100000000 | (0x1377 & ~0x80000000); + return id; + } + + int User::InitiateGameConnection(void *pAuthBlob, int cbMaxAuthBlob, SteamID steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer, bool bSecure) + { + 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::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, 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 0; + } + + bool User::BIsBehindNAT() + { + return false; + } + + void User::AdvertiseGame(SteamID 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 + uint64_t result = Callbacks::RegisterCall(); + EncryptedAppTicketResponse* retvals = (EncryptedAppTicketResponse*)calloc(1, sizeof(EncryptedAppTicketResponse));//::Utils::Memory::AllocateArray(); + retvals->m_eResult = 1; + + // Return the call response + Callbacks::ReturnCall(retvals, sizeof(EncryptedAppTicketResponse), EncryptedAppTicketResponse::CallbackID, 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..c956c3b --- /dev/null +++ b/src/steam/Interfaces/SteamUser.hpp @@ -0,0 +1,37 @@ +namespace Steam +{ + struct EncryptedAppTicketResponse + { + enum { CallbackID = 154 }; + + int m_eResult; + }; + + 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 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, SteamID steamID); + virtual void EndAuthSession(SteamID steamID); + virtual void CancelAuthTicket(unsigned int hAuthTicket); + virtual unsigned int UserHasLicenseForApp(SteamID steamID, unsigned int appID); + virtual bool BIsBehindNAT(); + virtual void AdvertiseGame(SteamID 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..cc60a46 --- /dev/null +++ b/src/steam/Interfaces/SteamUserStats.cpp @@ -0,0 +1,209 @@ +#include + +namespace Steam +{ + bool UserStats::RequestCurrentStats() + { + return true; + } + + bool UserStats::GetStat(const char *pchName, int *pData) + { + return false; + } + + bool UserStats::GetStat(const char *pchName, float *pData) + { + return false; + } + + bool UserStats::SetStat(const char *pchName, int nData) + { + return false; + } + + bool UserStats::SetStat(const char *pchName, float fData) + { + return false; + } + + bool UserStats::UpdateAvgRateStat(const char *pchName, float flCountThisSession, double dSessionLength) + { + return false; + } + + bool UserStats::GetAchievement(const char *pchName, bool *pbAchieved) + { + return false; + } + + bool UserStats::SetAchievement(const char *pchName) + { + return false; + } + + bool UserStats::ClearAchievement(const char *pchName) + { + return false; + } + + bool UserStats::GetAchievementAndUnlockTime(const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime) + { + return false; + } + + bool UserStats::StoreStats() + { + return false; + } + + int UserStats::GetAchievementIcon(const char *pchName) + { + return 0; + } + + const char *UserStats::GetAchievementDisplayAttribute(const char *pchName, const char *pchKey) + { + return ""; + } + + bool UserStats::IndicateAchievementProgress(const char *pchName, unsigned int nCurProgress, unsigned int nMaxProgress) + { + return false; + } + + unsigned __int64 UserStats::RequestUserStats(SteamID steamIDUser) + { + return 0; + } + + bool UserStats::GetUserStat(SteamID steamIDUser, const char *pchName, int *pData) + { + return false; + } + + bool UserStats::GetUserStat(SteamID steamIDUser, const char *pchName, float *pData) + { + return false; + } + + bool UserStats::GetUserAchievement(SteamID steamIDUser, const char *pchName, bool *pbAchieved) + { + return false; + } + + bool UserStats::GetUserAchievementAndUnlockTime(SteamID steamIDUser, const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime) + { + return false; + } + + bool UserStats::ResetAllStats(bool bAchievementsToo) + { + return false; + } + + unsigned __int64 UserStats::FindOrCreateLeaderboard(const char *pchLeaderboardName, int eLeaderboardSortMethod, int eLeaderboardDisplayType) + { + return 0; + } + + unsigned __int64 UserStats::FindLeaderboard(const char *pchLeaderboardName) + { + return 0; + } + + const char *UserStats::GetLeaderboardName(unsigned __int64 hSteamLeaderboard) + { + return ""; + } + + int UserStats::GetLeaderboardEntryCount(unsigned __int64 hSteamLeaderboard) + { + return 0; + } + + int UserStats::GetLeaderboardSortMethod(unsigned __int64 hSteamLeaderboard) + { + return 0; + } + + int UserStats::GetLeaderboardDisplayType(unsigned __int64 hSteamLeaderboard) + { + return 0; + } + + unsigned __int64 UserStats::DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, int eLeaderboardDataRequest, int nRangeStart, int nRangeEnd) + { + return 0; + } + + unsigned __int64 UserStats::DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, SteamID *prgUsers, int cUsers) + { + return 0; + } + + bool UserStats::GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, int *pLeaderboardEntry, int *pDetails, int cDetailsMax) + { + return false; + } + + unsigned __int64 UserStats::UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, int eLeaderboardUploadScoreMethod, int nScore, const int *pScoreDetails, int cScoreDetailsCount) + { + return 0; + } + + unsigned __int64 UserStats::AttachLeaderboardUGC(unsigned __int64 hSteamLeaderboard, unsigned __int64 hUGC) + { + return 0; + } + + unsigned __int64 UserStats::GetNumberOfCurrentPlayers() + { + return 0; + } + + unsigned __int64 UserStats::RequestGlobalAchievementPercentages() + { + return 0; + } + + int UserStats::GetMostAchievedAchievementInfo(char *pchName, unsigned int unNameBufLen, float *pflPercent, bool *pbAchieved) + { + return 0; + } + + int UserStats::GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char *pchName, unsigned int unNameBufLen, float *pflPercent, bool *pbAchieved) + { + return 0; + } + + bool UserStats::GetAchievementAchievedPercent(const char *pchName, float *pflPercent) + { + return false; + } + + unsigned __int64 UserStats::RequestGlobalStats(int nHistoryDays) + { + return 0; + } + + bool UserStats::GetGlobalStat(const char *pchStatName, __int64 *pData) + { + return false; + } + + bool UserStats::GetGlobalStat(const char *pchStatName, double *pData) + { + return false; + } + + int UserStats::GetGlobalStatHistory(const char *pchStatName, __int64 *pData, unsigned int cubData) + { + return 0; + } + + int UserStats::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..09c37cb --- /dev/null +++ b/src/steam/Interfaces/SteamUserStats.hpp @@ -0,0 +1,48 @@ +namespace Steam +{ + class UserStats + { + 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(SteamID steamIDUser); + virtual bool GetUserStat(SteamID steamIDUser, const char *pchName, int *pData); + virtual bool GetUserStat(SteamID steamIDUser, const char *pchName, float *pData); + virtual bool GetUserAchievement(SteamID steamIDUser, const char *pchName, bool *pbAchieved); + virtual bool GetUserAchievementAndUnlockTime(SteamID 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, SteamID *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..06cd975 --- /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) + { + FARPROC setPosition = GetProcAddress(Steam::Overlay, "SetNotificationPosition"); + + if (setPosition) + { + ((void(*)(int))setPosition)(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..8472744 --- /dev/null +++ b/src/steam/Interfaces/SteamUtils.hpp @@ -0,0 +1,27 @@ +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(); + 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..79fb3bb --- /dev/null +++ b/src/steam/Steam.cpp @@ -0,0 +1,210 @@ +#include + +namespace Steam +{ + HMODULE Overlay = 0; + + uint64_t Callbacks::CallID = 0; + std::map Callbacks::Calls; + std::map Callbacks::ResultHandlers; + std::vector Callbacks::Results; + std::vector 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) + { + free(result.data); + } + } + + Callbacks::Results.clear(); + } + + extern "C" + { + bool SteamAPI_RestartAppIfNecessary() + { + return false; + } + + bool SteamAPI_Init() + { + Overlay = GetModuleHandleA("gameoverlayrenderer.dll"); + + if (!Overlay) + { + HKEY hRegKey; + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS) + { + char steamPath[MAX_PATH] = { 0 }; + DWORD dwLength = sizeof(steamPath); + RegQueryValueExA(hRegKey, "InstallPath", NULL, NULL, reinterpret_cast(steamPath), &dwLength); + RegCloseKey(hRegKey); + + SetDllDirectoryA(steamPath); + + strcat_s(steamPath, "gameoverlayrenderer.dll"); + + Overlay = LoadLibraryA(steamPath); + } + } + + 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::MatchmakingServers* SteamMatchmakingServers() + { + static Steam::MatchmakingServers iMatchmakingServers; + return &iMatchmakingServers; + } + + 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; + } + + Steam::Apps* SteamApps() + { + static Steam::Apps iApps; + return &iApps; + } + + Steam::UserStats* SteamUserStats() + { + static Steam::UserStats iUserStats; + return &iUserStats; + } + } +} diff --git a/src/steam/Steam.hpp b/src/steam/Steam.hpp new file mode 100644 index 0000000..7ebbfee --- /dev/null +++ b/src/steam/Steam.hpp @@ -0,0 +1,100 @@ +#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\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 *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 Calls; + static std::map ResultHandlers; + static std::vector Results; + static std::vector CallbackList; + }; + + 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::MatchmakingServers* SteamMatchmakingServers(); + 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(); + STEAM_EXPORT Steam::Apps* SteamApps(); + STEAM_EXPORT Steam::UserStats* SteamUserStats(); + + extern HMODULE Overlay; +} diff --git a/tools/premake5.exe b/tools/premake5.exe new file mode 100644 index 0000000..2258499 Binary files /dev/null and b/tools/premake5.exe differ