DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
include/control.h
00001 /*
00002  *  Copyright (C) 2002-2019  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
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, 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_userconf = false;
00081                 opt_noconsole = false;
00082                 opt_eraseconf = false;
00083                 opt_resetconf = false;
00084                 opt_printconf = false;
00085                 opt_noautoexec = false;
00086                 opt_securemode = false;
00087                 opt_fullscreen = false;
00088                 opt_showcycles = false;
00089                 opt_earlydebug = false;
00090                 opt_break_start = false;
00091                 opt_erasemapper = false;
00092                 opt_resetmapper = false;
00093                 opt_startmapper = false;
00094         opt_fastbioslogo = false;
00095         opt_alt_vga_render = false;
00096         opt_date_host_forced = false;
00097                 opt_disable_numlock_check = false;
00098                 opt_disable_dpi_awareness = false;
00099         opt_time_limit = -1;
00100         opt_log_con = false;
00101     }
00102         ~Config();
00103 
00104         Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*));
00105         Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false);
00106         
00107         Section* GetSection(int index);
00108         Section* GetSection(std::string const&_sectionname) const;
00109         Section* GetSectionFromProperty(char const * const prop) const;
00110 
00111         bool PrintConfig(char const * const configfilename,bool everything=false) const;
00112         bool ParseConfigFile(char const * const configfilename);
00113         void ParseEnv(char ** envp);
00114         bool SecureMode() const { return secure_mode; }
00115         void SwitchToSecureMode() { secure_mode = true; }//can't be undone
00116 public:
00117     bool opt_log_con;
00118     double opt_time_limit;
00119         std::string opt_editconf,opt_opensaves,opt_opencaptures,opt_lang;
00120         std::vector<std::string> config_file_list;
00121         std::vector<std::string> opt_c;
00122         bool opt_disable_dpi_awareness;
00123         bool opt_disable_numlock_check;
00124         bool opt_date_host_forced;
00125     bool opt_alt_vga_render;
00126     bool opt_fastbioslogo;
00127         bool opt_break_start;
00128         bool opt_erasemapper;
00129         bool opt_resetmapper;
00130         bool opt_startmapper;
00131         bool opt_noautoexec;
00132         bool opt_securemode;
00133         bool opt_fullscreen;
00134         bool opt_showcycles;
00135         bool opt_earlydebug;
00136         bool opt_noconsole;
00137         bool opt_eraseconf;
00138         bool opt_resetconf;
00139         bool opt_printconf;
00140         bool opt_userconf;
00141         bool opt_console;
00142         bool opt_startui;
00143     bool opt_showrt;
00144         bool opt_nomenu;
00145         bool opt_debug;
00146         bool opt_nogui;
00147         bool opt_exit;
00148 };
00149 
00150 #endif