coastline 0.0.4
Loading...
Searching...
No Matches
gamesettings.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <filesystem>
5#include <optional>
6#include <span>
7#include <string>
8#include <string_view>
9#include <vector>
10
11#include "config.h"
12
13namespace coastline {
14
27
39bool SpeedInMph(const GameConfig &config, std::string_view region, std::string_view country);
40
48int SoundEffectsVolume(const GameConfig &config, bool n64);
49
52public:
62 std::span<const std::array<int, 2>> displayResolutions = {});
63
66 return m_options.size();
67 }
68
74 void SetOverrides(GameConfig overrides);
79 bool IsEnabled(std::size_t index) const;
90 bool RequiresRestart(std::size_t index) const;
99 bool Step(std::size_t index, int direction);
102
103private:
105 struct Choice {
106 std::string value;
107 std::string label;
108 int height = 0;
109 };
111 struct Option {
112 std::string label;
113 std::string section;
114 std::string key;
115 std::vector<Choice> choices;
116 std::size_t fallback = 0;
117 bool numeric = false;
118 bool boolean = false;
119 bool restart = true;
120 };
121 std::size_t Selected(const Option &option) const;
122 const GameConfig &ConfigFor(const Option &option) const;
123 GameConfig &m_config;
124 GameConfig m_overrides;
125 std::optional<GameConfig> m_presetBaseline;
126 std::vector<Option> m_options;
127 bool m_presetRestart = true;
128};
129
130} // namespace coastline
The settings of BossRally.ini.
Definition config.h:18
void SetOverrides(GameConfig overrides)
Replace temporary values supplied by command-line arguments without saving them.
GameSettings(GameConfig &config, std::span< const std::filesystem::path > dataRoots={}, std::span< const std::array< int, 2 > > displayResolutions={})
Build available options from the configuration, installed packs, and display modes.
bool IsEnabled(std::size_t index) const
std::string Label(std::size_t index) const
bool RequiresRestart(std::size_t index) const
bool Step(std::size_t index, int direction)
Cycle a setting in either direction.
void FinishPresetSelection()
End preset browsing; the next preset adjustment captures a new baseline.
std::size_t Count() const
Definition gamesettings.h:65
Definition assetimport.h:11
bool SpeedInMph(const GameConfig &config, std::string_view region, std::string_view country)
Resolve speed units without recording an automatic choice as a user preference.
bool ApplyGraphicsPreset(GameConfig &config, std::string_view preset)
Apply a graphics preset without changing language or region.
int SoundEffectsVolume(const GameConfig &config, bool n64)
Resolve SFX volume from a manual preference or the selected sample source.