Add cycles=number support. Based on patch of h-a-l-9000, but slightly better. Beautify the configfile a bit.(Beta2)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3304
This commit is contained in:
parent
e639014e95
commit
5d7701ef67
4 changed files with 32 additions and 7 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: setup.cpp,v 1.53 2009-02-01 15:52:25 qbix79 Exp $ */
|
||||
/* $Id: setup.cpp,v 1.54 2009-02-15 20:01:08 qbix79 Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "cross.h"
|
||||
|
@ -264,6 +264,22 @@ void Prop_string::SetValue(std::string const& input){
|
|||
Value val(temp,Value::V_STRING);
|
||||
SetVal(val,false,true);
|
||||
}
|
||||
bool Prop_string::CheckValue(Value const& in, bool warn){
|
||||
if(suggested_values.empty()) return true;
|
||||
for(iter it = suggested_values.begin();it != suggested_values.end();it++) {
|
||||
if ( (*it) == in) { //Match!
|
||||
return true;
|
||||
}
|
||||
if((*it).ToString() == "%u") {
|
||||
Bitu value;
|
||||
if(sscanf(in.ToString().c_str(),"%u",&value) == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(warn) LOG_MSG("\"%s\" is not a valid value for variable: %s.\nIt might now be reset it to default value: %s",in.ToString().c_str(),propname.c_str(),default_value.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void Prop_path::SetValue(std::string const& input){
|
||||
//Special version to merge realpath with it
|
||||
|
@ -632,10 +648,13 @@ bool Config::PrintConfig(char const * const configfilename) const {
|
|||
fprintf(outfile, "%s%s:", prefix, MSG_Get("CONFIG_SUGGESTED_VALUES"));
|
||||
std::vector<Value>::iterator it = values.begin();
|
||||
while (it != values.end()) {
|
||||
if (it != values.begin()) fputs(",", outfile);
|
||||
fprintf(outfile, " %s", (*it).ToString().c_str());
|
||||
if((*it).ToString() != "%u") { //Hack hack hack. else we need to modify GetValues, but that one is const...
|
||||
if (it != values.begin()) fputs(",", outfile);
|
||||
fprintf(outfile, " %s", (*it).ToString().c_str());
|
||||
}
|
||||
++it;
|
||||
}
|
||||
fprintf(outfile,".");
|
||||
}
|
||||
fprintf(outfile, "\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue