2022-07-27 20:06:50 +02:00
|
|
|
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-05-08 09:49:31 +02:00
|
|
|
#include <filesystem>
|
2020-12-28 16:15:37 +01:00
|
|
|
#include <memory>
|
2022-03-20 08:18:41 +01:00
|
|
|
#include <optional>
|
2020-12-28 16:15:37 +01:00
|
|
|
#include <string>
|
|
|
|
|
2021-07-03 11:00:06 +02:00
|
|
|
#include "common/settings.h"
|
|
|
|
|
2020-12-28 16:15:37 +01:00
|
|
|
class INIReader;
|
|
|
|
|
|
|
|
class Config {
|
2021-05-08 09:49:31 +02:00
|
|
|
std::filesystem::path sdl2_config_loc;
|
2022-03-20 08:18:41 +01:00
|
|
|
std::unique_ptr<INIReader> sdl2_config;
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
bool LoadINI(const std::string& default_contents = "", bool retry = true);
|
|
|
|
void ReadValues();
|
|
|
|
|
|
|
|
public:
|
2022-03-20 08:18:41 +01:00
|
|
|
explicit Config(std::optional<std::filesystem::path> config_path);
|
2020-12-28 16:15:37 +01:00
|
|
|
~Config();
|
|
|
|
|
|
|
|
void Reload();
|
2021-07-03 11:00:06 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
2022-07-05 04:21:48 +02:00
|
|
|
* Applies a value read from the sdl2_config to a Setting.
|
2021-07-03 11:00:06 +02:00
|
|
|
*
|
|
|
|
* @param group The name of the INI group
|
|
|
|
* @param setting The yuzu setting to modify
|
|
|
|
*/
|
2022-07-17 09:10:25 +02:00
|
|
|
template <typename Type, bool ranged>
|
|
|
|
void ReadSetting(const std::string& group, Settings::Setting<Type, ranged>& setting);
|
2020-12-28 16:15:37 +01:00
|
|
|
};
|