From 8308b72e960be0e34f5fae1d9542e32b463f45bd Mon Sep 17 00:00:00 2001 From: momo5502 Date: Wed, 26 Dec 2018 16:59:03 +0100 Subject: [PATCH] Reformat code --- premake5.lua | 2 +- src/loader/binary_loader.cpp | 5 +- src/loader/loader.cpp | 17 +- src/loader/loader.hpp | 6 +- src/loader/module.hpp | 15 +- src/loader/module_loader.hpp | 2 +- src/module/ceg.cpp | 85 ++++--- src/module/dw.cpp | 2 +- src/std_include.cpp | 16 +- src/steam/interfaces/apps.cpp | 7 +- src/steam/interfaces/apps.hpp | 7 +- src/steam/interfaces/friends.cpp | 29 ++- src/steam/interfaces/friends.hpp | 28 +-- src/steam/interfaces/game_server.cpp | 18 +- src/steam/interfaces/game_server.hpp | 18 +- .../interfaces/master_server_updater.cpp | 19 +- .../interfaces/master_server_updater.hpp | 16 +- src/steam/interfaces/matchmaking.cpp | 53 +++-- src/steam/interfaces/matchmaking.hpp | 43 ++-- src/steam/interfaces/matchmaking_servers.cpp | 25 +- src/steam/interfaces/matchmaking_servers.hpp | 25 +- src/steam/interfaces/networking.cpp | 32 ++- src/steam/interfaces/networking.hpp | 32 ++- src/steam/interfaces/remote_storage.cpp | 12 +- src/steam/interfaces/remote_storage.hpp | 12 +- src/steam/interfaces/user.cpp | 35 ++- src/steam/interfaces/user.hpp | 26 +- src/steam/interfaces/user_stats.cpp | 70 +++--- src/steam/interfaces/user_stats.hpp | 71 +++--- src/steam/interfaces/utils.cpp | 15 +- src/steam/interfaces/utils.hpp | 17 +- src/steam/steam.cpp | 225 +++++++++--------- src/steam/steam.hpp | 10 +- 33 files changed, 562 insertions(+), 433 deletions(-) diff --git a/premake5.lua b/premake5.lua index 6801347..3f81378 100644 --- a/premake5.lua +++ b/premake5.lua @@ -98,7 +98,7 @@ workspace "open-iw5" pchsource "src/std_include.cpp" linkoptions "/IGNORE:4254 /DYNAMICBASE:NO /SAFESEH:NO /LARGEADDRESSAWARE" - linkoptions "/LAST:.zdata" + linkoptions "/LAST:.main" files { diff --git a/src/loader/binary_loader.cpp b/src/loader/binary_loader.cpp index cd3dcbe..78d56c9 100644 --- a/src/loader/binary_loader.cpp +++ b/src/loader/binary_loader.cpp @@ -36,7 +36,7 @@ namespace binary_loader return {}; } - std::string load_base(bool verify = true) + std::string load_base(const bool verify = true) { std::string data; if (!utils::io::read_file("iw5mp_server.exe", &data)) @@ -87,7 +87,8 @@ namespace binary_loader std::string build_binary(const std::string& base, const std::string& diff) { - const auto* size = reinterpret_cast(diff.data() + diff.size() - sizeof(unsigned long long)); + const auto* size = reinterpret_cast(diff.data() + diff.size() - sizeof(unsigned long + long)); std::string binary; binary.resize(size_t(*size)); diff --git a/src/loader/loader.cpp b/src/loader/loader.cpp index db3a2ce..c89a76b 100644 --- a/src/loader/loader.cpp +++ b/src/loader/loader.cpp @@ -5,7 +5,6 @@ loader::loader(const launcher::mode mode) : mode_(mode) { - } FARPROC loader::load(const utils::nt::module& module) const @@ -22,19 +21,22 @@ FARPROC loader::load(const utils::nt::module& module) const if (source.get_optional_header()->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size) { const IMAGE_TLS_DIRECTORY* target_tls = reinterpret_cast(module.get_ptr() + module - .get_optional_header() - ->DataDirectory + .get_optional_header() + -> + DataDirectory [IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress); const IMAGE_TLS_DIRECTORY* source_tls = reinterpret_cast(module.get_ptr() + source - .get_optional_header() - ->DataDirectory + .get_optional_header() + -> + DataDirectory [IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress); *reinterpret_cast(source_tls->AddressOfIndex) = 0; DWORD old_protect; VirtualProtect(PVOID(target_tls->StartAddressOfRawData), - source_tls->EndAddressOfRawData - source_tls->StartAddressOfRawData, PAGE_READWRITE, &old_protect); + source_tls->EndAddressOfRawData - source_tls->StartAddressOfRawData, PAGE_READWRITE, + &old_protect); const auto tls_base = *reinterpret_cast(__readfsdword(0x2C)); std::memmove(tls_base, PVOID(source_tls->StartAddressOfRawData), @@ -142,7 +144,8 @@ void loader::load_imports(const utils::nt::module& target, const utils::nt::modu if (!function) { - throw std::runtime_error(utils::string::va("Unable to load import '%s' from module '%s'", function_name.data(), name.data())); + throw std::runtime_error(utils::string::va("Unable to load import '%s' from module '%s'", + function_name.data(), name.data())); } *address_table_entry = reinterpret_cast(function); diff --git a/src/loader/loader.hpp b/src/loader/loader.hpp index a57b726..df6b1e0 100644 --- a/src/loader/loader.hpp +++ b/src/loader/loader.hpp @@ -5,7 +5,7 @@ class loader final { public: - loader(launcher::mode mode); + explicit loader(launcher::mode mode); FARPROC load(const utils::nt::module& module) const; @@ -15,8 +15,8 @@ private: launcher::mode mode_; std::function import_resolver_; - static void load_section(const utils::nt::module& target, const utils::nt::module& source, IMAGE_SECTION_HEADER* section); + static void load_section(const utils::nt::module& target, const utils::nt::module& source, + IMAGE_SECTION_HEADER* section); void load_sections(const utils::nt::module& target, const utils::nt::module& source) const; void load_imports(const utils::nt::module& target, const utils::nt::module& source) const; - }; diff --git a/src/loader/module.hpp b/src/loader/module.hpp index 6784585..b3c9a8c 100644 --- a/src/loader/module.hpp +++ b/src/loader/module.hpp @@ -1,10 +1,17 @@ #pragma once -#include "launcher/launcher.hpp" class module { public: - virtual ~module() {}; - virtual void post_load() {} - virtual void pre_destroy() {} + virtual ~module() + { + } + + virtual void post_load() + { + } + + virtual void pre_destroy() + { + } }; diff --git a/src/loader/module_loader.hpp b/src/loader/module_loader.hpp index cf6c8c3..8a877b3 100644 --- a/src/loader/module_loader.hpp +++ b/src/loader/module_loader.hpp @@ -5,7 +5,7 @@ class module_loader final { public: template - class installer + class installer final { static_assert(std::is_base_of::value, "Module has invalid base class"); diff --git a/src/module/ceg.cpp b/src/module/ceg.cpp index f1bc9ea..c71cf69 100644 --- a/src/module/ceg.cpp +++ b/src/module/ceg.cpp @@ -8,59 +8,76 @@ class ceg final : public module public: void post_load() override { - if(game::is_dedi()) return; + if (game::is_dedi()) return; // Remove improper quit check utils::hook::nop(SELECT_VALUE(0x53444A, 0x5CCDC0, 0), 9); // Only SP has CEG // CEG in MP has accidentally been removed due to CVE-2018-10718 - if(!game::is_sp()) return; + if (!game::is_sp()) return; utils::hook::signature signature(0x401000, 0x3E1000); - signature.add({ "\x56\xE8\x00\x00\x00\x00\x8B\xF0\xE8\x00\x00\x00\x00\x50\x56\xE8", "xx????xxx????xxx", [](char* address) - { - utils::hook::set(address, 0xC301B0); - } }); + signature.add({ + "\x56\xE8\x00\x00\x00\x00\x8B\xF0\xE8\x00\x00\x00\x00\x50\x56\xE8", "xx????xxx????xxx", [](char* address) + { + utils::hook::set(address, 0xC301B0); + } + }); // Generic killer caller. - signature.add({ "\x55\x8B\xEC\x80\x7D\x08\x00\x75\x55", "xxxxxx?xx", []( char* address) - { - utils::hook::set(address, 0xC301B0); - } }); + signature.add({ + "\x55\x8B\xEC\x80\x7D\x08\x00\x75\x55", "xxxxxx?xx", [](char* address) + { + utils::hook::set(address, 0xC301B0); + } + }); // CEG initialization. - signature.add({ "\x55\x8B\xEC\x83\xEC\x18\x53\x56\x57\xE8\x00\x00\x00\x00", "xxxxxxxxxx????", [](char* address) - { - utils::hook::set(address, 0xC3); - } }); + signature.add({ + "\x55\x8B\xEC\x83\xEC\x18\x53\x56\x57\xE8\x00\x00\x00\x00", "xxxxxxxxxx????", [](char* address) + { + utils::hook::set(address, 0xC3); + } + }); // Some odd trap. - signature.add({ "\x55\x8B\xEC\x81\xEC\x00\x00\x00\x00\x53\x56\x57\x8B\x3D", "xxxxx??xxxxxxx", [](char* address) - { - utils::hook::set(address, 0xC301B0); - } }); + signature.add({ + "\x55\x8B\xEC\x81\xEC\x00\x00\x00\x00\x53\x56\x57\x8B\x3D", "xxxxx??xxxxxxx", [](char* address) + { + utils::hook::set(address, 0xC301B0); + } + }); // Custom shit - signature.add({ "\x55\x8B\xEC\x68\x00\x00\x00\x00\x68\x00\x00\x00\x00\x64\xFF\x35\x00\x00\x00\x00\x64\x89\x25\x00\x00\x00\x00\xE8", "xxxx????x????xxx????xxx????x", [](char* address) - { - utils::hook::set(address, 0xC3); - } }); + signature.add({ + "\x55\x8B\xEC\x68\x00\x00\x00\x00\x68\x00\x00\x00\x00\x64\xFF\x35\x00\x00\x00\x00\x64\x89\x25\x00\x00\x00\x00\xE8", + "xxxx????x????xxx????xxx????x", [](char* address) + { + utils::hook::set(address, 0xC3); + } + }); // hkcr guid check - signature.add({ "\x55\x8B\xEC\xB8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x84\xC0\x75\x06", "xxxx????x????x????xxxx", [](char* address) - { - utils::hook::nop(address + 0xD, 5); // Call - utils::hook::nop(address + 0x14, 2); // Jump - } }); + signature.add({ + "\x55\x8B\xEC\xB8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x84\xC0\x75\x06", + "xxxx????x????x????xxxx", [](char* address) + { + utils::hook::nop(address + 0xD, 5); // Call + utils::hook::nop(address + 0x14, 2); // Jump + } + }); // hkcr guid check 2 - signature.add({ "\x55\x8B\xEC\x81\xEC\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x84\xC0\x75\x06", "xxxxx????x????xxxx", [](char* address) - { - utils::hook::nop(address + 0x9, 5); // Call - utils::hook::nop(address + 0x10, 2); // Jump - } }); + signature.add({ + "\x55\x8B\xEC\x81\xEC\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x84\xC0\x75\x06", "xxxxx????x????xxxx", [ + ](char* address) + { + utils::hook::nop(address + 0x9, 5); // Call + utils::hook::nop(address + 0x10, 2); // Jump + } + }); signature.process(); @@ -70,9 +87,9 @@ public: // Some value obfuscation utils::hook(0x493B81, 0x493BFC, HOOK_JUMP).install()->quick(); - // Ceg uninit + // CEG uninitialization utils::hook::set(0x527110, 0xC3); } }; -REGISTER_MODULE(ceg) \ No newline at end of file +REGISTER_MODULE(ceg) diff --git a/src/module/dw.cpp b/src/module/dw.cpp index 8a58188..7ce88d9 100644 --- a/src/module/dw.cpp +++ b/src/module/dw.cpp @@ -10,4 +10,4 @@ public: } }; -REGISTER_MODULE(dw) \ No newline at end of file +REGISTER_MODULE(dw) diff --git a/src/std_include.cpp b/src/std_include.cpp index e78138a..2814fcf 100644 --- a/src/std_include.cpp +++ b/src/std_include.cpp @@ -2,17 +2,15 @@ #pragma comment(linker, "/merge:.data=.cld") #pragma comment(linker, "/merge:.rdata=.clr") -#pragma comment(linker, "/merge:.cl=.zdata") -#pragma comment(linker, "/merge:.text=.zdata") -#pragma comment(linker, "/section:.zdata,re") +#pragma comment(linker, "/merge:.cl=.main") +#pragma comment(linker, "/merge:.text=.main") +#pragma comment(linker, "/section:.main,re") #pragma comment(linker, "/base:0x400000") __declspec(thread) char tls_data[0x2000]; -#pragma bss_seg(".cdummy") -char dummy_seg[BINARY_PAYLOAD_SIZE]; +#pragma bss_seg(".payload") +char payload_data[BINARY_PAYLOAD_SIZE]; -char stub_seg[0x100000]; - -#pragma data_seg(".zdata") -char zdata[200] = { 1 }; +#pragma data_seg(".main") +char main_data[200] = {1}; diff --git a/src/steam/interfaces/apps.cpp b/src/steam/interfaces/apps.cpp index 6ed09f5..63d33f6 100644 --- a/src/steam/interfaces/apps.cpp +++ b/src/steam/interfaces/apps.cpp @@ -23,12 +23,12 @@ namespace steam return false; } - const char *apps::GetCurrentGameLanguage() + const char* apps::GetCurrentGameLanguage() { return "english"; } - const char *apps::GetAvailableGameLanguages() + const char* apps::GetAvailableGameLanguages() { return "english"; } @@ -58,7 +58,8 @@ namespace steam return 0; } - bool apps::BGetDLCDataByIndex(int iDLC, unsigned int *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize) + bool apps::BGetDLCDataByIndex(int iDLC, unsigned int* pAppID, bool* pbAvailable, char* pchName, + int cchNameBufferSize) { return false; } diff --git a/src/steam/interfaces/apps.hpp b/src/steam/interfaces/apps.hpp index 123e4df..1400584 100644 --- a/src/steam/interfaces/apps.hpp +++ b/src/steam/interfaces/apps.hpp @@ -9,14 +9,15 @@ namespace steam virtual bool BIsLowViolence(); virtual bool BIsCybercafe(); virtual bool BIsVACBanned(); - virtual const char *GetCurrentGameLanguage(); - virtual const char *GetAvailableGameLanguages(); + 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 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/friends.cpp b/src/steam/interfaces/friends.cpp index 524fec6..8ade97f 100644 --- a/src/steam/interfaces/friends.cpp +++ b/src/steam/interfaces/friends.cpp @@ -3,14 +3,13 @@ namespace steam { - const char *friends::GetPersonaName() + const char* friends::GetPersonaName() { return "GlaDos"; } - void friends::SetPersonaName(const char *pchPersonaName) + void friends::SetPersonaName(const char* pchPersonaName) { - } int friends::GetPersonaState() @@ -38,17 +37,17 @@ namespace steam return 0; } - const char *friends::GetFriendPersonaName(steam_id steamIDFriend) + const char* friends::GetFriendPersonaName(steam_id steamIDFriend) { return ""; } - bool friends::GetFriendGamePlayed(steam_id steamIDFriend, void *pFriendGameInfo) + bool friends::GetFriendGamePlayed(steam_id steamIDFriend, void* pFriendGameInfo) { return false; } - const char *friends::GetFriendPersonaNameHistory(steam_id steamIDFriend, int iPersonaName) + const char* friends::GetFriendPersonaNameHistory(steam_id steamIDFriend, int iPersonaName) { return ""; } @@ -68,12 +67,12 @@ namespace steam return steam_id(); } - const char *friends::GetClanName(steam_id steamIDClan) + const char* friends::GetClanName(steam_id steamIDClan) { return "3arc"; } - const char *friends::GetClanTag(steam_id steamIDClan) + const char* friends::GetClanTag(steam_id steamIDClan) { return this->GetClanName(steamIDClan); } @@ -97,15 +96,15 @@ namespace steam { } - void friends::ActivateGameOverlay(const char *pchDialog) + void friends::ActivateGameOverlay(const char* pchDialog) { } - void friends::ActivateGameOverlayToUser(const char *pchDialog, steam_id steamID) + void friends::ActivateGameOverlayToUser(const char* pchDialog, steam_id steamID) { } - void friends::ActivateGameOverlayToWebPage(const char *pchURL) + void friends::ActivateGameOverlayToWebPage(const char* pchURL) { } @@ -167,7 +166,7 @@ namespace steam return 0; } - bool friends::SetRichPresence(const char *pchKey, const char *pchValue) + bool friends::SetRichPresence(const char* pchKey, const char* pchValue) { return true; } @@ -176,7 +175,7 @@ namespace steam { } - const char *friends::GetFriendRichPresence(steam_id steamIDFriend, const char *pchKey) + const char* friends::GetFriendRichPresence(steam_id steamIDFriend, const char* pchKey) { return ""; } @@ -186,12 +185,12 @@ namespace steam return 0; } - const char *friends::GetFriendRichPresenceKeyByIndex(steam_id steamIDFriend, int iKey) + const char* friends::GetFriendRichPresenceKeyByIndex(steam_id steamIDFriend, int iKey) { return "a"; } - bool friends::InviteUserToGame(steam_id steamIDFriend, const char *pchConnectString) + bool friends::InviteUserToGame(steam_id steamIDFriend, const char* pchConnectString) { return false; } diff --git a/src/steam/interfaces/friends.hpp b/src/steam/interfaces/friends.hpp index c97850f..c120efc 100644 --- a/src/steam/interfaces/friends.hpp +++ b/src/steam/interfaces/friends.hpp @@ -5,28 +5,28 @@ namespace steam class friends final { public: - virtual const char *GetPersonaName(); - virtual void SetPersonaName(const char *pchPersonaName); + virtual const char* GetPersonaName(); + virtual void SetPersonaName(const char* pchPersonaName); virtual int GetPersonaState(); virtual int GetFriendCount(int eFriendFlags); virtual steam_id GetFriendByIndex(int iFriend, int iFriendFlags); virtual int GetFriendRelationship(steam_id steamIDFriend); virtual int GetFriendPersonaState(steam_id steamIDFriend); - virtual const char *GetFriendPersonaName(steam_id steamIDFriend); - virtual bool GetFriendGamePlayed(steam_id steamIDFriend, void *pFriendGameInfo); - virtual const char *GetFriendPersonaNameHistory(steam_id steamIDFriend, int iPersonaName); + virtual const char* GetFriendPersonaName(steam_id steamIDFriend); + virtual bool GetFriendGamePlayed(steam_id steamIDFriend, void* pFriendGameInfo); + virtual const char* GetFriendPersonaNameHistory(steam_id steamIDFriend, int iPersonaName); virtual bool HasFriend(steam_id steamIDFriend, int eFriendFlags); virtual int GetClanCount(); virtual steam_id GetClanByIndex(int iClan); - virtual const char *GetClanName(steam_id steamIDClan); - virtual const char *GetClanTag(steam_id steamIDClan); + virtual const char* GetClanName(steam_id steamIDClan); + virtual const char* GetClanTag(steam_id steamIDClan); virtual int GetFriendCountFromSource(steam_id steamIDSource); virtual steam_id GetFriendFromSourceByIndex(steam_id steamIDSource, int iFriend); virtual bool IsUserInSource(steam_id steamIDUser, steam_id steamIDSource); virtual void SetInGameVoiceSpeaking(steam_id steamIDUser, bool bSpeaking); - virtual void ActivateGameOverlay(const char *pchDialog); - virtual void ActivateGameOverlayToUser(const char *pchDialog, steam_id steamID); - virtual void ActivateGameOverlayToWebPage(const char *pchURL); + virtual void ActivateGameOverlay(const char* pchDialog); + virtual void ActivateGameOverlayToUser(const char* pchDialog, steam_id steamID); + virtual void ActivateGameOverlayToWebPage(const char* pchURL); virtual void ActivateGameOverlayToStore(unsigned int nAppID); virtual void SetPlayedWith(steam_id steamIDUserPlayedWith); virtual void ActivateGameOverlayInviteDialog(steam_id steamIDLobby); @@ -39,12 +39,12 @@ namespace steam virtual int GetClanOfficerCount(steam_id steamIDClan); virtual steam_id GetClanOfficerByIndex(steam_id steamIDClan, int iOfficer); virtual int GetUserRestrictions(); - virtual bool SetRichPresence(const char *pchKey, const char *pchValue); + virtual bool SetRichPresence(const char* pchKey, const char* pchValue); virtual void ClearRichPresence(); - virtual const char *GetFriendRichPresence(steam_id steamIDFriend, const char *pchKey); + virtual const char* GetFriendRichPresence(steam_id steamIDFriend, const char* pchKey); virtual int GetFriendRichPresenceKeyCount(steam_id steamIDFriend); - virtual const char *GetFriendRichPresenceKeyByIndex(steam_id steamIDFriend, int iKey); - virtual bool InviteUserToGame(steam_id steamIDFriend, const char *pchConnectString); + virtual const char* GetFriendRichPresenceKeyByIndex(steam_id steamIDFriend, int iKey); + virtual bool InviteUserToGame(steam_id steamIDFriend, const char* pchConnectString); virtual int GetCoplayFriendCount(); virtual steam_id GetCoplayFriend(int iCoplayFriend); virtual int GetFriendCoplayTime(steam_id steamIDFriend); diff --git a/src/steam/interfaces/game_server.cpp b/src/steam/interfaces/game_server.cpp index addb0c0..b9f2cf2 100644 --- a/src/steam/interfaces/game_server.cpp +++ b/src/steam/interfaces/game_server.cpp @@ -26,7 +26,8 @@ namespace steam return steam_id(); } - bool game_server::SendUserConnectAndAuthenticate(unsigned int unIPClient, const void *pvAuthBlob, unsigned int cubAuthBlobSize, steam_id *pSteamIDUser) + bool game_server::SendUserConnectAndAuthenticate(unsigned int unIPClient, const void* pvAuthBlob, + unsigned int cubAuthBlobSize, steam_id* pSteamIDUser) { return true; } @@ -40,17 +41,20 @@ namespace steam { } - bool game_server::UpdateUserData(steam_id steamIDUser, const char *pchPlayerName, unsigned int uScore) + bool game_server::UpdateUserData(steam_id steamIDUser, const char* pchPlayerName, unsigned int uScore) { return true; } - bool game_server::SetServerType(unsigned int unServerFlags, unsigned int unGameIP, unsigned short unGamePort, unsigned short unSpectatorPort, unsigned short usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode) + bool game_server::SetServerType(unsigned int unServerFlags, unsigned int unGameIP, unsigned short unGamePort, + unsigned short unSpectatorPort, unsigned short usQueryPort, const char* pchGameDir, + const char* pchVersion, bool bLANMode) { return true; } - void game_server::UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char *pchServerName, const char *pSpectatorServerName, const char *pchMapName) + void game_server::UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char* pchServerName, + const char* pSpectatorServerName, const char* pchMapName) { } @@ -58,11 +62,11 @@ namespace steam { } - void game_server::SetGameType(const char *pchGameType) + void game_server::SetGameType(const char* pchGameType) { } - bool game_server::GetUserAchievementStatus(steam_id steamID, const char *pchAchievementName) + bool game_server::GetUserAchievementStatus(steam_id steamID, const char* pchAchievementName) { return false; } @@ -86,7 +90,7 @@ namespace steam return 0; } - void game_server::SetGameData(const char *pchGameData) + void game_server::SetGameData(const char* pchGameData) { } diff --git a/src/steam/interfaces/game_server.hpp b/src/steam/interfaces/game_server.hpp index 8f1c70e..f72841c 100644 --- a/src/steam/interfaces/game_server.hpp +++ b/src/steam/interfaces/game_server.hpp @@ -10,20 +10,24 @@ namespace steam virtual bool LoggedOn(); virtual bool Secure(); virtual steam_id GetSteamID(); - virtual bool SendUserConnectAndAuthenticate(unsigned int unIPClient, const void *pvAuthBlob, unsigned int cubAuthBlobSize, steam_id *pSteamIDUser); + virtual bool SendUserConnectAndAuthenticate(unsigned int unIPClient, const void* pvAuthBlob, + unsigned int cubAuthBlobSize, steam_id* pSteamIDUser); virtual steam_id CreateUnauthenticatedUserConnection(); virtual void SendUserDisconnect(steam_id steamIDUser); - virtual bool UpdateUserData(steam_id steamIDUser, const char *pchPlayerName, unsigned int uScore); - virtual bool SetServerType(unsigned int unServerFlags, unsigned int unGameIP, unsigned short unGamePort, unsigned short unSpectatorPort, unsigned short usQueryPort, const char *pchGameDir, const char *pchVersion, bool bLANMode); - virtual void UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char *pchServerName, const char *pSpectatorServerName, const char *pchMapName); + virtual bool UpdateUserData(steam_id steamIDUser, const char* pchPlayerName, unsigned int uScore); + virtual bool SetServerType(unsigned int unServerFlags, unsigned int unGameIP, unsigned short unGamePort, + unsigned short unSpectatorPort, unsigned short usQueryPort, const char* pchGameDir, + const char* pchVersion, bool bLANMode); + virtual void UpdateServerStatus(int cPlayers, int cPlayersMax, int cBotPlayers, const char* pchServerName, + const char* pSpectatorServerName, const char* pchMapName); virtual void UpdateSpectatorPort(unsigned short unSpectatorPort); - virtual void SetGameType(const char *pchGameType); - virtual bool GetUserAchievementStatus(steam_id steamID, const char *pchAchievementName); + virtual void SetGameType(const char* pchGameType); + virtual bool GetUserAchievementStatus(steam_id steamID, const char* pchAchievementName); virtual void GetGameplayStats(); virtual unsigned __int64 GetServerReputation(); virtual bool RequestUserGroupStatus(steam_id steamIDUser, steam_id steamIDGroup); virtual unsigned int GetPublicIP(); - virtual void SetGameData(const char *pchGameData); + virtual void SetGameData(const char* pchGameData); virtual int UserHasLicenseForApp(steam_id steamID, unsigned int appID); }; } diff --git a/src/steam/interfaces/master_server_updater.cpp b/src/steam/interfaces/master_server_updater.cpp index f3f5102..958f70a 100644 --- a/src/steam/interfaces/master_server_updater.cpp +++ b/src/steam/interfaces/master_server_updater.cpp @@ -11,17 +11,22 @@ namespace steam { } - bool master_server_updater::HandleIncomingPacket(const void *pData, int cbData, unsigned int srcIP, unsigned short srcPort) + bool master_server_updater::HandleIncomingPacket(const void* pData, int cbData, unsigned int srcIP, + unsigned short srcPort) { return true; } - int master_server_updater::GetNextOutgoingPacket(void *pOut, int cbMaxOut, unsigned int *pNetAdr, unsigned short *pPort) + int master_server_updater::GetNextOutgoingPacket(void* pOut, int cbMaxOut, unsigned int* pNetAdr, + unsigned short* pPort) { return 0; } - void master_server_updater::SetBasicServerData(unsigned short nProtocolVersion, bool bDedicatedServer, const char *pRegionName, const char *pProductName, unsigned short nMaxReportedClients, bool bPasswordProtected, const char *pGameDescription) + void master_server_updater::SetBasicServerData(unsigned short nProtocolVersion, bool bDedicatedServer, + const char* pRegionName, const char* pProductName, + unsigned short nMaxReportedClients, bool bPasswordProtected, + const char* pGameDescription) { } @@ -29,7 +34,7 @@ namespace steam { } - void master_server_updater::SetKeyValue(const char *pKey, const char *pValue) + void master_server_updater::SetKeyValue(const char* pKey, const char* pValue) { } @@ -46,12 +51,12 @@ namespace steam { } - bool master_server_updater::AddMasterServer(const char *pServerAddress) + bool master_server_updater::AddMasterServer(const char* pServerAddress) { return true; } - bool master_server_updater::RemoveMasterServer(const char *pServerAddress) + bool master_server_updater::RemoveMasterServer(const char* pServerAddress) { return true; } @@ -61,7 +66,7 @@ namespace steam return 0; } - int master_server_updater::GetMasterServerAddress(int iServer, char *pOut, int outBufferSize) + int master_server_updater::GetMasterServerAddress(int iServer, char* pOut, int outBufferSize) { return 0; } diff --git a/src/steam/interfaces/master_server_updater.hpp b/src/steam/interfaces/master_server_updater.hpp index ffb9c6e..7739dbd 100644 --- a/src/steam/interfaces/master_server_updater.hpp +++ b/src/steam/interfaces/master_server_updater.hpp @@ -7,17 +7,19 @@ namespace steam 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 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 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 bool AddMasterServer(const char* pServerAddress); + virtual bool RemoveMasterServer(const char* pServerAddress); virtual int GetNumMasterServers(); - virtual int GetMasterServerAddress(int iServer, char *pOut, int outBufferSize); + virtual int GetMasterServerAddress(int iServer, char* pOut, int outBufferSize); }; } diff --git a/src/steam/interfaces/matchmaking.cpp b/src/steam/interfaces/matchmaking.cpp index 4dbccef..d157e32 100644 --- a/src/steam/interfaces/matchmaking.cpp +++ b/src/steam/interfaces/matchmaking.cpp @@ -8,17 +8,22 @@ namespace steam 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) + 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) + 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) + bool matchmaking::RemoveFavoriteGame(unsigned int nAppID, unsigned int nIP, unsigned short nConnPort, + unsigned short nQueryPort, unsigned int unFlags) { return false; } @@ -28,15 +33,17 @@ namespace steam return 0; } - void matchmaking::AddRequestLobbyListStringFilter(const char *pchKeyToMatch, const char *pchValueToMatch, int eComparisonType) + void matchmaking::AddRequestLobbyListStringFilter(const char* pchKeyToMatch, const char* pchValueToMatch, + int eComparisonType) { } - void matchmaking::AddRequestLobbyListNumericalFilter(const char *pchKeyToMatch, int nValueToMatch, int eComparisonType) + void matchmaking::AddRequestLobbyListNumericalFilter(const char* pchKeyToMatch, int nValueToMatch, + int eComparisonType) { } - void matchmaking::AddRequestLobbyListNearValueFilter(const char *pchKeyToMatch, int nValueToBeCloseTo) + void matchmaking::AddRequestLobbyListNearValueFilter(const char* pchKeyToMatch, int nValueToBeCloseTo) { } @@ -60,9 +67,10 @@ namespace steam unsigned __int64 matchmaking::CreateLobby(int eLobbyType, int cMaxMembers) { const auto result = callbacks::register_call(); - auto retvals = static_cast(calloc(1, sizeof(lobby_created)));//::Utils::Memory::AllocateArray(); + auto retvals = static_cast(calloc(1, sizeof(lobby_created))); + //::Utils::Memory::AllocateArray(); steam_id id; - + id.raw.account_id = 1337132; id.raw.universe = 1; id.raw.account_type = 8; @@ -81,7 +89,8 @@ namespace steam unsigned __int64 matchmaking::JoinLobby(steam_id steamIDLobby) { const auto result = callbacks::register_call(); - auto* retvals = static_cast(calloc(1, sizeof(lobby_enter)));//::Utils::Memory::AllocateArray(); + auto* retvals = static_cast(calloc(1, sizeof(lobby_enter))); + //::Utils::Memory::AllocateArray(); retvals->m_b_locked = false; retvals->m_e_chat_room_enter_response = 1; retvals->m_rgf_chat_permissions = 0xFFFFFFFF; @@ -112,12 +121,12 @@ namespace steam return SteamUser()->GetSteamID(); } - const char *matchmaking::GetLobbyData(steam_id steamIDLobby, const char *pchKey) + const char* matchmaking::GetLobbyData(steam_id steamIDLobby, const char* pchKey) { - return "212";//Components::Party::GetLobbyInfo(steamIDLobby, pchKey); + return "212"; //Components::Party::GetLobbyInfo(steamIDLobby, pchKey); } - bool matchmaking::SetLobbyData(steam_id steamIDLobby, const char *pchKey, const char *pchValue) + bool matchmaking::SetLobbyData(steam_id steamIDLobby, const char* pchKey, const char* pchValue) { return true; } @@ -127,31 +136,33 @@ namespace steam return 0; } - bool matchmaking::GetLobbyDataByIndex(steam_id steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize) + bool matchmaking::GetLobbyDataByIndex(steam_id steamIDLobby, int iLobbyData, char* pchKey, int cchKeyBufferSize, + char* pchValue, int cchValueBufferSize) { return false; } - bool matchmaking::DeleteLobbyData(steam_id steamIDLobby, const char *pchKey) + bool matchmaking::DeleteLobbyData(steam_id steamIDLobby, const char* pchKey) { return false; } - const char *matchmaking::GetLobbyMemberData(steam_id steamIDLobby, steam_id steamIDUser, const char *pchKey) + const char* matchmaking::GetLobbyMemberData(steam_id steamIDLobby, steam_id steamIDUser, const char* pchKey) { return ""; } - void matchmaking::SetLobbyMemberData(steam_id steamIDLobby, const char *pchKey, const char *pchValue) + void matchmaking::SetLobbyMemberData(steam_id steamIDLobby, const char* pchKey, const char* pchValue) { } - bool matchmaking::SendLobbyChatMsg(steam_id steamIDLobby, const void *pvMsgBody, int cubMsgBody) + bool matchmaking::SendLobbyChatMsg(steam_id steamIDLobby, const void* pvMsgBody, int cubMsgBody) { return true; } - int matchmaking::GetLobbyChatEntry(steam_id steamIDLobby, int iChatID, steam_id *pSteamIDUser, void *pvData, int cubData, int *peChatEntryType) + int matchmaking::GetLobbyChatEntry(steam_id steamIDLobby, int iChatID, steam_id* pSteamIDUser, void* pvData, + int cubData, int* peChatEntryType) { return 0; } @@ -161,11 +172,13 @@ namespace steam return false; } - void matchmaking::SetLobbyGameServer(steam_id steamIDLobby, unsigned int unGameServerIP, unsigned short unGameServerPort, steam_id steamIDGameServer) + void matchmaking::SetLobbyGameServer(steam_id steamIDLobby, unsigned int unGameServerIP, + unsigned short unGameServerPort, steam_id steamIDGameServer) { } - bool matchmaking::GetLobbyGameServer(steam_id steamIDLobby, unsigned int *punGameServerIP, unsigned short *punGameServerPort, steam_id *psteamIDGameServer) + bool matchmaking::GetLobbyGameServer(steam_id steamIDLobby, unsigned int* punGameServerIP, + unsigned short* punGameServerPort, steam_id* psteamIDGameServer) { return false; } diff --git a/src/steam/interfaces/matchmaking.hpp b/src/steam/interfaces/matchmaking.hpp index 350a6c5..ce67df3 100644 --- a/src/steam/interfaces/matchmaking.hpp +++ b/src/steam/interfaces/matchmaking.hpp @@ -25,13 +25,20 @@ namespace steam { 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 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 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); @@ -42,18 +49,22 @@ namespace steam virtual bool InviteUserToLobby(steam_id steamIDLobby, steam_id steamIDInvitee); virtual int GetNumLobbyMembers(steam_id steamIDLobby); virtual steam_id GetLobbyMemberByIndex(steam_id steamIDLobby, int iMember); - virtual const char *GetLobbyData(steam_id steamIDLobby, const char *pchKey); - virtual bool SetLobbyData(steam_id steamIDLobby, const char *pchKey, const char *pchValue); + virtual const char* GetLobbyData(steam_id steamIDLobby, const char* pchKey); + virtual bool SetLobbyData(steam_id steamIDLobby, const char* pchKey, const char* pchValue); virtual int GetLobbyDataCount(steam_id steamIDLobby); - virtual bool GetLobbyDataByIndex(steam_id steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize); - virtual bool DeleteLobbyData(steam_id steamIDLobby, const char *pchKey); - virtual const char *GetLobbyMemberData(steam_id steamIDLobby, steam_id steamIDUser, const char *pchKey); - virtual void SetLobbyMemberData(steam_id steamIDLobby, const char *pchKey, const char *pchValue); - virtual bool SendLobbyChatMsg(steam_id steamIDLobby, const void *pvMsgBody, int cubMsgBody); - virtual int GetLobbyChatEntry(steam_id steamIDLobby, int iChatID, steam_id *pSteamIDUser, void *pvData, int cubData, int *peChatEntryType); + virtual bool GetLobbyDataByIndex(steam_id steamIDLobby, int iLobbyData, char* pchKey, int cchKeyBufferSize, + char* pchValue, int cchValueBufferSize); + virtual bool DeleteLobbyData(steam_id steamIDLobby, const char* pchKey); + virtual const char* GetLobbyMemberData(steam_id steamIDLobby, steam_id steamIDUser, const char* pchKey); + virtual void SetLobbyMemberData(steam_id steamIDLobby, const char* pchKey, const char* pchValue); + virtual bool SendLobbyChatMsg(steam_id steamIDLobby, const void* pvMsgBody, int cubMsgBody); + virtual int GetLobbyChatEntry(steam_id steamIDLobby, int iChatID, steam_id* pSteamIDUser, void* pvData, + int cubData, int* peChatEntryType); virtual bool RequestLobbyData(steam_id steamIDLobby); - virtual void SetLobbyGameServer(steam_id steamIDLobby, unsigned int unGameServerIP, unsigned short unGameServerPort, steam_id steamIDGameServer); - virtual bool GetLobbyGameServer(steam_id steamIDLobby, unsigned int *punGameServerIP, unsigned short *punGameServerPort, steam_id *psteamIDGameServer); + virtual void SetLobbyGameServer(steam_id steamIDLobby, unsigned int unGameServerIP, + unsigned short unGameServerPort, steam_id steamIDGameServer); + virtual bool GetLobbyGameServer(steam_id steamIDLobby, unsigned int* punGameServerIP, + unsigned short* punGameServerPort, steam_id* psteamIDGameServer); virtual bool SetLobbyMemberLimit(steam_id steamIDLobby, int cMaxMembers); virtual int GetLobbyMemberLimit(steam_id steamIDLobby); virtual bool SetLobbyType(steam_id steamIDLobby, int eLobbyType); diff --git a/src/steam/interfaces/matchmaking_servers.cpp b/src/steam/interfaces/matchmaking_servers.cpp index 841dd94..f1eafa8 100644 --- a/src/steam/interfaces/matchmaking_servers.cpp +++ b/src/steam/interfaces/matchmaking_servers.cpp @@ -3,32 +3,37 @@ namespace steam { - void* matchmaking_servers::RequestInternetServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + void* matchmaking_servers::RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, + void* pRequestServersResponse) { return nullptr; } - void* matchmaking_servers::RequestLANServerList(unsigned int iApp, void *pRequestServersResponse) + void* matchmaking_servers::RequestLANServerList(unsigned int iApp, void* pRequestServersResponse) { return nullptr; } - void* matchmaking_servers::RequestFriendsServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + void* matchmaking_servers::RequestFriendsServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, + void* pRequestServersResponse) { return nullptr; } - void* matchmaking_servers::RequestFavoritesServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + void* matchmaking_servers::RequestFavoritesServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, + void* pRequestServersResponse) { return nullptr; } - void* matchmaking_servers::RequestHistoryServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + void* matchmaking_servers::RequestHistoryServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, + void* pRequestServersResponse) { return nullptr; } - void* matchmaking_servers::RequestSpectatorServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse) + void* matchmaking_servers::RequestSpectatorServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, + void* pRequestServersResponse) { return nullptr; } @@ -37,7 +42,7 @@ namespace steam { } - void *matchmaking_servers::GetServerDetails(void* hRequest, int iServer) + void* matchmaking_servers::GetServerDetails(void* hRequest, int iServer) { return nullptr; } @@ -64,17 +69,17 @@ namespace steam { } - int matchmaking_servers::PingServer(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + int matchmaking_servers::PingServer(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse) { return 0; } - int matchmaking_servers::PlayerDetails(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + int matchmaking_servers::PlayerDetails(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse) { return 0; } - int matchmaking_servers::ServerRules(unsigned int unIP, unsigned short usPort, void *pRequestServersResponse) + int matchmaking_servers::ServerRules(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse) { return 0; } diff --git a/src/steam/interfaces/matchmaking_servers.hpp b/src/steam/interfaces/matchmaking_servers.hpp index 453fcdb..79fb552 100644 --- a/src/steam/interfaces/matchmaking_servers.hpp +++ b/src/steam/interfaces/matchmaking_servers.hpp @@ -5,22 +5,27 @@ namespace steam class matchmaking_servers final { public: - virtual void* RequestInternetServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); - virtual void* RequestLANServerList(unsigned int iApp, void *pRequestServersResponse); - virtual void* RequestFriendsServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); - virtual void* RequestFavoritesServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); - virtual void* RequestHistoryServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); - virtual void* RequestSpectatorServerList(unsigned int iApp, void **ppchFilters, unsigned int nFilters, void *pRequestServersResponse); + virtual void* 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* 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 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/networking.cpp b/src/steam/interfaces/networking.cpp index 2858dc5..bcd871a 100644 --- a/src/steam/interfaces/networking.cpp +++ b/src/steam/interfaces/networking.cpp @@ -3,17 +3,18 @@ namespace steam { - bool networking::SendP2PPacket(steam_id steamIDRemote, const void *pubData, unsigned int cubData, int eP2PSendType) + bool networking::SendP2PPacket(steam_id steamIDRemote, const void* pubData, unsigned int cubData, int eP2PSendType) { return false; } - bool networking::IsP2PPacketAvailable(unsigned int *pcubMsgSize, int idk) + bool networking::IsP2PPacketAvailable(unsigned int* pcubMsgSize, int idk) { return false; } - bool networking::ReadP2PPacket(void *pubDest, unsigned int cubDest, unsigned int *pcubMsgSize, steam_id *psteamIDRemote) + bool networking::ReadP2PPacket(void* pubDest, unsigned int cubDest, unsigned int* pcubMsgSize, + steam_id* psteamIDRemote) { return false; } @@ -33,7 +34,7 @@ namespace steam return false; } - bool networking::GetP2PSessionState(steam_id steamIDRemote, void *pConnectionState) + bool networking::GetP2PSessionState(steam_id steamIDRemote, void* pConnectionState) { return false; } @@ -43,12 +44,14 @@ namespace steam return false; } - unsigned int networking::CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort, bool bAllowUseOfPacketRelay) + unsigned int networking::CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort, + bool bAllowUseOfPacketRelay) { return NULL; } - unsigned int networking::CreateP2PConnectionSocket(steam_id steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay) + unsigned int networking::CreateP2PConnectionSocket(steam_id steamIDTarget, int nVirtualPort, int nTimeoutSec, + bool bAllowUseOfPacketRelay) { return NULL; } @@ -68,37 +71,40 @@ namespace steam return false; } - bool networking::SendDataOnSocket(unsigned int hSocket, void *pubData, unsigned int cubData, bool bReliable) + bool networking::SendDataOnSocket(unsigned int hSocket, void* pubData, unsigned int cubData, bool bReliable) { return false; } - bool networking::IsDataAvailableOnSocket(unsigned int hSocket, unsigned int *pcubMsgSize) + 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) + 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) + 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) + bool networking::RetrieveData(unsigned int hListenSocket, void* pubDest, unsigned int cubDest, + unsigned int* pcubMsgSize, unsigned int* phSocket) { return false; } - bool networking::GetSocketInfo(unsigned int hSocket, steam_id *pSteamIDRemote, int *peSocketStatus, unsigned int *punIPRemote, unsigned short *punPortRemote) + bool networking::GetSocketInfo(unsigned int hSocket, steam_id* pSteamIDRemote, int* peSocketStatus, + unsigned int* punIPRemote, unsigned short* punPortRemote) { return false; } - bool networking::GetListenSocketInfo(unsigned int hListenSocket, unsigned int *pnIP, unsigned short *pnPort) + bool networking::GetListenSocketInfo(unsigned int hListenSocket, unsigned int* pnIP, unsigned short* pnPort) { return false; } diff --git a/src/steam/interfaces/networking.hpp b/src/steam/interfaces/networking.hpp index 613fa6e..9787ca7 100644 --- a/src/steam/interfaces/networking.hpp +++ b/src/steam/interfaces/networking.hpp @@ -5,26 +5,32 @@ namespace steam class networking final { public: - virtual bool SendP2PPacket(steam_id steamIDRemote, const void *pubData, unsigned int cubData, int eP2PSendType); - virtual bool IsP2PPacketAvailable(unsigned int *pcubMsgSize, int idk); - virtual bool ReadP2PPacket(void *pubDest, unsigned int cubDest, unsigned int *pcubMsgSize, steam_id *psteamIDRemote); + virtual bool SendP2PPacket(steam_id steamIDRemote, const void* pubData, unsigned int cubData, int eP2PSendType); + virtual bool IsP2PPacketAvailable(unsigned int* pcubMsgSize, int idk); + virtual bool ReadP2PPacket(void* pubDest, unsigned int cubDest, unsigned int* pcubMsgSize, + steam_id* psteamIDRemote); virtual bool AcceptP2PSessionWithUser(steam_id steamIDRemote); virtual bool CloseP2PSessionWithUser(steam_id steamIDRemote); virtual bool CloseP2PChannelWithUser(steam_id steamIDRemote, int iVirtualPort); - virtual bool GetP2PSessionState(steam_id steamIDRemote, void *pConnectionState); + virtual bool GetP2PSessionState(steam_id steamIDRemote, void* pConnectionState); virtual bool AllowP2PPacketRelay(bool bAllow); - virtual unsigned int CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort, bool bAllowUseOfPacketRelay); - virtual unsigned int CreateP2PConnectionSocket(steam_id steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay); + virtual unsigned int CreateListenSocket(int nVirtualP2PPort, unsigned int nIP, unsigned short nPort, + bool bAllowUseOfPacketRelay); + virtual unsigned int CreateP2PConnectionSocket(steam_id steamIDTarget, int nVirtualPort, int nTimeoutSec, + bool bAllowUseOfPacketRelay); virtual unsigned int CreateConnectionSocket(unsigned int nIP, unsigned short nPort, int nTimeoutSec); virtual bool DestroySocket(unsigned int hSocket, bool bNotifyRemoteEnd); virtual bool DestroyListenSocket(unsigned int hSocket, bool bNotifyRemoteEnd); - virtual bool SendDataOnSocket(unsigned int hSocket, void *pubData, unsigned int cubData, bool bReliable); - virtual bool IsDataAvailableOnSocket(unsigned int hSocket, unsigned int *pcubMsgSize); - virtual bool RetrieveDataFromSocket(unsigned int hSocket, void *pubDest, unsigned int cubDest, unsigned int *pcubMsgSize); - virtual bool IsDataAvailable(unsigned int hListenSocket, unsigned int *pcubMsgSize, unsigned int *phSocket); - virtual bool RetrieveData(unsigned int hListenSocket, void *pubDest, unsigned int cubDest, unsigned int *pcubMsgSize, unsigned int *phSocket); - virtual bool GetSocketInfo(unsigned int hSocket, steam_id *pSteamIDRemote, int *peSocketStatus, unsigned int *punIPRemote, unsigned short *punPortRemote); - virtual bool GetListenSocketInfo(unsigned int hListenSocket, unsigned int *pnIP, unsigned short *pnPort); + virtual bool SendDataOnSocket(unsigned int hSocket, void* pubData, unsigned int cubData, bool bReliable); + virtual bool IsDataAvailableOnSocket(unsigned int hSocket, unsigned int* pcubMsgSize); + virtual bool RetrieveDataFromSocket(unsigned int hSocket, void* pubDest, unsigned int cubDest, + unsigned int* pcubMsgSize); + virtual bool IsDataAvailable(unsigned int hListenSocket, unsigned int* pcubMsgSize, unsigned int* phSocket); + virtual bool RetrieveData(unsigned int hListenSocket, void* pubDest, unsigned int cubDest, + unsigned int* pcubMsgSize, unsigned int* phSocket); + virtual bool GetSocketInfo(unsigned int hSocket, steam_id* pSteamIDRemote, int* peSocketStatus, + unsigned int* punIPRemote, unsigned short* punPortRemote); + virtual bool GetListenSocketInfo(unsigned int hListenSocket, unsigned int* pnIP, unsigned short* pnPort); virtual int GetSocketConnectionType(unsigned int hSocket); virtual int GetMaxPacketSize(unsigned int hSocket); }; diff --git a/src/steam/interfaces/remote_storage.cpp b/src/steam/interfaces/remote_storage.cpp index 14c293f..03ac724 100644 --- a/src/steam/interfaces/remote_storage.cpp +++ b/src/steam/interfaces/remote_storage.cpp @@ -3,23 +3,23 @@ namespace steam { - bool remote_storage::FileWrite(const char *pchFile, const void *pvData, int cubData) + bool remote_storage::FileWrite(const char* pchFile, const void* pvData, int cubData) { return true; } - int remote_storage::GetFileSize(const char *pchFile) + int remote_storage::GetFileSize(const char* pchFile) { return 0; } - int remote_storage::FileRead(const char *pchFile, void *pvData, int cubDataToRead) + int remote_storage::FileRead(const char* pchFile, void* pvData, int cubDataToRead) { OutputDebugStringA(pchFile); return 0; } - bool remote_storage::FileExists(const char *pchFile) + bool remote_storage::FileExists(const char* pchFile) { return false; } @@ -29,13 +29,13 @@ namespace steam return 0; } - const char *remote_storage::GetFileNameAndSize(int iFile, int *pnFileSizeInBytes) + const char* remote_storage::GetFileNameAndSize(int iFile, int* pnFileSizeInBytes) { *pnFileSizeInBytes = 0; return ""; } - bool remote_storage::GetQuota(int *pnTotalBytes, int *puAvailableBytes) + bool remote_storage::GetQuota(int* pnTotalBytes, int* puAvailableBytes) { *pnTotalBytes = 0x10000000; *puAvailableBytes = 0x10000000; diff --git a/src/steam/interfaces/remote_storage.hpp b/src/steam/interfaces/remote_storage.hpp index 06a553c..fd3c239 100644 --- a/src/steam/interfaces/remote_storage.hpp +++ b/src/steam/interfaces/remote_storage.hpp @@ -5,12 +5,12 @@ namespace steam class remote_storage final { public: - virtual bool FileWrite(const char *pchFile, const void *pvData, int cubData); - virtual int GetFileSize(const char *pchFile); - virtual int FileRead(const char *pchFile, void *pvData, int cubDataToRead); - virtual bool FileExists(const char *pchFile); + virtual 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); + virtual const char* GetFileNameAndSize(int iFile, int* pnFileSizeInBytes); + virtual bool GetQuota(int* pnTotalBytes, int* puAvailableBytes); }; } diff --git a/src/steam/interfaces/user.cpp b/src/steam/interfaces/user.cpp index 3073f69..a83ab5a 100644 --- a/src/steam/interfaces/user.cpp +++ b/src/steam/interfaces/user.cpp @@ -20,7 +20,8 @@ namespace steam return id; } - int user::InitiateGameConnection(void *pAuthBlob, int cbMaxAuthBlob, steam_id steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer, bool bSecure) + int user::InitiateGameConnection(void* pAuthBlob, int cbMaxAuthBlob, steam_id steamIDGameServer, + unsigned int unIPServer, unsigned short usPortServer, bool bSecure) { return 0; } @@ -29,11 +30,11 @@ namespace steam { } - void user::TrackAppUsageEvent(steam_id gameID, int eAppUsageEvent, const char *pchExtraInfo) + void user::TrackAppUsageEvent(steam_id gameID, int eAppUsageEvent, const char* pchExtraInfo) { } - bool user::GetUserDataFolder(char *pchBuffer, int cubBuffer) + bool user::GetUserDataFolder(char* pchBuffer, int cubBuffer) { return false; } @@ -46,17 +47,22 @@ namespace steam { } - int user::GetAvailableVoice(unsigned int *pcbCompressed, unsigned int *pcbUncompressed, unsigned int nUncompressedVoiceDesiredSampleRate) + 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) + 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) + int user::DecompressVoice(void* pCompressed, unsigned int cbCompressed, void* pDestBuffer, + unsigned int cbDestBufferSize, unsigned int* nBytesWritten) { return 0; } @@ -66,12 +72,12 @@ namespace steam return 0; } - unsigned int user::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket) + unsigned int user::GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket) { return 0; } - int user::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, steam_id steamID) + int user::BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, steam_id steamID) { return 0; } @@ -98,25 +104,28 @@ namespace steam { } - unsigned __int64 user::RequestEncryptedAppTicket(void *pUserData, int cbUserData) + unsigned __int64 user::RequestEncryptedAppTicket(void* pUserData, int cbUserData) { // Generate the authentication ticket //Components::DemonWare::GenerateAuthTicket(std::string(reinterpret_cast(pUserData), cbUserData)); // Create the call response const auto result = callbacks::register_call(); - auto retvals = static_cast(calloc(1, sizeof(encrypted_app_ticket_response)));//::Utils::Memory::AllocateArray(); + auto retvals = static_cast(calloc(1, sizeof(encrypted_app_ticket_response))); + //::Utils::Memory::AllocateArray(); retvals->m_e_result = 1; // Return the call response - callbacks::return_call(retvals, sizeof(encrypted_app_ticket_response), encrypted_app_ticket_response::callback_id, result); + callbacks::return_call(retvals, sizeof(encrypted_app_ticket_response), + encrypted_app_ticket_response::callback_id, result); return result; } - bool user::GetEncryptedAppTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket) + 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); + return false; + //Components::DemonWare::GetAuthTicket(pTicket, static_cast(cbMaxTicket), pcbTicket); } } diff --git a/src/steam/interfaces/user.hpp b/src/steam/interfaces/user.hpp index 7e1a5bd..4ee71e7 100644 --- a/src/steam/interfaces/user.hpp +++ b/src/steam/interfaces/user.hpp @@ -16,24 +16,30 @@ namespace steam virtual bool LoggedOn(); virtual steam_id GetSteamID(); - virtual int InitiateGameConnection(void *pAuthBlob, int cbMaxAuthBlob, steam_id steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer, bool bSecure); + virtual int InitiateGameConnection(void* pAuthBlob, int cbMaxAuthBlob, steam_id steamIDGameServer, + unsigned int unIPServer, unsigned short usPortServer, bool bSecure); virtual void TerminateGameConnection(unsigned int unIPServer, unsigned short usPortServer); - virtual void TrackAppUsageEvent(steam_id gameID, int eAppUsageEvent, const char *pchExtraInfo = ""); - virtual bool GetUserDataFolder(char *pchBuffer, int cubBuffer); + virtual void TrackAppUsageEvent(steam_id gameID, int eAppUsageEvent, const char* pchExtraInfo = ""); + virtual bool GetUserDataFolder(char* pchBuffer, int cubBuffer); virtual void StartVoiceRecording(); virtual void StopVoiceRecording(); - virtual int GetAvailableVoice(unsigned int *pcbCompressed, unsigned int *pcbUncompressed, unsigned int nUncompressedVoiceDesiredSampleRate); - virtual int GetVoice(bool bWantCompressed, void *pDestBuffer, unsigned int cbDestBufferSize, unsigned int *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, unsigned int cbUncompressedDestBufferSize, unsigned int *nUncompressBytesWritten, unsigned int nUncompressedVoiceDesiredSampleRate); - virtual int DecompressVoice(void *pCompressed, unsigned int cbCompressed, void *pDestBuffer, unsigned int cbDestBufferSize, unsigned int *nBytesWritten); + virtual int GetAvailableVoice(unsigned int* pcbCompressed, unsigned int* pcbUncompressed, + unsigned int nUncompressedVoiceDesiredSampleRate); + virtual int GetVoice(bool bWantCompressed, void* pDestBuffer, unsigned int cbDestBufferSize, + unsigned int* nBytesWritten, bool bWantUncompressed, void* pUncompressedDestBuffer, + unsigned int cbUncompressedDestBufferSize, unsigned int* nUncompressBytesWritten, + unsigned int nUncompressedVoiceDesiredSampleRate); + virtual int DecompressVoice(void* pCompressed, unsigned int cbCompressed, void* pDestBuffer, + unsigned int cbDestBufferSize, unsigned int* nBytesWritten); virtual unsigned int GetVoiceOptimalSampleRate(); - virtual unsigned int GetAuthSessionTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket); - virtual int BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, steam_id steamID); + virtual unsigned int GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket); + virtual int BeginAuthSession(const void* pAuthTicket, int cbAuthTicket, steam_id steamID); virtual void EndAuthSession(steam_id steamID); virtual void CancelAuthTicket(unsigned int hAuthTicket); virtual unsigned int UserHasLicenseForApp(steam_id steamID, unsigned int appID); virtual bool BIsBehindNAT(); virtual void AdvertiseGame(steam_id steamIDGameServer, unsigned int unIPServer, unsigned short usPortServer); - virtual unsigned __int64 RequestEncryptedAppTicket(void *pUserData, int cbUserData); - virtual bool GetEncryptedAppTicket(void *pTicket, int cbMaxTicket, unsigned int *pcbTicket); + virtual unsigned __int64 RequestEncryptedAppTicket(void* pUserData, int cbUserData); + virtual bool GetEncryptedAppTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket); }; } diff --git a/src/steam/interfaces/user_stats.cpp b/src/steam/interfaces/user_stats.cpp index acdf49e..f0d248b 100644 --- a/src/steam/interfaces/user_stats.cpp +++ b/src/steam/interfaces/user_stats.cpp @@ -8,47 +8,47 @@ namespace steam return true; } - bool user_stats::GetStat(const char *pchName, int *pData) + bool user_stats::GetStat(const char* pchName, int* pData) { return false; } - bool user_stats::GetStat(const char *pchName, float *pData) + bool user_stats::GetStat(const char* pchName, float* pData) { return false; } - bool user_stats::SetStat(const char *pchName, int nData) + bool user_stats::SetStat(const char* pchName, int nData) { return false; } - bool user_stats::SetStat(const char *pchName, float fData) + bool user_stats::SetStat(const char* pchName, float fData) { return false; } - bool user_stats::UpdateAvgRateStat(const char *pchName, float flCountThisSession, double dSessionLength) + bool user_stats::UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength) { return false; } - bool user_stats::GetAchievement(const char *pchName, bool *pbAchieved) + bool user_stats::GetAchievement(const char* pchName, bool* pbAchieved) { return false; } - bool user_stats::SetAchievement(const char *pchName) + bool user_stats::SetAchievement(const char* pchName) { return false; } - bool user_stats::ClearAchievement(const char *pchName) + bool user_stats::ClearAchievement(const char* pchName) { return false; } - bool user_stats::GetAchievementAndUnlockTime(const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime) + bool user_stats::GetAchievementAndUnlockTime(const char* pchName, bool* pbAchieved, unsigned int* punUnlockTime) { return false; } @@ -58,17 +58,18 @@ namespace steam return false; } - int user_stats::GetAchievementIcon(const char *pchName) + int user_stats::GetAchievementIcon(const char* pchName) { return 0; } - const char *user_stats::GetAchievementDisplayAttribute(const char *pchName, const char *pchKey) + const char* user_stats::GetAchievementDisplayAttribute(const char* pchName, const char* pchKey) { return ""; } - bool user_stats::IndicateAchievementProgress(const char *pchName, unsigned int nCurProgress, unsigned int nMaxProgress) + bool user_stats::IndicateAchievementProgress(const char* pchName, unsigned int nCurProgress, + unsigned int nMaxProgress) { return false; } @@ -78,22 +79,23 @@ namespace steam return 0; } - bool user_stats::GetUserStat(steam_id steamIDUser, const char *pchName, int *pData) + bool user_stats::GetUserStat(steam_id steamIDUser, const char* pchName, int* pData) { return false; } - bool user_stats::GetUserStat(steam_id steamIDUser, const char *pchName, float *pData) + bool user_stats::GetUserStat(steam_id steamIDUser, const char* pchName, float* pData) { return false; } - bool user_stats::GetUserAchievement(steam_id steamIDUser, const char *pchName, bool *pbAchieved) + bool user_stats::GetUserAchievement(steam_id steamIDUser, const char* pchName, bool* pbAchieved) { return false; } - bool user_stats::GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime) + bool user_stats::GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char* pchName, bool* pbAchieved, + unsigned int* punUnlockTime) { return false; } @@ -103,17 +105,18 @@ namespace steam return false; } - unsigned __int64 user_stats::FindOrCreateLeaderboard(const char *pchLeaderboardName, int eLeaderboardSortMethod, int eLeaderboardDisplayType) + unsigned __int64 user_stats::FindOrCreateLeaderboard(const char* pchLeaderboardName, int eLeaderboardSortMethod, + int eLeaderboardDisplayType) { return 0; } - unsigned __int64 user_stats::FindLeaderboard(const char *pchLeaderboardName) + unsigned __int64 user_stats::FindLeaderboard(const char* pchLeaderboardName) { return 0; } - const char *user_stats::GetLeaderboardName(unsigned __int64 hSteamLeaderboard) + const char* user_stats::GetLeaderboardName(unsigned __int64 hSteamLeaderboard) { return ""; } @@ -133,22 +136,27 @@ namespace steam return 0; } - unsigned __int64 user_stats::DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, int eLeaderboardDataRequest, int nRangeStart, int nRangeEnd) + unsigned __int64 user_stats::DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, + int eLeaderboardDataRequest, int nRangeStart, int nRangeEnd) { return 0; } - unsigned __int64 user_stats::DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, steam_id *prgUsers, int cUsers) + unsigned __int64 user_stats::DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, + steam_id* prgUsers, int cUsers) { return 0; } - bool user_stats::GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, int *pLeaderboardEntry, int *pDetails, int cDetailsMax) + bool user_stats::GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, + int* pLeaderboardEntry, int* pDetails, int cDetailsMax) { return false; } - unsigned __int64 user_stats::UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, int eLeaderboardUploadScoreMethod, int nScore, const int *pScoreDetails, int cScoreDetailsCount) + unsigned __int64 user_stats::UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, + int eLeaderboardUploadScoreMethod, int nScore, + const int* pScoreDetails, int cScoreDetailsCount) { return 0; } @@ -168,17 +176,19 @@ namespace steam return 0; } - int user_stats::GetMostAchievedAchievementInfo(char *pchName, unsigned int unNameBufLen, float *pflPercent, bool *pbAchieved) + int user_stats::GetMostAchievedAchievementInfo(char* pchName, unsigned int unNameBufLen, float* pflPercent, + bool* pbAchieved) { return 0; } - int user_stats::GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char *pchName, unsigned int unNameBufLen, float *pflPercent, bool *pbAchieved) + int user_stats::GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char* pchName, unsigned int unNameBufLen, + float* pflPercent, bool* pbAchieved) { return 0; } - bool user_stats::GetAchievementAchievedPercent(const char *pchName, float *pflPercent) + bool user_stats::GetAchievementAchievedPercent(const char* pchName, float* pflPercent) { return false; } @@ -188,22 +198,22 @@ namespace steam return 0; } - bool user_stats::GetGlobalStat(const char *pchStatName, __int64 *pData) + bool user_stats::GetGlobalStat(const char* pchStatName, __int64* pData) { return false; } - bool user_stats::GetGlobalStat(const char *pchStatName, double *pData) + bool user_stats::GetGlobalStat(const char* pchStatName, double* pData) { return false; } - int user_stats::GetGlobalStatHistory(const char *pchStatName, __int64 *pData, unsigned int cubData) + int user_stats::GetGlobalStatHistory(const char* pchStatName, __int64* pData, unsigned int cubData) { return 0; } - int user_stats::GetGlobalStatHistory(const char *pchStatName, double *pData, unsigned int cubData) + int user_stats::GetGlobalStatHistory(const char* pchStatName, double* pData, unsigned int cubData) { return 0; } diff --git a/src/steam/interfaces/user_stats.hpp b/src/steam/interfaces/user_stats.hpp index ebe67f3..9039814 100644 --- a/src/steam/interfaces/user_stats.hpp +++ b/src/steam/interfaces/user_stats.hpp @@ -6,45 +6,56 @@ namespace steam { 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 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 int GetAchievementIcon(const char* pchName); + virtual const char* GetAchievementDisplayAttribute(const char* pchName, const char* pchKey); + virtual bool IndicateAchievementProgress(const char* pchName, unsigned int nCurProgress, + unsigned int nMaxProgress); virtual unsigned __int64 RequestUserStats(steam_id steamIDUser); - virtual bool GetUserStat(steam_id steamIDUser, const char *pchName, int *pData); - virtual bool GetUserStat(steam_id steamIDUser, const char *pchName, float *pData); - virtual bool GetUserAchievement(steam_id steamIDUser, const char *pchName, bool *pbAchieved); - virtual bool GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char *pchName, bool *pbAchieved, unsigned int *punUnlockTime); + virtual bool GetUserStat(steam_id steamIDUser, const char* pchName, int* pData); + virtual bool GetUserStat(steam_id steamIDUser, const char* pchName, float* pData); + virtual bool GetUserAchievement(steam_id steamIDUser, const char* pchName, bool* pbAchieved); + virtual bool GetUserAchievementAndUnlockTime(steam_id steamIDUser, const char* pchName, bool* pbAchieved, + unsigned int* punUnlockTime); virtual bool ResetAllStats(bool bAchievementsToo); - virtual unsigned __int64 FindOrCreateLeaderboard(const char *pchLeaderboardName, int eLeaderboardSortMethod, int eLeaderboardDisplayType); - virtual unsigned __int64 FindLeaderboard(const char *pchLeaderboardName); - virtual const char *GetLeaderboardName(unsigned __int64 hSteamLeaderboard); + virtual unsigned __int64 FindOrCreateLeaderboard(const char* pchLeaderboardName, int eLeaderboardSortMethod, + int eLeaderboardDisplayType); + virtual unsigned __int64 FindLeaderboard(const char* pchLeaderboardName); + virtual const char* GetLeaderboardName(unsigned __int64 hSteamLeaderboard); virtual int GetLeaderboardEntryCount(unsigned __int64 hSteamLeaderboard); virtual int GetLeaderboardSortMethod(unsigned __int64 hSteamLeaderboard); virtual int GetLeaderboardDisplayType(unsigned __int64 hSteamLeaderboard); - virtual unsigned __int64 DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, int eLeaderboardDataRequest, int nRangeStart, int nRangeEnd); - virtual unsigned __int64 DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, steam_id *prgUsers, int cUsers); - virtual bool GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, int *pLeaderboardEntry, int *pDetails, int cDetailsMax); - virtual unsigned __int64 UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, int eLeaderboardUploadScoreMethod, int nScore, const int *pScoreDetails, int cScoreDetailsCount); + virtual unsigned __int64 DownloadLeaderboardEntries(unsigned __int64 hSteamLeaderboard, + int eLeaderboardDataRequest, int nRangeStart, + int nRangeEnd); + virtual unsigned __int64 DownloadLeaderboardEntriesForUsers(unsigned __int64 hSteamLeaderboard, + steam_id* prgUsers, int cUsers); + virtual bool GetDownloadedLeaderboardEntry(unsigned __int64 hSteamLeaderboardEntries, int index, + int* pLeaderboardEntry, int* pDetails, int cDetailsMax); + virtual unsigned __int64 UploadLeaderboardScore(unsigned __int64 hSteamLeaderboard, + int eLeaderboardUploadScoreMethod, int nScore, + const int* pScoreDetails, int cScoreDetailsCount); virtual unsigned __int64 AttachLeaderboardUGC(unsigned __int64 hSteamLeaderboard, unsigned __int64 hUGC); virtual unsigned __int64 GetNumberOfCurrentPlayers(); virtual unsigned __int64 RequestGlobalAchievementPercentages(); - virtual int GetMostAchievedAchievementInfo(char *pchName, unsigned int unNameBufLen, float *pflPercent, bool *pbAchieved); - virtual int GetNextMostAchievedAchievementInfo(int iIteratorPrevious, char *pchName, unsigned int unNameBufLen, float *pflPercent, bool *pbAchieved); - virtual bool GetAchievementAchievedPercent(const char *pchName, float *pflPercent); + virtual 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); + 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/utils.cpp b/src/steam/interfaces/utils.cpp index 7100f41..bb05573 100644 --- a/src/steam/interfaces/utils.cpp +++ b/src/steam/interfaces/utils.cpp @@ -28,17 +28,17 @@ namespace steam return "US"; } - bool utils::GetImageSize(int iImage, unsigned int *pnWidth, unsigned int *pnHeight) + bool utils::GetImageSize(int iImage, unsigned int* pnWidth, unsigned int* pnHeight) { return false; } - bool utils::GetImageRGBA(int iImage, unsigned char *pubDest, int nDestBufferSize) + bool utils::GetImageRGBA(int iImage, unsigned char* pubDest, int nDestBufferSize) { return false; } - bool utils::GetCSERIPPort(unsigned int *unIP, unsigned short *usPort) + bool utils::GetCSERIPPort(unsigned int* unIP, unsigned short* usPort) { return false; } @@ -61,7 +61,7 @@ namespace steam } } - bool utils::IsAPICallCompleted(unsigned __int64 hSteamAPICall, bool *pbFailed) + bool utils::IsAPICallCompleted(unsigned __int64 hSteamAPICall, bool* pbFailed) { return false; } @@ -71,7 +71,8 @@ namespace steam return -1; } - bool utils::GetAPICallResult(unsigned __int64 hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed) + bool utils::GetAPICallResult(unsigned __int64 hSteamAPICall, void* pCallback, int cubCallback, + int iCallbackExpected, bool* pbFailed) { return false; } @@ -85,7 +86,7 @@ namespace steam return 0; } - void utils::SetWarningMessageHook(void(*pFunction)(int hpipe, const char *message)) + void utils::SetWarningMessageHook(void (*pFunction)(int hpipe, const char* message)) { } @@ -99,7 +100,7 @@ namespace steam return false; } - unsigned __int64 utils::CheckFileSignature(const char *szFileName) + unsigned __int64 utils::CheckFileSignature(const char* szFileName) { return 0; } diff --git a/src/steam/interfaces/utils.hpp b/src/steam/interfaces/utils.hpp index d40ce68..f2942d4 100644 --- a/src/steam/interfaces/utils.hpp +++ b/src/steam/interfaces/utils.hpp @@ -9,21 +9,22 @@ namespace steam 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 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 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 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 void SetWarningMessageHook(void (*pFunction)(int hpipe, const char* message)); virtual bool IsOverlayEnabled(); virtual bool BOverlayNeedsPresent(); - virtual unsigned __int64 CheckFileSignature(const char *szFileName); + virtual unsigned __int64 CheckFileSignature(const char* szFileName); }; } diff --git a/src/steam/steam.cpp b/src/steam/steam.cpp index 9dccd81..b37f6ae 100644 --- a/src/steam/steam.cpp +++ b/src/steam/steam.cpp @@ -76,147 +76,148 @@ namespace steam results_.clear(); } - extern "C" + extern "C" { + bool SteamAPI_RestartAppIfNecessary() { - bool SteamAPI_RestartAppIfNecessary() - { - return false; - } + return false; + } - bool SteamAPI_Init() - { - overlay = ::utils::nt::module("gameoverlayrenderer.dll"); + bool SteamAPI_Init() + { + overlay = ::utils::nt::module("gameoverlayrenderer.dll"); - if (!overlay) + if (!overlay) + { + HKEY reg_key; + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, ®_key) == + ERROR_SUCCESS) { - HKEY reg_key; - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS) + char steam_path[MAX_PATH] = {0}; + DWORD length = sizeof(steam_path); + RegQueryValueExA(reg_key, "InstallPath", nullptr, nullptr, reinterpret_cast(steam_path), + &length); + RegCloseKey(reg_key); + + std::string overlay_path = steam_path; + if (overlay_path.back() != '\\' && overlay_path.back() != '/') { - char steam_path[MAX_PATH] = { 0 }; - DWORD length = sizeof(steam_path); - RegQueryValueExA(reg_key, "InstallPath", nullptr, nullptr, reinterpret_cast(steam_path), &length); - RegCloseKey(reg_key); - - std::string overlay_path = steam_path; - if(overlay_path.back() != '\\' && overlay_path.back() != '/') - { - overlay_path.push_back('\\'); - } - - overlay_path.append("gameoverlayrenderer.dll"); - overlay = ::utils::nt::module::load(overlay_path); + overlay_path.push_back('\\'); } + + overlay_path.append("gameoverlayrenderer.dll"); + overlay = ::utils::nt::module::load(overlay_path); } - - return true; } - void SteamAPI_RegisterCallResult(callbacks::base* result, uint64_t call) - { - callbacks::register_call_result(call, result); - } + return true; + } - void SteamAPI_RegisterCallback(callbacks::base* handler, int callback) - { - callbacks::register_callback(handler, callback); - } + void SteamAPI_RegisterCallResult(callbacks::base* result, uint64_t call) + { + callbacks::register_call_result(call, result); + } - void SteamAPI_RunCallbacks() - { - callbacks::run_callbacks(); - } + void SteamAPI_RegisterCallback(callbacks::base* handler, int callback) + { + callbacks::register_callback(handler, callback); + } - void SteamAPI_Shutdown() - { - } + void SteamAPI_RunCallbacks() + { + callbacks::run_callbacks(); + } - void SteamAPI_UnregisterCallResult() - { - } + void SteamAPI_Shutdown() + { + } - void SteamAPI_UnregisterCallback() - { - } + void SteamAPI_UnregisterCallResult() + { + } + + void SteamAPI_UnregisterCallback() + { + } - bool SteamGameServer_Init() - { - return true; - } + bool SteamGameServer_Init() + { + return true; + } - void SteamGameServer_RunCallbacks() - { - } + void SteamGameServer_RunCallbacks() + { + } - void SteamGameServer_Shutdown() - { - } + void SteamGameServer_Shutdown() + { + } - friends* SteamFriends() - { - static friends friends; - return &friends; - } + friends* SteamFriends() + { + static friends friends; + return &friends; + } - matchmaking* SteamMatchmaking() - { - static matchmaking matchmaking; - return &matchmaking; - } + matchmaking* SteamMatchmaking() + { + static matchmaking matchmaking; + return &matchmaking; + } - matchmaking_servers* SteamMatchmakingServers() - { - static matchmaking_servers matchmaking_servers; - return &matchmaking_servers; - } + matchmaking_servers* SteamMatchmakingServers() + { + static matchmaking_servers matchmaking_servers; + return &matchmaking_servers; + } - game_server* SteamGameServer() - { - static game_server game_server; - return &game_server; - } + game_server* SteamGameServer() + { + static game_server game_server; + return &game_server; + } - master_server_updater* SteamMasterServerUpdater() - { - static master_server_updater master_server_updater; - return &master_server_updater; - } + master_server_updater* SteamMasterServerUpdater() + { + static master_server_updater master_server_updater; + return &master_server_updater; + } - networking* SteamNetworking() - { - static networking networking; - return &networking; - } + networking* SteamNetworking() + { + static networking networking; + return &networking; + } - remote_storage* SteamRemoteStorage() - { - static remote_storage remote_storage; - return &remote_storage; - } + remote_storage* SteamRemoteStorage() + { + static remote_storage remote_storage; + return &remote_storage; + } - user* SteamUser() - { - static user user; - return &user; - } + user* SteamUser() + { + static user user; + return &user; + } - utils* SteamUtils() - { - static utils utils; - return &utils; - } + utils* SteamUtils() + { + static utils utils; + return &utils; + } - apps* SteamApps() - { - static apps apps; - return &apps; - } + apps* SteamApps() + { + static apps apps; + return &apps; + } - user_stats* SteamUserStats() - { - static user_stats user_stats; - return &user_stats; - } + user_stats* SteamUserStats() + { + static user_stats user_stats; + return &user_stats; + } } } diff --git a/src/steam/steam.hpp b/src/steam/steam.hpp index 8086311..ddf15a2 100644 --- a/src/steam/steam.hpp +++ b/src/steam/steam.hpp @@ -8,7 +8,7 @@ struct raw_steam_id final unsigned int account_id : 32; unsigned int account_instance : 20; unsigned int account_type : 4; - int universe : 8; + int universe : 8; }; typedef union @@ -37,10 +37,12 @@ namespace steam class base { public: - base() : flags_(0), callback_(0) {}; + base() : flags_(0), callback_(0) + { + } - virtual void run(void *pv_param) = 0; - virtual void run(void *pv_param, bool failure, uint64_t handle) = 0; + virtual void run(void* pv_param) = 0; + virtual void run(void* pv_param, bool failure, uint64_t handle) = 0; virtual int get_callback_size_bytes() = 0; int get_i_callback() const { return callback_; }