Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
settings_storage.cpp File Reference

Implements application settings persistence. More...

#include "src/app/settings_storage.h"
#include <cctype>
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <toml++/toml.hpp>
#include "src/platform/error_utils.h"
#include "src/platform/filesystem_utils.h"
#include "src/startup/storage_paths.h"
Include dependency graph for settings_storage.cpp:

Functions

FILE * _wfopen (const wchar_t *path, const wchar_t *mode)
 Declare the wide-character fopen variant required by toml++ on native Windows builds.
 
std::string app::default_settings_path ()
 Return the default path used for the persisted Moonlight settings file.
 
LoadAppSettingsResult app::load_app_settings (const std::string &filePath=default_settings_path())
 Load the persisted Moonlight settings file.
 
SaveAppSettingsResult app::save_app_settings (const AppSettings &settings, const std::string &filePath=default_settings_path())
 Save the persisted Moonlight settings file.
 

Detailed Description

Implements application settings persistence.

Function Documentation

◆ _wfopen()

FILE * _wfopen ( const wchar_t * path,
const wchar_t * mode )

Declare the wide-character fopen variant required by toml++ on native Windows builds.

Parameters
pathWide-character file path.
modeWide-character fopen mode string.
Returns
Open FILE handle, or nullptr on failure.

◆ default_settings_path()

std::string app::default_settings_path ( )

Return the default path used for the persisted Moonlight settings file.

Returns
Default TOML settings file path.

◆ load_app_settings()

LoadAppSettingsResult app::load_app_settings ( const std::string & filePath = default_settings_path())

Load the persisted Moonlight settings file.

Parameters
filePathSettings file to read.
Returns
Loaded settings plus any non-fatal warnings.

◆ save_app_settings()

SaveAppSettingsResult app::save_app_settings ( const AppSettings & settings,
const std::string & filePath = default_settings_path() )

Save the persisted Moonlight settings file.

Parameters
settingsSettings snapshot to write.
filePathSettings file to write.
Returns
Save result including success state and error detail.