Netplay: Session password - be more descriptive
This commit is contained in:
parent
d1441d8039
commit
6092011d97
|
@ -161,7 +161,7 @@ static Common::Timer s_last_host_connection_attempt;
|
||||||
|
|
||||||
/// GGPO
|
/// GGPO
|
||||||
static std::string s_local_nickname;
|
static std::string s_local_nickname;
|
||||||
static std::string s_session_password;
|
static std::string s_local_session_password;
|
||||||
static GGPOPlayerHandle s_local_handle = GGPO_INVALID_HANDLE;
|
static GGPOPlayerHandle s_local_handle = GGPO_INVALID_HANDLE;
|
||||||
static s32 s_local_delay = 0;
|
static s32 s_local_delay = 0;
|
||||||
static GGPONetworkStats s_last_net_stats{};
|
static GGPONetworkStats s_last_net_stats{};
|
||||||
|
@ -955,7 +955,7 @@ void Netplay::SendConnectRequest()
|
||||||
std::memset(pkt->nickname, 0, sizeof(pkt->nickname));
|
std::memset(pkt->nickname, 0, sizeof(pkt->nickname));
|
||||||
std::memset(pkt->session_password, 0, sizeof(pkt->session_password));
|
std::memset(pkt->session_password, 0, sizeof(pkt->session_password));
|
||||||
StringUtil::Strlcpy(pkt->nickname, s_local_nickname, std::size(pkt->nickname));
|
StringUtil::Strlcpy(pkt->nickname, s_local_nickname, std::size(pkt->nickname));
|
||||||
StringUtil::Strlcpy(pkt->session_password, s_session_password, std::size(pkt->session_password));
|
StringUtil::Strlcpy(pkt->session_password, s_local_session_password, std::size(pkt->session_password));
|
||||||
SendControlPacket(s_peers[s_host_player_id].peer, pkt);
|
SendControlPacket(s_peers[s_host_player_id].peer, pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ void Netplay::HandleMessageFromNewPeer(ENetPeer* peer, const ENetPacket* pkt)
|
||||||
response->player_id = -1;
|
response->player_id = -1;
|
||||||
|
|
||||||
// Gatekeep using the session password.
|
// Gatekeep using the session password.
|
||||||
if (msg->GetSessionPassword() != s_session_password)
|
if (msg->GetSessionPassword() != s_local_session_password)
|
||||||
{
|
{
|
||||||
response->result = JoinResponseMessage::Result::InvalidPassword;
|
response->result = JoinResponseMessage::Result::InvalidPassword;
|
||||||
SendControlPacket(peer, response);
|
SendControlPacket(peer, response);
|
||||||
|
@ -1871,12 +1871,13 @@ void Netplay::SetInputs(Netplay::Input inputs[2])
|
||||||
|
|
||||||
bool Netplay::CreateSession(std::string nickname, s32 port, s32 max_players, std::string password)
|
bool Netplay::CreateSession(std::string nickname, s32 port, s32 max_players, std::string password)
|
||||||
{
|
{
|
||||||
s_session_password = password;
|
s_local_session_password = password;
|
||||||
|
|
||||||
// TODO: This is going to blow away our memory cards, because for sync purposes we want all clients
|
// TODO: This is going to blow away our memory cards, because for sync purposes we want all clients
|
||||||
// to have the same data, and we don't want to trash their local memcards. We should therefore load
|
// to have the same data, and we don't want to trash their local memcards. We should therefore load
|
||||||
// the memory cards for this game (based on game/global settings), and copy that to the temp card.
|
// the memory cards for this game (based on game/global settings), and copy that to the temp card.
|
||||||
|
|
||||||
|
// TODO: input delay. GGPO Should support changing it on the fly.
|
||||||
const s32 input_delay = 1;
|
const s32 input_delay = 1;
|
||||||
|
|
||||||
if (!Netplay::Start(true, std::move(nickname), std::string(), port, input_delay))
|
if (!Netplay::Start(true, std::move(nickname), std::string(), port, input_delay))
|
||||||
|
@ -1895,7 +1896,7 @@ bool Netplay::CreateSession(std::string nickname, s32 port, s32 max_players, std
|
||||||
|
|
||||||
bool Netplay::JoinSession(std::string nickname, const std::string& hostname, s32 port, std::string password)
|
bool Netplay::JoinSession(std::string nickname, const std::string& hostname, s32 port, std::string password)
|
||||||
{
|
{
|
||||||
s_session_password = password;
|
s_local_session_password = password;
|
||||||
// TODO: input delay. GGPO Should support changing it on the fly.
|
// TODO: input delay. GGPO Should support changing it on the fly.
|
||||||
const s32 input_delay = 1;
|
const s32 input_delay = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue