| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #pragma once
- #include <string_view>
- #include "../../state/account/account_state.h"
- #include "../../state/activity/defaults/definition.h"
- #include "../../state/investment/investment.h"
- #include "../../state/unlocks/definition.h"
- #include "../logging/log.h"
- #include "client/definition.h"
- #include "server/definition.h"
- #include "steam/definition.h"
- namespace sunrise::core::settings {
- /** Boot policy for generating the activity SDK required by host roster construction. */
- struct ActivitySdkGenerationSettings final {
- /** On by default like the bundled file, so a file without this block still generates. */
- bool enabled{true};
- /** Writes the sdk/lua declaration tree. On by default, and only runs when generation does. */
- bool luaDeclarations{true};
- };
- /**
- * Layout version of the settings file this build writes and expects.
- * Raise it when a key is renamed, removed, changes meaning, or must take a new default. Adding a
- * key needs no raise, because a missing key already takes its default.
- */
- inline constexpr std::uint32_t kSettingsVersion = 16;
- /** Parsed read-only process settings. */
- struct Settings {
- /**
- * Layout version the file was written against. Zero means the key was missing, which is
- * every file written before versioning. Checked against kSettingsVersion at load.
- */
- std::uint32_t version{};
- /**
- * Completes released exotic weapon catalysts while resolving client item state.
- * Authored under `state.investment`, with the rest of the investment content policy.
- */
- bool completeExoticCatalysts{true};
- /** Core-owned sink and channel policy. */
- log::Settings logging;
- /** Core-owned boot gate for activity SDK generation. */
- ActivitySdkGenerationSettings activitySdkGeneration;
- /** Options used only by the Client layer. */
- client::Settings client;
- /** Options used only by the Server layer. */
- server::Settings server;
- /** Options used only by the Steam compatibility layer. */
- steam::Settings steam;
- /** Complete authored account State, or an empty account. */
- state::AccountState initialAccount;
- /** Small local destination fallback published when State starts. */
- state::activity::defaults::ActivityDefaults initialActivityDefaults;
- /** Authored acquired-flag and objective policy published into the account object. */
- state::unlocks::Table initialUnlocks;
- /** Authored family-5 unlock overrides. Only the two override lists are authored here. */
- state::Family5State initialFamily5;
- };
- /** @return The complete default settings. */
- [[nodiscard]] Settings defaults() noexcept;
- /**
- * Parses supported JSON settings on top of the defaults.
- * @param json Complete settings text.
- * @param output Receives the settings only after the whole document is valid.
- * @return True when the document matches the supported settings.
- */
- [[nodiscard]] bool parse(std::string_view json, Settings& output) noexcept;
- /**
- * Loads the settings file next to the module when it is there.
- * @param module Loaded DLL, used to find the settings path.
- * @return True when defaults or a valid settings file are active.
- */
- [[nodiscard]] bool initialize(void* module) noexcept;
- /** Resets active settings to the fixed defaults. */
- void shutdown() noexcept;
- /** @return Active read-only Core settings. */
- [[nodiscard]] const Settings& get() noexcept;
- } // namespace sunrise::core::settings
|