diff --git a/include/setup.h b/include/setup.h index 7e7131f4..34625028 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.33 2008-03-02 11:13:46 qbix79 Exp $ */ +/* $Id: setup.h,v 1.34 2008-03-19 20:35:16 qbix79 Exp $ */ #ifndef DOSBOX_SETUP_H #define DOSBOX_SETUP_H @@ -136,7 +136,9 @@ public: virtual bool CheckValue(Value const& in, bool warn); //Set interval value to in or default if in is invalid. force always sets the value. void SetVal(Value const& in, bool forced,bool warn=true) {if(forced || CheckValue(in,warn)) value = in; else value = default_value;} - virtual ~Property(){ } + virtual ~Property(){ } + virtual const std::vector& GetValues() const; + protected: Value value; std::vector suggested_values; @@ -278,7 +280,8 @@ public: Section_prop *GetSection() { return section; } const Section_prop *GetSection() const { return section; } void SetValue(std::string const& input); -}; //value bevat totalle string. setvalue zet elk van de sub properties en checked die. + virtual const std::vector& GetValues() const; +}; //value bevat totale string. setvalue zet elk van de sub properties en checked die. class Section_line: public Section{ public: diff --git a/src/dosbox.cpp b/src/dosbox.cpp index b06ebfa2..892bfe90 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox.cpp,v 1.131 2008-03-18 20:51:26 qbix79 Exp $ */ +/* $Id: dosbox.cpp,v 1.132 2008-03-19 20:35:17 qbix79 Exp $ */ #include #include @@ -40,6 +40,7 @@ #include "support.h" #include "mapper.h" #include "ints/int10.h" +#include "render.h" Config * control; MachineType machine; @@ -268,6 +269,7 @@ static void DOSBOX_RealInit(Section * sec) { "# This is the configurationfile for DOSBox %s.\n" "# Lines starting with a # are commentlines.\n" "# They are used to (briefly) document the effect of each option.\n"); + MSG_Add("CONFIG_SUGGESTED_VALUES", "Possible values"); MAPPER_AddHandler(DOSBOX_UnlockSpeed, MK_f12, MMOD2,"speedlock","Speedlock"); std::string cmd_machine; @@ -313,6 +315,8 @@ void DOSBOX_Init(void) { const char *ios[] = { "220", "240", "260", "280", "2a0", "2c0", "2e0", "300", 0 }; const char *irqs[] = { "3", "5", "7", "9", "10", "11", "12", 0 }; const char *dmas[] = { "0", "1", "3", "5", "6", "7", 0 }; + const char *irqssb[] = { "7", "5", "3", "9", "10", "11", "12", 0 }; + const char *dmassb[] = { "1", "5", "0", "3", "6", "7", 0 }; /* Setup all the different modules making up DOSBox */ @@ -388,7 +392,7 @@ void DOSBOX_Init(void) { Pmulti = secprop->Add_multi("cycles",Property::Changeable::Always," "); Pmulti->Set_help( - "Amount of instructions DOSBox tries to emulate each millisecond. Setting this value too high results in sound dropouts and lags. Cycles can be set in 3 ways:" + "Amount of instructions DOSBox tries to emulate each millisecond. Setting this value too high results in sound dropouts and lags. Cycles can be set in 3 ways:\n" " 'auto' tries to guess what a game needs.\n" " It usually works, but can fail for certain games.\n" " 'fixed #number' will set a fixed amount of cycles. This is what you usually need if 'auto' fails.\n" @@ -468,15 +472,15 @@ void DOSBOX_Init(void) { Phex->Set_help("The IO address of the soundblaster."); Pint = secprop->Add_int("irq",Property::Changeable::WhenIdle,7); - Pint->Set_values(irqs); + Pint->Set_values(irqssb); Pint->Set_help("The IRQ number of the soundblaster."); Pint = secprop->Add_int("dma",Property::Changeable::WhenIdle,1); - Pint->Set_values(dmas); + Pint->Set_values(dmassb); Pint->Set_help("The DMA number of the soundblaster."); Pint = secprop->Add_int("hdma",Property::Changeable::WhenIdle,5); - Pint->Set_values(dmas); + Pint->Set_values(dmassb); Pint->Set_help("The High DMA number of the soundblaster."); Pbool = secprop->Add_bool("mixer",Property::Changeable::WhenIdle,true); diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 2514653b..9225d544 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdlmain.cpp,v 1.141 2008-02-21 19:25:34 c2woody Exp $ */ +/* $Id: sdlmain.cpp,v 1.142 2008-03-19 20:35:17 qbix79 Exp $ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -1464,7 +1464,7 @@ int main(int argc, char* argv[]) { Pmulti = sdl_sec->Add_multi("priority", Property::Changeable::Always, ","); Pmulti->SetValue("higher,normal"); - Pmulti->Set_help("priority -- Priority levels for dosbox. Second entry behind the comma is for when dosbox is not focused/minimized. (pause is only valid for the second entry)"); + Pmulti->Set_help("Priority levels for dosbox. Second entry behind the comma is for when dosbox is not focused/minimized. (pause is only valid for the second entry)"); const char* actt[] = { "lowest", "lower", "normal", "higher", "highest", "pause", 0}; Pstring = Pmulti->GetSection()->Add_string("active",Property::Changeable::Always,"higher"); diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index 8fa818b1..72c53193 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.cpp,v 1.46 2008-02-25 06:21:09 qbix79 Exp $ */ +/* $Id: setup.cpp,v 1.47 2008-03-19 20:35:18 qbix79 Exp $ */ #include "dosbox.h" #include "cross.h" @@ -300,6 +300,22 @@ void Prop_multival::SetValue(std::string const& input) { p->SetValue(in); } } +const std::vector& Property::GetValues() const { + return suggested_values; +} + const std::vector& Prop_multival::GetValues() const +{ + Property *p = section->Get_prop(0); + //No properties in this section. do nothing + if(!p) return suggested_values; + int i =0; + string::size_type loc = string::npos; + while( (p = section->Get_prop(i++)) ) { + std::vector v = p->GetValues(); + if(!v.empty()) return p->GetValues(); + } + return suggested_values; +} /* void Section_prop::Add_double(char const * const _propname, double _value) { @@ -469,22 +485,58 @@ void Config::PrintConfig(char const * const configfilename) const { fprintf(outfile,"\n"); for (const_it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ /* Print out the Section header */ + Section_prop *sec = dynamic_cast(*tel); strcpy(temp,(*tel)->GetName()); lowcase(temp); fprintf(outfile,"[%s]\n",temp); - upcase(temp); - strcat(temp,"_CONFIGFILE_HELP"); - const char * helpstr=MSG_Get(temp); - char * helpwrite=helpline; - while (*helpstr) { - *helpwrite++=*helpstr; - if (*helpstr == '\n') { - *helpwrite=0; - fprintf(outfile,"# %s",helpline); - helpwrite=helpline; + + if (sec) { + Property *p; + size_t i = 0, maxwidth = 0; + while ((p = sec->Get_prop(i++))) { + size_t w = strlen(p->propname.c_str()); + if (w > maxwidth) maxwidth = w; + } + i=0; + char prefix[80]; + snprintf(prefix,80, "\n# %*s ", maxwidth, ""); + while ((p = sec->Get_prop(i++))) { + std::string help = p->Get_help(); + std::string::size_type pos = std::string::npos; + while ((pos = help.find("\n", pos+1)) != std::string::npos) { + help.replace(pos, 1, prefix); + } + + fprintf(outfile, "# %*s: %s", maxwidth, p->propname.c_str(), help.c_str()); + + std::vector values = p->GetValues(); + if (!values.empty()) { + fprintf(outfile, "%s%s:", prefix, MSG_Get("CONFIG_SUGGESTED_VALUES")); + std::vector::iterator it = values.begin(); + while (it != values.end()) { + if (it != values.begin()) fputs(",", outfile); + fprintf(outfile, " %s", (*it).ToString().c_str()); + ++it; + } + } + fprintf(outfile, "\n"); + } + } else { + upcase(temp); + strcat(temp,"_CONFIGFILE_HELP"); + const char * helpstr=MSG_Get(temp); + char * helpwrite=helpline; + while (*helpstr) { + *helpwrite++=*helpstr; + if (*helpstr == '\n') { + *helpwrite=0; + fprintf(outfile,"# %s",helpline); + helpwrite=helpline; + } + helpstr++; } - helpstr++; } + fprintf(outfile,"\n"); (*tel)->PrintData(outfile); fprintf(outfile,"\n"); /* Always an empty line between sections */