mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
change dosbox property object to store help strings itself instead of
through MSG_Add/MSG_Get (what were they thinking?). convert redundant IDE section code to a loop.
This commit is contained in:
parent
758a3ac450
commit
6445feb63d
@ -122,7 +122,7 @@ public:
|
||||
struct Changeable { enum Value {Always, WhenIdle,OnlyAtStart};};
|
||||
const std::string propname;
|
||||
|
||||
Property(std::string const& _propname, Changeable::Value when):propname(_propname),change(when) { }
|
||||
Property(std::string const& _propname, Changeable::Value when):propname(_propname),change(when) { use_global_config_str=false; }
|
||||
void Set_values(const char * const * in);
|
||||
void Set_help(std::string const& str);
|
||||
char const* Get_help();
|
||||
@ -147,6 +147,8 @@ protected:
|
||||
typedef std::vector<Value>::iterator iter;
|
||||
Value default_value;
|
||||
const Changeable::Value change;
|
||||
bool use_global_config_str;
|
||||
std::string help_string;
|
||||
};
|
||||
|
||||
class Prop_int:public Property {
|
||||
|
@ -1135,33 +1135,34 @@ void DOSBOX_Init(void) {
|
||||
// secprop->AddInitFunction(&CREDITS_Init);
|
||||
|
||||
/* IDE emulation options and setup */
|
||||
/* FIXME: Why is DOSBox assigning our IDE primary help strings and defaults to ALL IDE sections?!? */
|
||||
secprop=control->AddSection_prop("ide, primary",&IDE_Primary_Init,false);//done
|
||||
Pbool = secprop->Add_bool("enable",Property::Changeable::OnlyAtStart,true);
|
||||
Pbool->Set_help("Enable IDE interface");
|
||||
Pbool = secprop->Add_bool("int13fakeio",Property::Changeable::WhenIdle,false);
|
||||
Pbool->Set_help("If set, force IDE state change on certain INT 13h commands.\n"
|
||||
"IDE registers will be changed as if BIOS had carried out the action.\n"
|
||||
"If you are running Windows 3.11 or Windows 3.11 Windows for Workgroups\n"
|
||||
"you must enable this option (and use -reservecyl 1) if you want 32-bit\n"
|
||||
"disk access to work correctly in DOSBox.");
|
||||
Pbool = secprop->Add_bool("int13fakev86io",Property::Changeable::WhenIdle,false);
|
||||
Pbool->Set_help("If set, and int13fakeio is set, certain INT 13h commands will\n"
|
||||
"cause IDE emulation to issue fake CPU I/O traps (GPF) in\n"
|
||||
"virtual 8086 mode and a fake IRQ signal. you must enable this option\n"
|
||||
"if you want 32-bit disk access in Windows 95 to work with DOSBox.");
|
||||
const char *ide_names[4] = {"ide, primary","ide, secondary","ide, tertiary","ide, quaternary"};
|
||||
void (*ide_inits[4])(Section *) = {
|
||||
&IDE_Primary_Init,
|
||||
&IDE_Secondary_Init,
|
||||
&IDE_Tertiary_Init,
|
||||
&IDE_Quaternary_Init
|
||||
};
|
||||
for (size_t i=0;i < 4;i++) {
|
||||
secprop=control->AddSection_prop(ide_names[i],ide_inits[i],false);//done
|
||||
|
||||
secprop=control->AddSection_prop("ide, secondary",&IDE_Secondary_Init,false);//done
|
||||
Pbool = secprop->Add_bool("enable",Property::Changeable::OnlyAtStart,true);
|
||||
Pbool = secprop->Add_bool("int13fakeio",Property::Changeable::WhenIdle,false);
|
||||
Pbool = secprop->Add_bool("enable",Property::Changeable::OnlyAtStart,true);
|
||||
if (i == 0) Pbool->Set_help("Enable IDE interface");
|
||||
|
||||
secprop=control->AddSection_prop("ide, tertiary",&IDE_Tertiary_Init,false);//done
|
||||
Pbool = secprop->Add_bool("enable",Property::Changeable::OnlyAtStart,false);
|
||||
Pbool = secprop->Add_bool("int13fakeio",Property::Changeable::WhenIdle,false);
|
||||
Pbool = secprop->Add_bool("int13fakeio",Property::Changeable::WhenIdle,false);
|
||||
if (i == 0) Pbool->Set_help(
|
||||
"If set, force IDE state change on certain INT 13h commands.\n"
|
||||
"IDE registers will be changed as if BIOS had carried out the action.\n"
|
||||
"If you are running Windows 3.11 or Windows 3.11 Windows for Workgroups\n"
|
||||
"you must enable this option (and use -reservecyl 1) if you want 32-bit\n"
|
||||
"disk access to work correctly in DOSBox.");
|
||||
|
||||
secprop=control->AddSection_prop("ide, quaternary",&IDE_Quaternary_Init,false);//done
|
||||
Pbool = secprop->Add_bool("enable",Property::Changeable::OnlyAtStart,false);
|
||||
Pbool = secprop->Add_bool("int13fakeio",Property::Changeable::WhenIdle,false);
|
||||
Pbool = secprop->Add_bool("int13fakev86io",Property::Changeable::WhenIdle,false);
|
||||
if (i == 0) Pbool->Set_help(
|
||||
"If set, and int13fakeio is set, certain INT 13h commands will\n"
|
||||
"cause IDE emulation to issue fake CPU I/O traps (GPF) in\n"
|
||||
"virtual 8086 mode and a fake IRQ signal. you must enable this option\n"
|
||||
"if you want 32-bit disk access in Windows 95 to work with DOSBox.");
|
||||
}
|
||||
|
||||
//TODO ?
|
||||
secline=control->AddSection_line("autoexec",&AUTOEXEC_Init);
|
||||
|
@ -231,16 +231,30 @@ bool Property::CheckValue(Value const& in, bool warn){
|
||||
return false;
|
||||
}
|
||||
|
||||
/* There are too many reasons I can think of to have similar property names per section
|
||||
* without tying them together by name. Sticking them in MSG_Add as CONFIG_ + propname
|
||||
* for help strings is just plain dumb. But... in the event that is still useful, I at
|
||||
* least left the code conditionally enabled if any part of the code still wants to do
|
||||
* that. --J.C */
|
||||
void Property::Set_help(string const& in) {
|
||||
string result = string("CONFIG_") + propname;
|
||||
upcase(result);
|
||||
MSG_Add(result.c_str(),in.c_str());
|
||||
if (use_global_config_str) {
|
||||
string result = string("CONFIG_") + propname;
|
||||
upcase(result);
|
||||
MSG_Add(result.c_str(),in.c_str());
|
||||
}
|
||||
else {
|
||||
help_string = in;
|
||||
}
|
||||
}
|
||||
|
||||
char const* Property::Get_help() {
|
||||
string result = string("CONFIG_") + propname;
|
||||
upcase(result);
|
||||
return MSG_Get(result.c_str());
|
||||
if (use_global_config_str) {
|
||||
string result = string("CONFIG_") + propname;
|
||||
upcase(result);
|
||||
return MSG_Get(result.c_str());
|
||||
}
|
||||
|
||||
return help_string.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user