config.h 888 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-FileCopyrightText: 2014 Citra Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <filesystem>
  5. #include <memory>
  6. #include <optional>
  7. #include <string>
  8. #include "common/settings.h"
  9. class INIReader;
  10. class Config {
  11. std::filesystem::path sdl2_config_loc;
  12. std::unique_ptr<INIReader> sdl2_config;
  13. bool LoadINI(const std::string& default_contents = "", bool retry = true);
  14. void ReadValues();
  15. public:
  16. explicit Config(std::optional<std::filesystem::path> config_path);
  17. ~Config();
  18. void Reload();
  19. private:
  20. /**
  21. * Applies a value read from the sdl2_config to a Setting.
  22. *
  23. * @param group The name of the INI group
  24. * @param setting The yuzu setting to modify
  25. */
  26. template <typename Type, bool ranged>
  27. void ReadSetting(const std::string& group, Settings::Setting<Type, ranged>& setting);
  28. };