diff --git a/include/Makefile.am b/include/Makefile.am index ce2c03c0..b37389c8 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,8 +1,10 @@ noinst_HEADERS = \ bios.h \ +bios_disk.h \ callback.h \ cpu.h \ cross.h \ +control.h \ debug.h \ dma.h \ dos_inc.h \ diff --git a/include/bios.h b/include/bios.h index 66b09ba4..0245cdaf 100644 --- a/include/bios.h +++ b/include/bios.h @@ -105,66 +105,9 @@ #define MAX_SCAN_CODE 0x58 /* The Section handling Bios Disk Access */ -#define BIOS_MAX_DISK 10 +//#define BIOS_MAX_DISK 10 -#define MAX_SWAPPABLE_DISKS 20 - -struct diskGeo { - Bit32u ksize; /* Size in kilobytes */ - Bit16u secttrack; /* Sectors per track */ - Bit16u headscyl; /* Heads per cylinder */ - Bit16u cylcount; /* Cylinders per side */ - Bit16u biosval; /* Type to return from BIOS */ -}; - -extern diskGeo DiskGeometryList[]; - -#include -#ifndef DOSBOX_MEM_H -#include "mem.h" -#endif -#ifndef DOSBOX_DOS_INC_H -#include "dos_inc.h" -#endif - -class imageDisk { -public: - Bit8u Read_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data); - Bit8u Write_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data); - Bit8u Read_AbsoluteSector(Bit32u sectnum, void * data); - Bit8u Write_AbsoluteSector(Bit32u sectnum, void * data); - - void Set_Geometry(Bit32u setHeads, Bit32u setCyl, Bit32u setSect, Bit32u setSectSize); - void Get_Geometry(Bit32u * getHeads, Bit32u *getCyl, Bit32u *getSect, Bit32u *getSectSize); - Bit8u GetBiosType(void); - Bit32u getSectSize(void); - imageDisk(FILE *imgFile, Bit8u *imgName, Bit32u imgSizeK, bool isHardDisk); - ~imageDisk() { if(diskimg != NULL) { fclose(diskimg); } }; - - bool hardDrive; - bool active; - FILE *diskimg; - Bit8u diskname[512]; - Bit8u floppytype; - - Bit32u sector_size; - Bit32u heads,cylinders,sectors; -}; - -void updateDPT(void); - -#define MAX_HDD_IMAGES 2 - -extern imageDisk *imageDiskList[2 + MAX_HDD_IMAGES]; -extern imageDisk *diskSwap[20]; -extern Bits swapPosition; -extern Bit16u imgDTASeg; /* Real memory location of temporary DTA pointer for fat image disk access */ -extern RealPt imgDTAPtr; /* Real memory location of temporary DTA pointer for fat image disk access */ -extern DOS_DTA *imgDTA; - -void swapInDisks(void); -void swapInNextDisk(void); -bool getSwapRequest(void); +//#define MAX_SWAPPABLE_DISKS 20 void BIOS_ZeroExtendedSize(bool in); void char_out(Bit8u chr,Bit32u att,Bit8u page); diff --git a/include/bios_disk.h b/include/bios_disk.h new file mode 100644 index 00000000..7f5d97cc --- /dev/null +++ b/include/bios_disk.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2002-2008 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef DOSBOX_BIOS_DISK_H +#define DOSBOX_BIOS_DISK_H + +#include +#ifndef DOSBOX_MEM_H +#include "mem.h" +#endif +#ifndef DOSBOX_DOS_INC_H +#include "dos_inc.h" +#endif +#ifndef DOSBOX_BIOS_H +#include "bios.h" +#endif + +/* The Section handling Bios Disk Access */ +#define BIOS_MAX_DISK 10 + +#define MAX_SWAPPABLE_DISKS 20 +struct diskGeo { + Bit32u ksize; /* Size in kilobytes */ + Bit16u secttrack; /* Sectors per track */ + Bit16u headscyl; /* Heads per cylinder */ + Bit16u cylcount; /* Cylinders per side */ + Bit16u biosval; /* Type to return from BIOS */ +}; +extern diskGeo DiskGeometryList[]; + +class imageDisk { +public: + Bit8u Read_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data); + Bit8u Write_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data); + Bit8u Read_AbsoluteSector(Bit32u sectnum, void * data); + Bit8u Write_AbsoluteSector(Bit32u sectnum, void * data); + + void Set_Geometry(Bit32u setHeads, Bit32u setCyl, Bit32u setSect, Bit32u setSectSize); + void Get_Geometry(Bit32u * getHeads, Bit32u *getCyl, Bit32u *getSect, Bit32u *getSectSize); + Bit8u GetBiosType(void); + Bit32u getSectSize(void); + imageDisk(FILE *imgFile, Bit8u *imgName, Bit32u imgSizeK, bool isHardDisk); + ~imageDisk() { if(diskimg != NULL) { fclose(diskimg); } }; + + bool hardDrive; + bool active; + FILE *diskimg; + Bit8u diskname[512]; + Bit8u floppytype; + + Bit32u sector_size; + Bit32u heads,cylinders,sectors; +}; + +void updateDPT(void); + +#define MAX_HDD_IMAGES 2 + +extern imageDisk *imageDiskList[2 + MAX_HDD_IMAGES]; +extern imageDisk *diskSwap[20]; +extern Bits swapPosition; +extern Bit16u imgDTASeg; /* Real memory location of temporary DTA pointer for fat image disk access */ +extern RealPt imgDTAPtr; /* Real memory location of temporary DTA pointer for fat image disk access */ +extern DOS_DTA *imgDTA; + +void swapInDisks(void); +void swapInNextDisk(void); +bool getSwapRequest(void); + +#endif diff --git a/include/control.h b/include/control.h new file mode 100644 index 00000000..5076fbb8 --- /dev/null +++ b/include/control.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2002-2008 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* $Id: control.h,v 1.1 2009-02-01 14:11:45 qbix79 Exp $ */ + +#ifndef DOSBOX_CONTROL_H +#define DOSBOX_CONTROL_H + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#pragma warning ( disable : 4290 ) +#endif + +#ifndef DOSBOX_PROGRAMS_H +#include "programs.h" +#endif +#ifndef DOSBOX_SETUP_H +#include "setup.h" +#endif + +#ifndef CH_LIST +#define CH_LIST +#include +#endif + +#ifndef CH_VECTOR +#define CH_VECTOR +#include +#endif + +#ifndef CH_STRING +#define CH_STRING +#include +#endif + + + + +class Config{ +public: + CommandLine * cmdline; +private: + std::list sectionlist; + typedef std::list::iterator it; + typedef std::list::reverse_iterator reverse_it; + typedef std::list::const_iterator const_it; + typedef std::list::const_reverse_iterator const_reverse_it; + void (* _start_function)(void); + bool secure_mode; //Sandbox mode +public: + Config(CommandLine * cmd):cmdline(cmd),secure_mode(false){} + ~Config(); + + Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*)); + Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false); + + Section* GetSection(int index); + Section* GetSection(std::string const&_sectionname) const; + Section* GetSectionFromProperty(char const * const prop) const; + + void SetStartUp(void (*_function)(void)); + void Init(); + void ShutDown(); + void StartUp(); + bool PrintConfig(char const * const configfilename) const; + bool ParseConfigFile(char const * const configfilename); + void ParseEnv(char ** envp); + bool SecureMode() const { return secure_mode; } + void SwitchToSecureMode() { secure_mode = true; }//can't be undone +}; + +#endif diff --git a/include/cross.h b/include/cross.h index 5b0ae608..d92379e4 100644 --- a/include/cross.h +++ b/include/cross.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cross.h,v 1.18 2007-01-08 19:45:37 qbix79 Exp $ */ +/* $Id: cross.h,v 1.19 2009-02-01 14:11:45 qbix79 Exp $ */ #ifndef DOSBOX_CROSS_H #define DOSBOX_CROSS_H @@ -28,6 +28,7 @@ #include #include #include +#include #if defined (_MSC_VER) /* MS Visual C++ */ #include @@ -66,4 +67,14 @@ static inline float powf (float x, float y) { return (float) pow (x,y); } #endif +class Cross { +public: + static void GetPlatformConfigDir(std::string& in); + static void GetPlatformConfigName(std::string& in); + static void CreatePlatformConfigDir(std::string& in); + static void ResolveHomedir(std::string & temp_line); + static void CreateDir(std::string const& temp); +}; + + #endif diff --git a/include/serialport.h b/include/serialport.h index 7ed273d8..f1016031 100644 --- a/include/serialport.h +++ b/include/serialport.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialport.h,v 1.15 2007-12-06 17:44:19 qbix79 Exp $ */ +/* $Id: serialport.h,v 1.16 2009-02-01 14:11:45 qbix79 Exp $ */ #ifndef DOSBOX_SERIALPORT_H #define DOSBOX_SERIALPORT_H @@ -35,9 +35,12 @@ #ifndef DOSBOX_TIMER_H #include "timer.h" #endif - +#ifndef DOSBOX_DOS_INC_H #include "dos_inc.h" -#include "setup.h" +#endif +#ifndef DOSBOX_PROGRAMS_H +#include "programs.h" +#endif #if SERIAL_DEBUG #include "hardware.h" diff --git a/include/setup.h b/include/setup.h index 8e9d4a8a..1a048d60 100644 --- a/include/setup.h +++ b/include/setup.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.h,v 1.38 2008-08-06 18:31:10 c2woody Exp $ */ +/* $Id: setup.h,v 1.39 2009-02-01 14:11:45 qbix79 Exp $ */ #ifndef DOSBOX_SETUP_H #define DOSBOX_SETUP_H @@ -26,12 +26,6 @@ #pragma warning ( disable : 4290 ) #endif -#ifndef DOSBOX_CROSS_H -#include "cross.h" -#endif -#ifndef DOSBOX_PROGRAMS_H -#include "programs.h" -#endif #ifndef CH_LIST #define CH_LIST @@ -199,6 +193,17 @@ public: void SetValue(std::string const& in); ~Prop_string(){ } }; +class Prop_path:public Prop_string{ +public: + std::string realpath; + Prop_path(std::string const& _propname, Changeable::Value when, char const * const _value) + :Prop_string(_propname,when,_value) { + default_value = value = _value; + realpath = _value; + } + void SetValue(std::string const& in); + ~Prop_path(){ } +}; class Prop_hex:public Property { public: @@ -254,6 +259,7 @@ public: Section_prop(std::string const& _sectionname):Section(_sectionname){} Prop_int* Add_int(std::string const& _propname, Property::Changeable::Value when, int _value=0); Prop_string* Add_string(std::string const& _propname, Property::Changeable::Value when, char const * const _value=NULL); + Prop_path* Add_path(std::string const& _propname, Property::Changeable::Value when, char const * const _value=NULL); Prop_bool* Add_bool(std::string const& _propname, Property::Changeable::Value when, bool _value=false); Prop_hex* Add_hex(std::string const& _propname, Property::Changeable::Value when, Hex _value=0); // void Add_double(char const * const _propname, double _value=0.0); @@ -266,6 +272,7 @@ public: bool Get_bool(std::string const& _propname) const; Hex Get_hex(std::string const& _propname) const; double Get_double(std::string const& _propname) const; + Prop_path* Get_path(std::string const& _propname) const; Prop_multival* Get_multival(std::string const& _propname) const; Prop_multival_remain* Get_multivalremain(std::string const& _propname) const; void HandleInputline(std::string const& gegevens); @@ -309,39 +316,6 @@ public: std::string data; }; -class Config{ -public: - CommandLine * cmdline; -private: - std::list sectionlist; - typedef std::list::iterator it; - typedef std::list::reverse_iterator reverse_it; - typedef std::list::const_iterator const_it; - typedef std::list::const_reverse_iterator const_reverse_it; - void (* _start_function)(void); - bool secure_mode; //Sandbox mode -public: - Config(CommandLine * cmd):cmdline(cmd),secure_mode(false){} - ~Config(); - - Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*)); - Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false); - - Section* GetSection(int index); - Section* GetSection(std::string const&_sectionname) const; - Section* GetSectionFromProperty(char const * const prop) const; - - void SetStartUp(void (*_function)(void)); - void Init(); - void ShutDown(); - void StartUp(); - void PrintConfig(char const * const configfilename) const; - bool ParseConfigFile(char const * const configfilename); - void ParseEnv(char ** envp); - bool SecureMode() const { return secure_mode; } - void SwitchToSecureMode() { secure_mode = true; }//can't be undone -}; - class Module_base { /* Base for all hardware and software "devices" */ protected: