1 /***************************************************************************** 2 * Copyright (c) 2014-2020 OpenRCT2 developers 3 * 4 * For a complete list of all authors, please refer to contributors.md 5 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 6 * 7 * OpenRCT2 is licensed under the GNU General Public License version 3. 8 *****************************************************************************/ 9 10 #pragma once 11 12 #include "../common.h" 13 #include "../drawing/Drawing.h" 14 #include "../localisation/Currency.h" 15 16 #include <string> 17 18 enum class MeasurementFormat : int32_t; 19 enum class TemperatureUnit : int32_t; 20 enum class ScaleQuality : int32_t; 21 enum class Sort : int32_t; 22 enum class VirtualFloorStyles : int32_t; 23 enum class DrawingEngine : int32_t; 24 25 struct GeneralConfiguration 26 { 27 // Paths 28 utf8* rct1_path; 29 utf8* rct2_path; 30 31 // Display 32 int32_t default_display; 33 int32_t window_width; 34 int32_t window_height; 35 int32_t fullscreen_mode; 36 int32_t fullscreen_width; 37 int32_t fullscreen_height; 38 float window_scale; 39 DrawingEngine drawing_engine; 40 ScaleQuality scale_quality; 41 bool uncap_fps; 42 bool use_vsync; 43 bool show_fps; 44 bool multithreading; 45 bool minimize_fullscreen_focus_loss; 46 bool disable_screensaver; 47 48 // Map rendering 49 bool landscape_smoothing; 50 bool always_show_gridlines; 51 VirtualFloorStyles virtual_floor_style; 52 bool day_night_cycle; 53 bool enable_light_fx; 54 bool enable_light_fx_for_vehicles; 55 bool upper_case_banners; 56 bool render_weather_effects; 57 bool render_weather_gloom; 58 bool disable_lightning_effect; 59 bool show_guest_purchases; 60 bool transparent_screenshot; 61 bool transparent_water; 62 63 // Localisation 64 int32_t language; 65 MeasurementFormat measurement_format; 66 TemperatureUnit temperature_format; 67 bool show_height_as_units; 68 int32_t date_format; 69 CurrencyType currency_format; 70 int32_t custom_currency_rate; 71 CurrencyAffix custom_currency_affix; 72 utf8* custom_currency_symbol; 73 74 // Controls 75 bool edge_scrolling; 76 int32_t edge_scrolling_speed; 77 bool trap_cursor; 78 bool invert_viewport_drag; 79 bool zoom_to_cursor; 80 81 // Miscellaneous 82 bool play_intro; 83 int32_t window_snap_proximity; 84 bool allow_loading_with_incorrect_checksum; 85 bool save_plugin_data; 86 bool debugging_tools; 87 int32_t autosave_frequency; 88 int32_t autosave_amount; 89 bool auto_staff_placement; 90 bool handymen_mow_default; 91 bool auto_open_shops; 92 int32_t default_inspection_interval; 93 int32_t window_limit; 94 int32_t scenario_select_mode; 95 bool scenario_unlocking_enabled; 96 bool scenario_hide_mega_park; 97 bool steam_overlay_pause; 98 bool show_real_names_of_guests; 99 bool allow_early_completion; 100 101 // Loading and saving 102 bool confirmation_prompt; 103 Sort load_save_sort; 104 utf8* last_save_game_directory; 105 utf8* last_save_landscape_directory; 106 utf8* last_save_scenario_directory; 107 utf8* last_save_track_directory; 108 utf8* last_run_version; 109 bool use_native_browse_dialog; 110 int64_t last_version_check_time; 111 }; 112 113 struct InterfaceConfiguration 114 { 115 bool toolbar_show_finances; 116 bool toolbar_show_research; 117 bool toolbar_show_cheats; 118 bool toolbar_show_news; 119 bool toolbar_show_mute; 120 bool toolbar_show_chat; 121 bool toolbar_show_zoom; 122 bool console_small_font; 123 bool random_title_sequence; 124 utf8* current_theme_preset; 125 utf8* current_title_sequence_preset; 126 int32_t object_selection_filter_flags; 127 int32_t scenarioselect_last_tab; 128 }; 129 130 struct SoundConfiguration 131 { 132 utf8* device; 133 bool master_sound_enabled; 134 uint8_t master_volume; 135 uint8_t title_music; 136 bool sound_enabled; 137 uint8_t sound_volume; 138 bool ride_music_enabled; 139 uint8_t ride_music_volume; 140 bool audio_focus; 141 }; 142 143 struct NetworkConfiguration 144 { 145 std::string player_name; 146 int32_t default_port; 147 std::string listen_address; 148 std::string default_password; 149 bool stay_connected; 150 bool advertise; 151 std::string advertise_address; 152 int32_t maxplayers; 153 std::string server_name; 154 std::string server_description; 155 std::string server_greeting; 156 std::string master_server_url; 157 std::string provider_name; 158 std::string provider_email; 159 std::string provider_website; 160 bool known_keys_only; 161 bool log_chat; 162 bool log_server_actions; 163 bool pause_server_if_no_clients; 164 bool desync_debugging; 165 }; 166 167 struct NotificationConfiguration 168 { 169 bool park_award; 170 bool park_marketing_campaign_finished; 171 bool park_warnings; 172 bool park_rating_warnings; 173 bool ride_broken_down; 174 bool ride_crashed; 175 bool ride_casualties; 176 bool ride_warnings; 177 bool ride_researched; 178 bool ride_stalled_vehicles; 179 bool guest_warnings; 180 bool guest_left_park; 181 bool guest_queuing_for_ride; 182 bool guest_on_ride; 183 bool guest_left_ride; 184 bool guest_bought_item; 185 bool guest_used_facility; 186 bool guest_died; 187 }; 188 189 struct FontConfiguration 190 { 191 utf8* file_name; 192 utf8* font_name; 193 int32_t x_offset; 194 int32_t y_offset; 195 int32_t size_tiny; 196 int32_t size_small; 197 int32_t size_medium; 198 int32_t size_big; 199 int32_t height_tiny; 200 int32_t height_small; 201 int32_t height_medium; 202 int32_t height_big; 203 bool enable_hinting; 204 int32_t hinting_threshold; 205 }; 206 207 struct PluginConfiguration 208 { 209 bool enable_hot_reloading; 210 std::string allowed_hosts; 211 }; 212 213 enum class Sort : int32_t 214 { 215 NameAscending, 216 NameDescending, 217 DateAscending, 218 DateDescending, 219 }; 220 221 enum class TemperatureUnit : int32_t 222 { 223 Celsius, 224 Fahrenheit 225 }; 226 227 enum class ScaleQuality : int32_t 228 { 229 NearestNeighbour, 230 Linear, 231 SmoothNearestNeighbour 232 }; 233 234 enum class MeasurementFormat : int32_t 235 { 236 Imperial, 237 Metric, 238 SI 239 }; 240 241 extern GeneralConfiguration gConfigGeneral; 242 extern InterfaceConfiguration gConfigInterface; 243 extern SoundConfiguration gConfigSound; 244 extern NetworkConfiguration gConfigNetwork; 245 extern NotificationConfiguration gConfigNotifications; 246 extern FontConfiguration gConfigFonts; 247 extern PluginConfiguration gConfigPlugin; 248 249 bool config_open(const utf8* path); 250 bool config_save(const utf8* path); 251 void config_get_default_path(utf8* outPath, size_t size); 252 void config_set_defaults(); 253 void config_release(); 254 bool config_save_default(); 255 bool config_find_or_browse_install_directory(); 256 257 bool RCT1DataPresentAtLocation(const utf8* path); 258 std::string FindCsg1datAtLocation(const utf8* path); 259 bool Csg1datPresentAtLocation(const utf8* path); 260 std::string FindCsg1idatAtLocation(const utf8* path); 261 bool Csg1idatPresentAtLocation(const utf8* path); 262 bool CsgIsUsable(const rct_gx& csg); 263 bool CsgAtLocationIsUsable(const utf8* path); 264