Traversal: Notify user of TTL to be used

This commit is contained in:
Floogle 2023-01-12 19:46:02 +01:00
parent 4f11b0d4c9
commit 5c1c22bab9
7 changed files with 16 additions and 0 deletions

View File

@ -388,6 +388,7 @@ void TraversalClient::HandleTraversalTest()
{
// success, we can stop now
m_ttlReady = true;
m_Client->OnTtlDetermined(m_ttl);
}
else
{

View File

@ -24,6 +24,7 @@ public:
virtual void OnTraversalStateChanged() = 0;
virtual void OnConnectReady(ENetAddress addr) = 0;
virtual void OnConnectFailed(TraversalConnectFailedReason reason) = 0;
virtual void OnTtlDetermined(u8 ttl) = 0;
};
class TraversalClient

View File

@ -72,6 +72,7 @@ public:
virtual void OnTraversalStateChanged(Common::TraversalClient::State state) = 0;
virtual void OnGameStartAborted() = 0;
virtual void OnGolferChanged(bool is_golfer, const std::string& golfer_name) = 0;
virtual void OnTtlDetermined(u8 ttl) = 0;
virtual bool IsRecording() = 0;
virtual std::shared_ptr<const UICommon::GameFile>
@ -148,6 +149,7 @@ public:
void OnTraversalStateChanged() override;
void OnConnectReady(ENetAddress addr) override;
void OnConnectFailed(Common::TraversalConnectFailedReason reason) override;
void OnTtlDetermined(u8 ttl) override {}
bool IsFirstInGamePad(int ingame_pad) const;
int NumLocalPads() const;

View File

@ -1265,6 +1265,11 @@ void NetPlayServer::OnTraversalStateChanged()
m_dialog->OnTraversalStateChanged(state);
}
void NetPlayServer::OnTtlDetermined(u8 ttl)
{
m_dialog->OnTtlDetermined(ttl);
}
// called from ---GUI--- thread
void NetPlayServer::SendChatMessage(const std::string& msg)
{

View File

@ -144,6 +144,7 @@ private:
void OnTraversalStateChanged() override;
void OnConnectReady(ENetAddress) override {}
void OnConnectFailed(Common::TraversalConnectFailedReason) override {}
void OnTtlDetermined(u8 ttl) override;
void UpdatePadMapping();
void UpdateGBAConfig();
void UpdateWiimoteMapping();

View File

@ -1037,6 +1037,11 @@ void NetPlayDialog::OnGolferChanged(const bool is_golfer, const std::string& gol
DisplayMessage(tr("%1 is now golfing").arg(QString::fromStdString(golfer_name)), "");
}
void NetPlayDialog::OnTtlDetermined(u8 ttl)
{
DisplayMessage(tr("Using TTL %1 for probe packet").arg(QString::number(ttl)), "");
}
bool NetPlayDialog::IsRecording()
{
std::optional<bool> is_recording = RunOnObject(m_record_input_action, &QAction::isChecked);

View File

@ -71,6 +71,7 @@ public:
void OnTraversalStateChanged(Common::TraversalClient::State state) override;
void OnGameStartAborted() override;
void OnGolferChanged(bool is_golfer, const std::string& golfer_name) override;
void OnTtlDetermined(u8 ttl) override;
void OnIndexAdded(bool success, const std::string error) override;
void OnIndexRefreshFailed(const std::string error) override;