mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 16:17:06 +02:00
Settings has five more pages, under "SKATE. SETTINGS" in the rail, for the settings the game saves per PC: - GRAPHICS: window mode, resolution, HDR, brightness, UI brightness, HUD display, then the game's graphics options (frame rate limit, VSync, dynamic resolution, upscaler and its quality, antialiasing, textures, lighting, shadows, mesh, effects, post processing, global illumination, ambient occlusion, depth of field, motion blur) with buttons that set every low-to-ultra option at once. - AUDIO: volumes, voice chat, text and voice language, subtitles, party menu narration. - CAMERA: sensitivity, and the on board, off board and climbing options. - CONTROLS: vibration, trigger force feedback, show controller on HUD, highlight indicator, the experimental toggles. - REPLAY: editor speeds and sensitivity, effects, first-person keyframes. They are written straight into the game's save containers under %LOCALAPPDATA%\ReSkate\Game\Skate\data (game_settings.h): a DATA file of sections and an INDEX naming them, the body one binary object of named values. Only the values changed are rewritten, in both of the game's copies; every other byte is kept. A container that cannot be walked whole is left alone. The first change copies the untouched files to %LOCALAPPDATA%\ReSkate\game-settings-backup. Keys, kinds, ranges, steps and choices are the game's own (DingoUISettingAsset in its data, build 20260929). The labels are ours. Resolution is saved by the game as a place in the PC's list of display sizes; the launcher lists Windows' sizes smallest first, which matches the one PC it was checked on. A change is stored once the control is let go. The pages are disabled while a game this launcher started is running, and say so when the game has not saved its settings on the PC yet. Not offered: refresh rate, fullscreen monitor and audio devices (places in lists the game builds at run time), the mobile-only settings, and settings the game saves to the account rather than the PC.
102 lines
4.1 KiB
C++
102 lines
4.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <map>
|
|
#include <span>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <utility>
|
|
#include <variant>
|
|
#include <vector>
|
|
|
|
// skate.'s own settings, edited from the launcher. The game keeps the ones it saves per PC in
|
|
// save containers under its data folder (%LOCALAPPDATA%\ReSkate\Game\Skate\data, where ReSkate
|
|
// points it): each container is a DATA file of sections and an INDEX naming them. The "body"
|
|
// section is one binary object, a setting a named value: on/off, a whole number, a number or
|
|
// text. Its "TierManagerUserSettings" text holds the graphics options as
|
|
// "Name;value|Name;value". Only the values asked for are rewritten; every other byte of a
|
|
// container is kept.
|
|
namespace dingosdk::launcher_game_settings {
|
|
|
|
using Value = std::variant<bool, std::int32_t, float, std::string>;
|
|
using Values = std::map<std::string, Value, std::less<>>; // by the game's setting key
|
|
|
|
struct Container {
|
|
std::vector<unsigned char> data, index;
|
|
};
|
|
|
|
// Every setting of those four kinds a container holds. Throws when it is not a container of
|
|
// the game's settings, or its format is not the one this was written for.
|
|
Values read_values(const Container& container);
|
|
// That container with `changes` stored. Each must be a setting the container already holds,
|
|
// of the same kind.
|
|
Container with_values(const Container& container, const Values& changes);
|
|
|
|
// ---------------------------------------------------------------- graphics options
|
|
|
|
inline constexpr char options_key[] = "TierManagerUserSettings";
|
|
struct Option {
|
|
std::string name, value; // "Texture Quality", "texture_quality_ultra"
|
|
bool operator==(const Option&) const = default;
|
|
};
|
|
using Options = std::vector<Option>; // in the game's order
|
|
// "Name;value|Name;value" and back.
|
|
Options parse_options(std::string_view text);
|
|
std::string join_options(const Options& options);
|
|
|
|
// What the launcher offers for one option: the game's own value names, with labels.
|
|
struct Choice { const char* value; const char* label; };
|
|
struct Setting {
|
|
const char* category;
|
|
const char* name; // the option's name in the game
|
|
const char* label;
|
|
std::span<const Choice> choices;
|
|
// Only matters while this other option has this value ("" : always).
|
|
const char* needs_name;
|
|
const char* needs_value;
|
|
};
|
|
std::span<const Setting> graphics_options();
|
|
// The value of `level` (0 low .. 3 ultra) for an option that has those four, else null.
|
|
const char* level_value(const Setting& setting, int level);
|
|
// Any change makes the game's preset "Custom".
|
|
inline constexpr char preset_name[] = "Global Graphics Quality";
|
|
inline constexpr char preset_custom[] = "Custom";
|
|
|
|
// ---------------------------------------------------------------- every other setting
|
|
|
|
// The game's settings menus, as its data defines them (DingoUISettingAsset: key, kind, range
|
|
// or choices), for the settings it saves per PC.
|
|
enum class Kind { toggle, whole, real, choice, resolution };
|
|
struct Named { int value; const char* label; };
|
|
struct Item {
|
|
const char* page; // the launcher's tab
|
|
const char* section;
|
|
const char* key;
|
|
const char* label;
|
|
Kind kind;
|
|
float least, most, step; // whole, real
|
|
std::span<const Named> choices; // choice
|
|
};
|
|
std::span<const Item> items();
|
|
|
|
// The resolutions the game's Resolution setting counts through: this PC's display modes,
|
|
// smallest first.
|
|
std::vector<std::pair<int, int>> display_resolutions();
|
|
|
|
// ---------------------------------------------------------------- on disk
|
|
|
|
// Where the game keeps its saves.
|
|
std::filesystem::path save_root();
|
|
// Every container under `root` that holds the settings, and the values of the one written last.
|
|
struct Saved {
|
|
std::vector<std::filesystem::path> folders;
|
|
Values values;
|
|
};
|
|
Saved load(const std::filesystem::path& root);
|
|
// Stores `changes` in each of those containers. The first time, the untouched files are copied
|
|
// to `backup` (a folder per container). Throws when a file cannot be read or written.
|
|
void save(const Saved& saved, const Values& changes, const std::filesystem::path& backup);
|
|
|
|
} // namespace dingosdk::launcher_game_settings
|