1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef AGS_ENGINE_MAIN_CONFIG_H 24 #define AGS_ENGINE_MAIN_CONFIG_H 25 26 #include "ags/engine/main/graphics_mode.h" 27 #include "ags/shared/util/ini_util.h" 28 29 namespace AGS3 { 30 31 using AGS::Shared::String; 32 using AGS::Shared::ConfigTree; 33 34 // Set up default config settings 35 void config_defaults(); 36 // Find and default configuration file (usually located in the game installation directory) 37 String find_default_cfg_file(); 38 // Find all-games user configuration file 39 String find_user_global_cfg_file(); 40 // Find and game-specific user configuration file (located into writable user directory) 41 String find_user_cfg_file(); 42 // Apply overriding values from the external config (e.g. for mobile ports) 43 void override_config_ext(ConfigTree &cfg); 44 // Setup game using final config tree 45 void apply_config(const ConfigTree &cfg); 46 // Fixup game setup parameters 47 void post_config(); 48 49 void save_config_file(); 50 51 ScreenSizeDefinition parse_screendef(const String &option, ScreenSizeDefinition def_value); 52 void parse_scaling_option(const String &scaling_option, FrameScaleDefinition &scale_def, int &scale_factor); 53 void parse_scaling_option(const String &scaling_option, GameFrameSetup &frame_setup); 54 String make_scaling_option(FrameScaleDefinition scale_def, int scale_factor = 0); 55 String make_scaling_option(const GameFrameSetup &frame_setup); 56 uint32_t convert_scaling_to_fp(int scale_factor); 57 int convert_fp_to_scaling(uint32_t scaling); 58 // Fill in setup structs with default settings for the given mode (windowed or fullscreen) 59 void graphics_mode_get_defaults(bool windowed, ScreenSizeSetup &scsz_setup, GameFrameSetup &frame_setup); 60 61 62 bool INIreaditem(const ConfigTree &cfg, const String §n, const String &item, String &value); 63 int INIreadint(const ConfigTree &cfg, const String §n, const String &item, int def_value = 0); 64 float INIreadfloat(const ConfigTree &cfg, const String §n, const String &item, float def_value = 0.f); 65 String INIreadstring(const ConfigTree &cfg, const String §n, const String &item, const String &def_value = ""); 66 void INIwriteint(ConfigTree &cfg, const String §n, const String &item, int value); 67 void INIwritestring(ConfigTree &cfg, const String §n, const String &item, const String &value); 68 void INIwriteint(ConfigTree &cfg, const String §n, const String &item, int value); 69 70 } // namespace AGS3 71 72 #endif 73