[Steam] Adapt steam structures to our style

This commit is contained in:
momo5502 2017-02-18 09:42:55 +01:00
parent 62200ebb9b
commit d32dfc712a
9 changed files with 52 additions and 52 deletions

View File

@ -88,7 +88,7 @@ namespace Components
if (!Components::Flags::HasFlag("nosteam") && !Dvar::Var("cl_anonymous").get<bool>() && Steam::Proxy::SteamUser_) if (!Components::Flags::HasFlag("nosteam") && !Dvar::Var("cl_anonymous").get<bool>() && Steam::Proxy::SteamUser_)
{ {
infostr.set("realsteamId", Utils::String::VA("%llX", Steam::Proxy::SteamUser_->GetSteamID().Bits)); infostr.set("realsteamId", Utils::String::VA("%llX", Steam::Proxy::SteamUser_->GetSteamID().bits));
} }
// Build new connect string // Build new connect string
@ -179,7 +179,7 @@ namespace Components
unsigned __int64 xuid = strtoull(steamId.data(), nullptr, 16); unsigned __int64 xuid = strtoull(steamId.data(), nullptr, 16);
SteamID guid; SteamID guid;
guid.Bits = xuid; guid.bits = xuid;
if (Bans::IsBanned({ guid, address.getIP() })) if (Bans::IsBanned({ guid, address.getIP() }))
{ {
@ -424,7 +424,7 @@ namespace Components
// Guid command // Guid command
Command::Add("guid", [] (Command::Params*) Command::Add("guid", [] (Command::Params*)
{ {
Logger::Print("Your guid: %llX\n", Steam::SteamUser()->GetSteamID().Bits); Logger::Print("Your guid: %llX\n", Steam::SteamUser()->GetSteamID().bits);
}); });
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled())

View File

@ -9,11 +9,11 @@ namespace Components
Bans::BanList list; Bans::BanList list;
Bans::LoadBans(&list); Bans::LoadBans(&list);
if (entry.first.Bits) if (entry.first.bits)
{ {
for (auto& idEntry : list.idList) for (auto& idEntry : list.idList)
{ {
if (idEntry.Bits == entry.first.Bits) if (idEntry.bits == entry.first.bits)
{ {
return true; return true;
} }
@ -41,12 +41,12 @@ namespace Components
std::lock_guard<std::mutex> _(Bans::AccessMutex); std::lock_guard<std::mutex> _(Bans::AccessMutex);
if (entry.first.Bits) if (entry.first.bits)
{ {
bool found = false; bool found = false;
for (auto& idEntry : list.idList) for (auto& idEntry : list.idList)
{ {
if (idEntry.Bits == entry.first.Bits) if (idEntry.bits == entry.first.bits)
{ {
found = true; found = true;
break; break;
@ -82,7 +82,7 @@ namespace Components
for (auto& idEntry : list.idList) for (auto& idEntry : list.idList)
{ {
idVector.push_back(Utils::String::VA("%llX", idEntry.Bits)); idVector.push_back(Utils::String::VA("%llX", idEntry.bits));
} }
for (auto& ipEntry : list.ipList) for (auto& ipEntry : list.ipList)
@ -138,7 +138,7 @@ namespace Components
if (idEntry.is_string()) if (idEntry.is_string())
{ {
SteamID id; SteamID id;
id.Bits = strtoull(idEntry.string_value().data(), nullptr, 16); id.bits = strtoull(idEntry.string_value().data(), nullptr, 16);
list->idList.push_back(id); list->idList.push_back(id);
} }
@ -178,7 +178,7 @@ namespace Components
Game::client_t* client = &Game::svs_clients[num]; Game::client_t* client = &Game::svs_clients[num];
SteamID guid; SteamID guid;
guid.Bits = client->steamid; guid.bits = client->steamid;
Bans::InsertBan({ guid, client->addr.ip }); Bans::InsertBan({ guid, client->addr.ip });

View File

@ -220,8 +220,8 @@ namespace Components
{ {
for (int client = 0; client < 18; client++) for (int client = 0; client < 18; client++)
{ {
Dedicated::PlayerGuids[client][0].Bits = strtoull(params.get(2 * client + 1), nullptr, 16); Dedicated::PlayerGuids[client][0].bits = strtoull(params.get(2 * client + 1), nullptr, 16);
Dedicated::PlayerGuids[client][1].Bits = strtoull(params.get(2 * client + 2), nullptr, 16); Dedicated::PlayerGuids[client][1].bits = strtoull(params.get(2 * client + 2), nullptr, 16);
if(Steam::Proxy::SteamFriends) if(Steam::Proxy::SteamFriends)
{ {
@ -557,8 +557,8 @@ namespace Components
{ {
for(int i = 0; i < ARRAYSIZE(Dedicated::PlayerGuids); ++i) for(int i = 0; i < ARRAYSIZE(Dedicated::PlayerGuids); ++i)
{ {
Dedicated::PlayerGuids[i][0].Bits = 0; Dedicated::PlayerGuids[i][0].bits = 0;
Dedicated::PlayerGuids[i][1].Bits = 0; Dedicated::PlayerGuids[i][1].bits = 0;
} }
// Intercept server commands // Intercept server commands

View File

@ -66,7 +66,7 @@ namespace Components
auto entry = std::find_if(Friends::FriendsList.begin(), Friends::FriendsList.end(), [user](Friends::Friend entry) auto entry = std::find_if(Friends::FriendsList.begin(), Friends::FriendsList.end(), [user](Friends::Friend entry)
{ {
return (entry.userId.Bits == user.Bits); return (entry.userId.bits == user.bits);
}); });
if (entry == Friends::FriendsList.end() || !Steam::Proxy::SteamFriends) return; if (entry == Friends::FriendsList.end() || !Steam::Proxy::SteamFriends) return;
@ -80,7 +80,7 @@ namespace Components
std::string experience = Friends::GetPresence(user, "iw4x_experience"); std::string experience = Friends::GetPresence(user, "iw4x_experience");
std::string prestige = Friends::GetPresence(user, "iw4x_prestige"); std::string prestige = Friends::GetPresence(user, "iw4x_prestige");
if (!guid.empty()) entry->guid.Bits = strtoull(guid.data(), nullptr, 16); if (!guid.empty()) entry->guid.bits = strtoull(guid.data(), nullptr, 16);
if (!name.empty()) entry->playerName = name; if (!name.empty()) entry->playerName = name;
if (!experience.empty()) entry->experience = atoi(experience.data()); if (!experience.empty()) entry->experience = atoi(experience.data());
if (!prestige.empty()) entry->prestige = atoi(prestige.data()); if (!prestige.empty()) entry->prestige = atoi(prestige.data());
@ -215,7 +215,7 @@ namespace Components
for (auto entry : Friends::FriendsList) for (auto entry : Friends::FriendsList)
{ {
if (entry.guid.Bits == guid.Bits && Friends::IsOnline(entry.lastTime) && entry.online) if (entry.guid.bits == guid.bits && Friends::IsOnline(entry.lastTime) && entry.online)
{ {
return true; return true;
} }
@ -262,7 +262,7 @@ namespace Components
Friends::Friend entry; Friends::Friend entry;
entry.userId = id; entry.userId = id;
entry.guid.Bits = 0; entry.guid.bits = 0;
entry.online = false; entry.online = false;
entry.lastTime = 0; entry.lastTime = 0;
entry.prestige = 0; entry.prestige = 0;
@ -271,19 +271,19 @@ namespace Components
for(auto storedFriend : list.friends()) for(auto storedFriend : list.friends())
{ {
if(entry.userId.Bits == strtoull(storedFriend.steamid().data(), nullptr, 16)) if(entry.userId.bits == strtoull(storedFriend.steamid().data(), nullptr, 16))
{ {
entry.playerName = storedFriend.name(); entry.playerName = storedFriend.name();
entry.experience = storedFriend.experience(); entry.experience = storedFriend.experience();
entry.prestige = storedFriend.prestige(); entry.prestige = storedFriend.prestige();
entry.guid.Bits = strtoull(storedFriend.guid().data(), nullptr, 16); entry.guid.bits = strtoull(storedFriend.guid().data(), nullptr, 16);
break; break;
} }
} }
auto oldEntry = std::find_if(Friends::FriendsList.begin(), Friends::FriendsList.end(), [id](Friends::Friend entry) auto oldEntry = std::find_if(Friends::FriendsList.begin(), Friends::FriendsList.end(), [id](Friends::Friend entry)
{ {
return (entry.userId.Bits == id.Bits); return (entry.userId.bits == id.bits);
}); });
if (oldEntry != Friends::FriendsList.end()) entry = *oldEntry; if (oldEntry != Friends::FriendsList.end()) entry = *oldEntry;
@ -298,7 +298,7 @@ namespace Components
auto oldEntry = std::find_if(steamFriends.begin(), steamFriends.end(), [id](Friends::Friend entry) auto oldEntry = std::find_if(steamFriends.begin(), steamFriends.end(), [id](Friends::Friend entry)
{ {
return (entry.userId.Bits == id.Bits); return (entry.userId.bits == id.bits);
}); });
if(oldEntry == steamFriends.end()) if(oldEntry == steamFriends.end())
@ -422,7 +422,7 @@ namespace Components
void Friends::UpdateTimeStamp() void Friends::UpdateTimeStamp()
{ {
Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::SteamUtils()->GetServerRealTime())); Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::SteamUtils()->GetServerRealTime()));
Friends::SetPresence("iw4x_guid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().Bits)); Friends::SetPresence("iw4x_guid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().bits));
} }
bool Friends::IsOnline(unsigned __int64 timeStamp) bool Friends::IsOnline(unsigned __int64 timeStamp)
@ -442,8 +442,8 @@ namespace Components
{ {
Proto::Friends::Friend* friendEntry = list.add_friends(); Proto::Friends::Friend* friendEntry = list.add_friends();
friendEntry->set_steamid(Utils::String::VA("%llX", entry.userId.Bits)); friendEntry->set_steamid(Utils::String::VA("%llX", entry.userId.bits));
friendEntry->set_guid(Utils::String::VA("%llX", entry.guid.Bits)); friendEntry->set_guid(Utils::String::VA("%llX", entry.guid.bits));
friendEntry->set_name(entry.playerName); friendEntry->set_name(entry.playerName);
friendEntry->set_experience(entry.experience); friendEntry->set_experience(entry.experience);
friendEntry->set_prestige(entry.prestige); friendEntry->set_prestige(entry.prestige);
@ -462,7 +462,7 @@ namespace Components
{ {
if (params->length() <= 1) return; if (params->length() <= 1) return;
SteamID id; SteamID id;
id.Bits = atoll(params->get(1)); id.bits = atoll(params->get(1));
Friends::AddFriend(id); Friends::AddFriend(id);
}); });

View File

@ -9,10 +9,10 @@ namespace Components
{ {
SteamID id; SteamID id;
id.AccountID = Game::Sys_Milliseconds(); id.accountID = Game::Sys_Milliseconds();
id.Universe = 1; id.universe = 1;
id.AccountType = 8; id.accountType = 8;
id.AccountInstance = 0x40000; id.accountInstance = 0x40000;
return id; return id;
} }
@ -39,9 +39,9 @@ namespace Components
const char* Party::GetLobbyInfo(SteamID lobby, std::string key) const char* Party::GetLobbyInfo(SteamID lobby, std::string key)
{ {
if (Party::LobbyMap.find(lobby.Bits) != Party::LobbyMap.end()) if (Party::LobbyMap.find(lobby.bits) != Party::LobbyMap.end())
{ {
Network::Address address = Party::LobbyMap[lobby.Bits]; Network::Address address = Party::LobbyMap[lobby.bits];
if (key == "addr") if (key == "addr")
{ {
@ -58,9 +58,9 @@ namespace Components
void Party::RemoveLobby(SteamID lobby) void Party::RemoveLobby(SteamID lobby)
{ {
if (Party::LobbyMap.find(lobby.Bits) != Party::LobbyMap.end()) if (Party::LobbyMap.find(lobby.bits) != Party::LobbyMap.end())
{ {
Party::LobbyMap.erase(Party::LobbyMap.find(lobby.Bits)); Party::LobbyMap.erase(Party::LobbyMap.find(lobby.bits));
} }
} }
@ -115,7 +115,7 @@ namespace Components
} }
} }
Party::LobbyMap[id.Bits] = Party::Container.target; Party::LobbyMap[id.bits] = Party::Container.target;
Game::Steam_JoinLobby(id, 0); Game::Steam_JoinLobby(id, 0);
} }
@ -313,7 +313,7 @@ namespace Components
info.set("hostname", Dvar::Var("sv_hostname").get<const char*>()); info.set("hostname", Dvar::Var("sv_hostname").get<const char*>());
info.set("gametype", Dvar::Var("g_gametype").get<const char*>()); info.set("gametype", Dvar::Var("g_gametype").get<const char*>());
info.set("fs_game", Dvar::Var("fs_game").get<const char*>()); info.set("fs_game", Dvar::Var("fs_game").get<const char*>());
info.set("xuid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().Bits)); info.set("xuid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().bits));
info.set("clients", Utils::String::VA("%i", clientCount)); info.set("clients", Utils::String::VA("%i", clientCount));
info.set("sv_maxclients", Utils::String::VA("%i", maxclientCount)); info.set("sv_maxclients", Utils::String::VA("%i", maxclientCount));
info.set("protocol", Utils::String::VA("%i", PROTOCOL)); info.set("protocol", Utils::String::VA("%i", PROTOCOL));

View File

@ -56,10 +56,10 @@ namespace Steam
LobbyCreated* retvals = ::Utils::Memory::Allocate<LobbyCreated>(); LobbyCreated* retvals = ::Utils::Memory::Allocate<LobbyCreated>();
SteamID id; SteamID id;
id.AccountID = 1337132; id.accountID = 1337132;
id.Universe = 1; id.universe = 1;
id.AccountType = 8; id.accountType = 8;
id.AccountInstance = 0x40000; id.accountInstance = 0x40000;
retvals->m_eResult = 1; retvals->m_eResult = 1;
retvals->m_ulSteamIDLobby = id; retvals->m_ulSteamIDLobby = id;

View File

@ -36,7 +36,7 @@ namespace Steam
} }
} }
id.Bits = idBits; id.bits = idBits;
return id; return id;
} }

View File

@ -93,9 +93,9 @@ namespace Steam
if (!Proxy::ClientUser || Components::Flags::HasFlag("nosteam") || Components::Dedicated::IsEnabled()) return; if (!Proxy::ClientUser || Components::Flags::HasFlag("nosteam") || Components::Dedicated::IsEnabled()) return;
GameID_t gameID; GameID_t gameID;
gameID.m_nType = 1; // k_EGameIDTypeGameMod gameID.type = 1; // k_EGameIDTypeGameMod
gameID.m_nAppID = Proxy::AppId & 0xFFFFFF; gameID.appID = Proxy::AppId & 0xFFFFFF;
gameID.m_nModID = 0xBAADF00D; gameID.modID = 0xBAADF00D;
Interface clientApps(Proxy::ClientEngine->GetIClientApps(Proxy::SteamUser, Proxy::SteamPipe, "CLIENTAPPS_INTERFACE_VERSION001")); Interface clientApps(Proxy::ClientEngine->GetIClientApps(Proxy::SteamUser, Proxy::SteamPipe, "CLIENTAPPS_INTERFACE_VERSION001"));
Interface clientShortcuts(Proxy::ClientEngine->GetIClientShortcuts(Proxy::SteamUser, Proxy::SteamPipe, "CLIENTSHORTCUTS_INTERFACE_VERSION001")); Interface clientShortcuts(Proxy::ClientEngine->GetIClientShortcuts(Proxy::SteamUser, Proxy::SteamPipe, "CLIENTSHORTCUTS_INTERFACE_VERSION001"));

View File

@ -11,13 +11,13 @@ typedef union
{ {
struct struct
{ {
unsigned int AccountID : 32; unsigned int accountID : 32;
unsigned int AccountInstance : 20; unsigned int accountInstance : 20;
unsigned int AccountType : 4; unsigned int accountType : 4;
int Universe : 8; int universe : 8;
}; };
unsigned long long Bits; unsigned long long bits;
} SteamID; } SteamID;
@ -26,9 +26,9 @@ typedef union
{ {
struct struct
{ {
unsigned int m_nAppID : 24; unsigned int appID : 24;
unsigned int m_nType : 8; unsigned int type : 8;
unsigned int m_nModID : 32; unsigned int modID : 32;
}; };
unsigned long long bits; unsigned long long bits;