Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/client/StarClientApplication.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-04-30 12:49:47 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2025-04-30 12:49:47 +1000
commitd3d4345e057d95d784e34be9b23e7fe07fb9a7c1 (patch)
treef59fa890e5be1d590e42a337448cecfc6b61850a /source/client/StarClientApplication.cpp
parent86e229012f84744a1e878124d9a6e2991c0460bb (diff)
parent885502bf11057e7de961f178bc85ce93a9f40723 (diff)
Merge branch 'main' into pr/218
Diffstat (limited to 'source/client/StarClientApplication.cpp')
-rw-r--r--source/client/StarClientApplication.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index 3c7ec8d..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" : {
@@ -151,7 +152,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() {
@@ -492,6 +493,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 +504,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<bool> 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<bool> 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;
}
@@ -627,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);
@@ -635,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));
}
}
@@ -699,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;
}
@@ -871,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);
}