From 1354fa689ab0e8cde06b75789ab53b5f4edd532b Mon Sep 17 00:00:00 2001 From: Bottinator22 Date: Tue, 1 Apr 2025 09:54:35 -0700 Subject: configurable number of post-process shader passes --- source/client/StarClientApplication.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source/client/StarClientApplication.cpp') diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 3c7ec8d..7c1af16 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -492,6 +492,7 @@ void ClientApplication::renderReload() { // define post process layers and optionally assign them to groups m_postProcessLayers.clear(); + m_labelledPostProcessLayers.clear(); auto postProcessLayers = assets->json("/client.config:postProcessLayers").toArray(); for (auto& layer : postProcessLayers) { auto effects = jsonToStringList(layer.getArray("effects")); @@ -502,18 +503,28 @@ void ClientApplication::renderReload() { if (gname) { group = &m_postProcessGroups.get(gname.value()); } + // I'd think a string map for all of these would be better, but the order does matter here, and does make sense to depend on mod priority, so... + // guess a string map of indices works + // I tried pointers but for whatever reason the behaviour was highly inconsistent and only worked after reload... + auto label = layer.optString("name"); + if (label) { + m_labelledPostProcessLayers.add(label.value(),m_postProcessLayers.count()); + } m_postProcessLayers.append(PostProcessLayer{ std::move(effects), (unsigned)layer.getUInt("passes", 1), group }); } loadEffectConfig("interface"); } -void ClientApplication::setPostProcessGroupEnabled(String group, bool enabled, Maybe save) { +void ClientApplication::setPostProcessLayerPasses(String const& layer, unsigned const& passes) { + m_postProcessLayers.at(m_labelledPostProcessLayers.get(layer)).passes = passes; +} +void ClientApplication::setPostProcessGroupEnabled(String const& group, bool const& enabled, Maybe const& save) { m_postProcessGroups.get(group).enabled = enabled; if (save && save.value()) m_root->configuration()->setPath(strf("{}.{}.enabled", postProcessGroupsRoot, group),enabled); } -bool ClientApplication::postProcessGroupEnabled(String group) { +bool ClientApplication::postProcessGroupEnabled(String const& group) { return m_postProcessGroups.get(group).enabled; } -- cgit v1.2.3 From 6369ba9ec72f097d8cc9ab06bed0c6816da516c8 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 25 Apr 2025 05:40:33 +1000 Subject: add OpenStarbound version string, log it --- source/client/StarClientApplication.cpp | 2 +- source/core/StarVersion.cpp.in | 1 + source/core/StarVersion.hpp | 1 + source/server/main.cpp | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) (limited to 'source/client/StarClientApplication.cpp') diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 7c1af16..a86a574 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -151,7 +151,7 @@ void ClientApplication::startup(StringList const& cmdLineArgs) { RootLoader rootLoader({AdditionalAssetsSettings, AdditionalDefaultConfiguration, String("starbound.log"), LogLevel::Info, false, String("starbound.config")}); m_root = rootLoader.initOrDie(cmdLineArgs).first; - Logger::info("Client Version {} ({}) Source ID: {} Protocol: {}", StarVersionString, StarArchitectureString, StarSourceIdentifierString, StarProtocolVersion); + Logger::info("OpenStarbound Client v{} for v{} ({}) Source ID: {} Protocol: {}", OpenStarVersionString, StarVersionString, StarArchitectureString, StarSourceIdentifierString, StarProtocolVersion); } void ClientApplication::shutdown() { diff --git a/source/core/StarVersion.cpp.in b/source/core/StarVersion.cpp.in index 0529c19..bb6ae0b 100644 --- a/source/core/StarVersion.cpp.in +++ b/source/core/StarVersion.cpp.in @@ -2,6 +2,7 @@ namespace Star { +char const* const OpenStarVersionString = "0.1.9"; char const* const StarVersionString = "1.4.4"; char const* const StarSourceIdentifierString = "${STAR_SOURCE_IDENTIFIER}"; char const* const StarArchitectureString = "${STAR_SYSTEM} ${STAR_ARCHITECTURE}"; diff --git a/source/core/StarVersion.hpp b/source/core/StarVersion.hpp index ad65875..90bc7ea 100644 --- a/source/core/StarVersion.hpp +++ b/source/core/StarVersion.hpp @@ -4,6 +4,7 @@ namespace Star { +extern char const* const OpenStarVersionString; extern char const* const StarVersionString; extern char const* const StarSourceIdentifierString; extern char const* const StarArchitectureString; diff --git a/source/server/main.cpp b/source/server/main.cpp index de09efa..ac40524 100644 --- a/source/server/main.cpp +++ b/source/server/main.cpp @@ -45,7 +45,7 @@ int main(int argc, char** argv) { auto configuration = root->configuration(); { - Logger::info("Server Version {} ({}) Source ID: {} Protocol: {}", StarVersionString, StarArchitectureString, StarSourceIdentifierString, StarProtocolVersion); + Logger::info("OpenStarbound Server v{} for v{} ({}) Source ID: {} Protocol: {}", OpenStarVersionString, StarVersionString, StarArchitectureString, StarSourceIdentifierString, StarProtocolVersion); float updateRate = 1.0f / GlobalTimestep; if (auto jUpdateRate = configuration->get("updateRate")) { -- cgit v1.2.3 From 621864b9b00ba7a9ae0fceb0a7db3ace6d4906b9 Mon Sep 17 00:00:00 2001 From: Bottinator22 Date: Fri, 25 Apr 2025 00:27:10 -0700 Subject: allow forcing legacy connections --- .../windowconfig/multiplayer.config.patch | 22 +++++++++++++++++++++- source/client/StarClientApplication.cpp | 11 ++++++++--- source/client/StarClientApplication.hpp | 1 + source/frontend/StarTitleScreen.cpp | 17 ++++++++++++++++- source/frontend/StarTitleScreen.hpp | 4 ++++ source/game/StarUniverseClient.cpp | 12 +++++++----- source/game/StarUniverseClient.hpp | 2 +- 7 files changed, 58 insertions(+), 11 deletions(-) (limited to 'source/client/StarClientApplication.cpp') diff --git a/assets/opensb/interface/windowconfig/multiplayer.config.patch b/assets/opensb/interface/windowconfig/multiplayer.config.patch index 8bd27c1..bfd6297 100644 --- a/assets/opensb/interface/windowconfig/multiplayer.config.patch +++ b/assets/opensb/interface/windowconfig/multiplayer.config.patch @@ -4,5 +4,25 @@ "anchor" : "center", "positionLocked" : true }, + "connect": { + "position" : [34, 32] + }, + "legacyLabel" : { + "type" : "label", + "position" : [130, 34], + "hAnchor" : "left", + "value" : "FORCE LEGACY" + }, + "legacyCheckbox" : { + "type" : "button", + "pressedOffset" : [0, 0], + "position" : [120, 34], + "base" : "/interface/optionsmenu/checkboxnocheck.png", + "hover" : "/interface/optionsmenu/checkboxnocheckhover.png", + "baseImageChecked" : "/interface/optionsmenu/checkboxcheck.png", + "hoverImageChecked" : "/interface/optionsmenu/checkboxcheckhover.png", + "checkable" : true, + "checked": false + }, "password" : { "hidden" : true } -} \ No newline at end of file +} diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index a86a574..f79226e 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -73,7 +73,8 @@ Json const AdditionalDefaultConfiguration = Json::parseJson(R"JSON( "title" : { "multiPlayerAddress" : "", "multiPlayerPort" : "", - "multiPlayerAccount" : "" + "multiPlayerAccount" : "", + "multiPlayerForceLegacy" : false }, "bindings" : { @@ -638,6 +639,7 @@ void ClientApplication::changeState(MainAppState newState) { m_titleScreen->setMultiPlayerAddress(toString(address->address())); m_titleScreen->setMultiPlayerPort(toString(address->port())); m_titleScreen->setMultiPlayerAccount(configuration->getPath("title.multiPlayerAccount").toString()); + m_titleScreen->setMultiPlayerForceLegacy(configuration->getPath("title.multiPlayerForceLegacy").optBool().value(false)); m_titleScreen->goToMultiPlayerSelectCharacter(false); } else { m_titleScreen->goToMultiPlayerSelectCharacter(true); @@ -646,6 +648,7 @@ void ClientApplication::changeState(MainAppState newState) { m_titleScreen->setMultiPlayerAddress(configuration->getPath("title.multiPlayerAddress").toString()); m_titleScreen->setMultiPlayerPort(configuration->getPath("title.multiPlayerPort").toString()); m_titleScreen->setMultiPlayerAccount(configuration->getPath("title.multiPlayerAccount").toString()); + m_titleScreen->setMultiPlayerForceLegacy(configuration->getPath("title.multiPlayerForceLegacy").optBool().value(false)); } } @@ -710,7 +713,7 @@ void ClientApplication::changeState(MainAppState newState) { bool allowAssetsMismatch = m_root->configuration()->get("allowAssetsMismatch").toBool(); if (auto errorMessage = m_universeClient->connect(UniverseConnection(std::move(packetSocket)), allowAssetsMismatch, - multiPlayerConnection.account, multiPlayerConnection.password)) { + multiPlayerConnection.account, multiPlayerConnection.password, multiPlayerConnection.forceLegacy)) { setError(*errorMessage); return; } @@ -882,13 +885,15 @@ void ClientApplication::updateTitle(float dt) { m_pendingMultiPlayerConnection = PendingMultiPlayerConnection{ address.right(), m_titleScreen->multiPlayerAccount(), - m_titleScreen->multiPlayerPassword() + m_titleScreen->multiPlayerPassword(), + m_titleScreen->multiPlayerForceLegacy() }; auto configuration = m_root->configuration(); configuration->setPath("title.multiPlayerAddress", m_titleScreen->multiPlayerAddress()); configuration->setPath("title.multiPlayerPort", m_titleScreen->multiPlayerPort()); configuration->setPath("title.multiPlayerAccount", m_titleScreen->multiPlayerAccount()); + configuration->setPath("title.multiPlayerForceLegacy", m_titleScreen->multiPlayerForceLegacy()); changeState(MainAppState::MultiPlayer); } diff --git a/source/client/StarClientApplication.hpp b/source/client/StarClientApplication.hpp index 2fcddb7..8824ea0 100644 --- a/source/client/StarClientApplication.hpp +++ b/source/client/StarClientApplication.hpp @@ -57,6 +57,7 @@ private: Variant server; String account; String password; + bool forceLegacy; }; struct PostProcessGroup { diff --git a/source/frontend/StarTitleScreen.cpp b/source/frontend/StarTitleScreen.cpp index a32b51a..f1ffcd9 100644 --- a/source/frontend/StarTitleScreen.cpp +++ b/source/frontend/StarTitleScreen.cpp @@ -213,6 +213,15 @@ void TitleScreen::setMultiPlayerPassword(String password) { m_password = std::move(password); } +bool TitleScreen::multiPlayerForceLegacy() const { + return m_forceLegacy; +} + +void TitleScreen::setMultiPlayerForceLegacy(bool const& forceLegacy) { + m_multiPlayerMenu->fetchChild("legacyCheckbox")->setChecked(forceLegacy); + m_forceLegacy = forceLegacy; +} + void TitleScreen::initMainMenu() { m_mainMenu = make_shared(); auto backMenu = make_shared(); @@ -347,7 +356,8 @@ void TitleScreen::initMultiPlayerMenu() { {"address", multiPlayerAddress()}, {"account", multiPlayerAccount()}, {"port", multiPlayerPort()}, - //{"password", multiPlayerPassword()} + //{"password", multiPlayerPassword()}, + {"forceLegacy",multiPlayerForceLegacy()} }; auto serverList = m_serverSelectPane->fetchChild("serverSelectArea.serverList"); @@ -384,6 +394,7 @@ void TitleScreen::initMultiPlayerMenu() { setMultiPlayerPort(data.getString("port", "")); setMultiPlayerAccount(data.getString("account", "")); setMultiPlayerPassword(data.getString("password", "")); + setMultiPlayerForceLegacy(data.getBool("forceLegacy", false)); if (auto passwordWidget = m_multiPlayerMenu->fetchChild("password")) passwordWidget->focus(); @@ -406,6 +417,10 @@ void TitleScreen::initMultiPlayerMenu() { readerConnect.registerCallback("password", [=](Widget* obj) { m_password = convert(obj)->getText().trim(); }); + + readerConnect.registerCallback("legacyCheckbox", [=](Widget* obj) { + m_forceLegacy = convert(obj)->isChecked(); + }); readerConnect.registerCallback("connect", [=](Widget*) { switchState(TitleState::StartMultiPlayer); diff --git a/source/frontend/StarTitleScreen.hpp b/source/frontend/StarTitleScreen.hpp index 3199247..095774f 100644 --- a/source/frontend/StarTitleScreen.hpp +++ b/source/frontend/StarTitleScreen.hpp @@ -77,6 +77,9 @@ public: String multiPlayerPassword() const; void setMultiPlayerPassword(String password); + bool multiPlayerForceLegacy() const; + void setMultiPlayerForceLegacy(bool const& forceLegacy); + private: void initMainMenu(); void initCharSelectionMenu(); @@ -122,6 +125,7 @@ private: String m_connectionPort; String m_account; String m_password; + bool m_forceLegacy; CelestialMasterDatabasePtr m_celestialDatabase; diff --git a/source/game/StarUniverseClient.cpp b/source/game/StarUniverseClient.cpp index f33c953..b41d19e 100644 --- a/source/game/StarUniverseClient.cpp +++ b/source/game/StarUniverseClient.cpp @@ -71,7 +71,7 @@ PlayerPtr UniverseClient::mainPlayer() const { return m_mainPlayer; } -Maybe UniverseClient::connect(UniverseConnection connection, bool allowAssetsMismatch, String const& account, String const& password) { +Maybe UniverseClient::connect(UniverseConnection connection, bool allowAssetsMismatch, String const& account, String const& password, bool const& forceLegacy) { auto& root = Root::singleton(); auto assets = root.assets(); @@ -85,9 +85,11 @@ Maybe UniverseClient::connect(UniverseConnection connection, bool allowA { auto protocolRequest = make_shared(StarProtocolVersion); - protocolRequest->setCompressionMode(PacketCompressionMode::Enabled); - // Signal that we're OpenStarbound. Vanilla Starbound only compresses - // packets above 64 bytes - by forcing it, we can communicate this. + if (!forceLegacy) { + protocolRequest->setCompressionMode(PacketCompressionMode::Enabled); + // Signal that we're OpenStarbound. Vanilla Starbound only compresses + // packets above 64 bytes - by forcing it, we can communicate this. + } connection.pushSingle(protocolRequest); } connection.sendAll(timeout); @@ -101,7 +103,7 @@ Maybe UniverseClient::connect(UniverseConnection connection, bool allowA NetCompatibilityRules compatibilityRules; compatibilityRules.setVersion(LegacyVersion); - bool legacyServer = protocolResponsePacket->compressionMode() != PacketCompressionMode::Enabled; + bool legacyServer = forceLegacy || (protocolResponsePacket->compressionMode() != PacketCompressionMode::Enabled); if (!legacyServer) { auto compressedSocket = as(&connection.packetSocket()); if (protocolResponsePacket->info) { diff --git a/source/game/StarUniverseClient.hpp b/source/game/StarUniverseClient.hpp index 1cb3bfa..b1c589f 100644 --- a/source/game/StarUniverseClient.hpp +++ b/source/game/StarUniverseClient.hpp @@ -41,7 +41,7 @@ public: PlayerPtr mainPlayer() const; // Returns error if connection failed - Maybe connect(UniverseConnection connection, bool allowAssetsMismatch, String const& account = "", String const& password = ""); + Maybe connect(UniverseConnection connection, bool allowAssetsMismatch, String const& account = "", String const& password = "", bool const& forceLegacy = false); bool isConnected() const; void disconnect(); Maybe disconnectReason() const; -- cgit v1.2.3