DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
include/control.h
00001 /*
00002  *  Copyright (C) 2002-2020  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License along
00015  *  with this program; if not, write to the Free Software Foundation, Inc.,
00016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 
00020 #ifndef DOSBOX_CONTROL_H
00021 #define DOSBOX_CONTROL_H
00022 
00023 #ifdef _MSC_VER
00024 //#pragma warning ( disable : 4786 )
00025 //#pragma warning ( disable : 4290 )
00026 #endif
00027 
00028 #ifndef DOSBOX_PROGRAMS_H
00029 #include "programs.h"
00030 #endif
00031 #ifndef DOSBOX_SETUP_H
00032 #include "setup.h"
00033 #endif
00034 
00035 #ifndef CH_LIST
00036 #define CH_LIST
00037 #include <list>
00038 #endif
00039 
00040 #ifndef CH_VECTOR
00041 #define CH_VECTOR
00042 #include <vector>
00043 #endif
00044 
00045 #ifndef CH_STRING
00046 #define CH_STRING
00047 #include <string>
00048 #endif
00049 
00050 
00051 
00052 
00053 class Config{
00054 public:
00055     CommandLine * cmdline;
00056 private:
00057     std::list<Section*> sectionlist;
00058     typedef std::list<Section*>::iterator it;
00059     typedef std::list<Section*>::reverse_iterator reverse_it;
00060     typedef std::list<Section*>::const_iterator const_it;
00061     typedef std::list<Section*>::const_reverse_iterator const_reverse_it;
00062 //  void (* _start_function)(void);
00063     bool secure_mode; //Sandbox mode
00064 public:
00065     bool initialised;
00066     std::vector<std::string> auto_bat_additional;
00067     std::vector<std::string> startup_params;
00068     std::vector<std::string> configfiles;
00069     Config(CommandLine * cmd):cmdline(cmd),secure_mode(false) {
00070         startup_params.push_back(cmdline->GetFileName());
00071         cmdline->FillVector(startup_params);
00072         opt_exit = false;
00073         opt_debug = false;
00074         opt_nogui = false;
00075         opt_nomenu = false;
00076         opt_showrt = false;
00077         opt_startui = false;
00078         initialised = false;
00079         opt_console = false;
00080         opt_logint21 = false;
00081         opt_userconf = false;
00082         opt_noconfig = false;
00083         opt_noconsole = false;
00084         opt_logfileio = false;
00085         opt_eraseconf = false;
00086         opt_resetconf = false;
00087         opt_printconf = false;
00088         opt_noautoexec = false;
00089         opt_securemode = false;
00090         opt_fullscreen = false;
00091         opt_showcycles = false;
00092         opt_earlydebug = false;
00093         opt_break_start = false;
00094         opt_erasemapper = false;
00095         opt_resetmapper = false;
00096         opt_startmapper = false;
00097         opt_fastbioslogo = false;
00098         opt_alt_vga_render = false;
00099         opt_date_host_forced = false;
00100         opt_disable_numlock_check = false;
00101         opt_disable_dpi_awareness = false;
00102         opt_time_limit = -1;
00103         opt_log_con = false;
00104     }
00105     ~Config();
00106 
00107     Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*));
00108     Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false);
00109     
00110     Section* GetSection(int index);
00111     Section* GetSection(std::string const&_sectionname) const;
00112     Section* GetSectionFromProperty(char const * const prop) const;
00113 
00114     bool PrintConfig(char const * const configfilename,bool everything=false) const;
00115     bool ParseConfigFile(char const * const configfilename);
00116     void ParseEnv(char ** envp);
00117     bool SecureMode() const { return secure_mode; }
00118     void SwitchToSecureMode() { secure_mode = true; }//can't be undone
00119 public:
00120     bool opt_log_con;
00121     double opt_time_limit;
00122     std::string opt_editconf,opt_opensaves,opt_opencaptures,opt_lang;
00123     std::vector<std::string> config_file_list;
00124     std::vector<std::string> opt_c;
00125     std::vector<std::string> opt_set;
00126 
00127     bool opt_disable_dpi_awareness;
00128     bool opt_disable_numlock_check;
00129     bool opt_date_host_forced;
00130     bool opt_alt_vga_render;
00131     bool opt_fastbioslogo;
00132     bool opt_break_start;
00133     bool opt_erasemapper;
00134     bool opt_resetmapper;
00135     bool opt_startmapper;
00136     bool opt_noautoexec;
00137     bool opt_securemode;
00138     bool opt_fullscreen;
00139     bool opt_showcycles;
00140     bool opt_earlydebug;
00141     bool opt_logfileio;
00142     bool opt_noconsole;
00143     bool opt_eraseconf;
00144     bool opt_resetconf;
00145     bool opt_printconf;
00146     bool opt_logint21;
00147     bool opt_userconf;
00148     bool opt_noconfig;
00149     bool opt_console;
00150     bool opt_startui;
00151     bool opt_showrt;
00152     bool opt_nomenu;
00153     bool opt_debug;
00154     bool opt_nogui;
00155     bool opt_exit;
00156 };
00157 
00158 #endif