From e0f1b6b7d9c69f185be5cea5ce3220fbdc80e16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Mar 2026 09:00:50 +0100 Subject: [PATCH] Move the "localhost = multiple instances" hint into the adhoc server selector --- UI/AdhocServerScreen.cpp | 6 ++++++ UI/GameSettingsScreen.cpp | 18 ------------------ UI/MiscViews.cpp | 14 ++++++++++++++ UI/MiscViews.h | 6 ++++++ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/UI/AdhocServerScreen.cpp b/UI/AdhocServerScreen.cpp index 14e410033d..284b677f72 100644 --- a/UI/AdhocServerScreen.cpp +++ b/UI/AdhocServerScreen.cpp @@ -5,6 +5,7 @@ #include "Common/UI/Root.h" #include "Common/StringUtils.h" #include "Core/HLE/sceNetAdhoc.h" +#include "UI/MiscViews.h" class AdhocAddServerPopupScreen : public UI::PopupScreen { public: @@ -199,6 +200,11 @@ AdhocServerRow::AdhocServerRow(std::string *editValue, const AdhocServerListEntr lines->Add(new TextView(entry.name)); std::string secondLine = entry.host; + if (entry.host == "localhost") { + // Special case this to add a hint. + auto n = GetI18NCategory(I18NCat::NETWORKING); + secondLine = n->T("Change proAdhocServer address hint"); + } if (!entry.location.empty()) { secondLine += ": " + entry.location; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 58795beaae..edfe4b41aa 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -112,23 +112,6 @@ void SetMemStickDirDarwin(int requesterToken) { } #endif -class SettingHint : public UI::TextView { -public: - SettingHint(std::string_view text) - : UI::TextView(text, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT)) { - SetTextSize(UI::TextSize::Tiny); - SetPadding(UI::Margins(14, 0, 12, 8)); - SetAlign(FLAG_WRAP_TEXT); - } - - void Draw(UIContext &dc) override { - UI::Style style = dc.GetTheme().itemStyle; - SetTextColor(style.fgColor); // bit hacky but works - dc.FillRect(style.background, bounds_); - UI::TextView::Draw(dc); - } -}; - GameSettingsScreen::GameSettingsScreen(const Path &gamePath, std::string gameID, bool editThenRestore) : UITabbedBaseDialogScreen(gamePath, TabDialogFlags::HorizontalOnlyIcons | TabDialogFlags::VerticalShowIcons), gameID_(gameID), editGameSpecificThenRestore_(editThenRestore) { prevInflightFrames_ = g_Config.iInflightFrames; @@ -1043,7 +1026,6 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.sProAdhocServer, n->T("Change proAdhocServer Address"), I18NCat::NONE))->OnClick.Add([=](UI::EventParams &) { screenManager()->push(new AdhocServerScreen(&g_Config.sProAdhocServer, n->T("Ad hoc server address"))); }); - networkingSettings->Add(new SettingHint(n->T("Change proAdhocServer address hint"))); static const char *relayModes[] = {"Auto", "Yes", "No"}; PopupMultiChoice *relayModePopup = networkingSettings->Add(new PopupMultiChoice(&g_Config.iAdhocServerRelayMode, n->T("Try to use server-provided packet relay"), relayModes, 0, ARRAY_SIZE(relayModes), I18NCat::DIALOG, screenManager())); diff --git a/UI/MiscViews.cpp b/UI/MiscViews.cpp index b1de99e236..c5b8d3e6c4 100644 --- a/UI/MiscViews.cpp +++ b/UI/MiscViews.cpp @@ -291,3 +291,17 @@ void GameInfoBGView::Draw(UIContext &dc) { } } } + +SettingHint::SettingHint(std::string_view text) + : UI::TextView(text, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT)) { + SetTextSize(UI::TextSize::Tiny); + SetPadding(UI::Margins(14, 0, 12, 8)); + SetAlign(FLAG_WRAP_TEXT); +} + +void SettingHint::Draw(UIContext &dc) { + UI::Style style = dc.GetTheme().itemStyle; + SetTextColor(style.fgColor); // bit hacky but works + dc.FillRect(style.background, bounds_); + UI::TextView::Draw(dc); +} diff --git a/UI/MiscViews.h b/UI/MiscViews.h index 7f233fb45e..7730a5786b 100644 --- a/UI/MiscViews.h +++ b/UI/MiscViews.h @@ -90,4 +90,10 @@ protected: uint32_t color_ = 0xFFC0C0C0; }; +class SettingHint : public UI::TextView { +public: + SettingHint(std::string_view text); + void Draw(UIContext &dc) override; +}; + void AddRotationPicker(ScreenManager *screenManager, UI::ViewGroup *parent, bool text);