From 8a7cbf2f669d5706cf88653cc4b0b37ed1d803f4 Mon Sep 17 00:00:00 2001 From: HeatXD <45072324+HeatXD@users.noreply.github.com> Date: Wed, 10 May 2023 05:01:55 +0200 Subject: [PATCH] Netplay / Qt: remove ping widget from mainwindow. --- src/core/netplay.cpp | 12 +++++++----- src/duckstation-qt/mainwindow.cpp | 5 ----- src/duckstation-qt/mainwindow.h | 2 -- src/duckstation-qt/qthost.cpp | 8 -------- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/core/netplay.cpp b/src/core/netplay.cpp index d32b5deab..b6a802580 100644 --- a/src/core/netplay.cpp +++ b/src/core/netplay.cpp @@ -523,10 +523,6 @@ void Netplay::HandleEnetEvent(const ENetEvent* event) { HandleControlMessage(player_id, event->packet); } - else if (event->channelID == ENET_CHANNEL_SESSION) - { - HandleSessionMessage(player_id, event->packet); - } else if (event->channelID == ENET_CHANNEL_GGPO) { Log_TracePrintf("Received %zu ggpo bytes from player %d", event->packet->dataLength, player_id); @@ -534,6 +530,10 @@ void Netplay::HandleEnetEvent(const ENetEvent* event) if (rc != GGPO_OK) Log_ErrorPrintf("Failed to process GGPO packet!"); } + else if (event->channelID == ENET_CHANNEL_SESSION) + { + HandleSessionMessage(player_id, event->packet); + } else { Log_ErrorPrintf("Unexpected packet channel %u", event->channelID); @@ -1095,7 +1095,7 @@ void Netplay::HandleSessionChatMessage(s32 player_id, const ENetPacket* pkt) std::string message(pkt->data + sizeof(SessionChatMessage), pkt->data + sizeof(SessionChatMessage) + msg->chat_message_size); - Host::OnNetplayMessage(fmt::format("Player {}: {}", player_id + 1, message)); + Host::OnNetplayMessage(fmt::format("Player {}: {}", PlayerIdToGGPOHandle(player_id), message)); } void Netplay::CheckForCompleteResynchronize() @@ -1132,6 +1132,8 @@ void Netplay::SetSettings() // no block linking, it degrades savestate loading performance si.SetBoolValue("CPU", "RecompilerBlockLinking", false); + // not sure its needed but enabled for now... TODO + si.SetBoolValue("GPU", "UseSoftwareRendererForReadbacks", true); Host::Internal::SetNetplaySettingsLayer(&si); System::ApplySettings(false); diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 5d7d61cf4..5ae89e482 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1568,10 +1568,6 @@ void MainWindow::setupAdditionalUi() m_status_vps_widget->setFixedSize(120, 16); m_status_vps_widget->hide(); - m_status_ping_widget = new QLabel(m_ui.statusBar); - m_status_ping_widget->setFixedSize(110, 16); - m_status_ping_widget->hide(); - m_settings_toolbar_menu = new QMenu(m_ui.toolBar); m_settings_toolbar_menu->addAction(m_ui.actionSettings); m_settings_toolbar_menu->addAction(m_ui.actionViewGameProperties); @@ -1777,7 +1773,6 @@ void MainWindow::updateStatusBarWidgetVisibility() Update(m_status_resolution_widget, s_system_valid && !s_system_paused, 0); Update(m_status_fps_widget, s_system_valid && !s_system_paused, 0); Update(m_status_vps_widget, s_system_valid && !s_system_paused, 0); - Update(m_status_ping_widget, s_system_valid && !s_system_paused && m_netplay_window != nullptr, 0); } void MainWindow::updateWindowTitle() diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 6aa3ecc0c..20ce67b66 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -90,7 +90,6 @@ public: ALWAYS_INLINE QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; } ALWAYS_INLINE QLabel* getStatusFPSWidget() const { return m_status_fps_widget; } ALWAYS_INLINE QLabel* getStatusVPSWidget() const { return m_status_vps_widget; } - ALWAYS_INLINE QLabel* getStatusPingWidget() const { return m_status_ping_widget; } public Q_SLOTS: /// Updates debug menu visibility (hides if disabled). @@ -266,7 +265,6 @@ private: QLabel* m_status_renderer_widget = nullptr; QLabel* m_status_fps_widget = nullptr; QLabel* m_status_vps_widget = nullptr; - QLabel* m_status_ping_widget = nullptr; QLabel* m_status_resolution_widget = nullptr; QMenu* m_settings_toolbar_menu = nullptr; diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index b8aab71f0..c68aea10b 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -1709,14 +1709,6 @@ void EmuThread::updatePerformanceCounters() m_last_speed = speed; m_last_video_fps = vfps; } - - const s32 ping = Netplay::GetPing(); - if (m_last_ping != ping) - { - QMetaObject::invokeMethod(g_main_window->getStatusPingWidget(), "setText", Qt::QueuedConnection, - Q_ARG(const QString&, tr("Netplay Ping: %1 ").arg(ping, 0, 'f', 0))); - m_last_ping = ping; - } } void EmuThread::resetPerformanceCounters()