summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/jni/config.h
blob: e1e8f47ed2662364225e5a97b6426a367a4dc3e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <filesystem>
#include <memory>
#include <optional>
#include <string>

#include "common/settings.h"

class INIReader;

class Config {
    bool LoadINI(const std::string& default_contents = "", bool retry = true);

public:
    enum class ConfigType {
        GlobalConfig,
        PerGameConfig,
        InputProfile,
    };

    explicit Config(const std::string& config_name = "config",
                    ConfigType config_type = ConfigType::GlobalConfig);
    ~Config();

    void Initialize(const std::string& config_name);

private:
    /**
     * Applies a value read from the config to a Setting.
     *
     * @param group The name of the INI group
     * @param setting The yuzu setting to modify
     */
    template <typename Type, bool ranged>
    void ReadSetting(const std::string& group, Settings::Setting<Type, ranged>& setting);

    void ReadValues();

    const ConfigType type;
    std::unique_ptr<INIReader> config;
    std::string config_loc;
    const bool global;
};