Made quicklaunch work for slot/image devices (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2011-07-03 18:21:07 +00:00
parent c7cb84ca5a
commit 4add4516fe
3 changed files with 37 additions and 18 deletions

View File

@ -218,10 +218,9 @@ int cli_frontend::execute(int argc, char **argv)
// mount only if not already mounted
if (strlen(option)==0) {
astring val;
astring error;
val.printf("%s:%s",m_options.software_name(),swpart->name);
m_options.set_value(image->brief_instance_name(), val.cstr(), OPTION_PRIORITY_CMDLINE, error);
assert(!error);
// call this in order to set slot devices according to mounting
m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.cstr());
}
break;
}

View File

@ -296,11 +296,13 @@ void emu_options::add_device_options(bool isfirst)
option_name.printf("%s;%s", image->instance_name(), image->brief_instance_name());
// add the option
entry[0].name = option_name;
entry[0].description = NULL;
entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE;
entry[0].defvalue = NULL;
add_entries(entry, true);
if (!exists(image->instance_name())) {
entry[0].name = option_name;
entry[0].description = NULL;
entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE;
entry[0].defvalue = NULL;
add_entries(entry, true);
}
}
}
@ -325,6 +327,32 @@ void emu_options::remove_device_options()
}
//-------------------------------------------------
// parse_slot_devices - parse the command line
// and update slot and image devices
//-------------------------------------------------
bool emu_options::parse_slot_devices(int argc, char *argv[], astring &error_string, const char *name, const char *value)
{
remove_device_options();
add_device_options(true);
if (name && exists(name)) {
set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string);
}
bool isfirst = true;
bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
while (add_slot_options(isfirst)) {
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
add_device_options(false);
if (name && exists(name)) {
set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string);
}
isfirst = false;
}
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
return result;
}
//-------------------------------------------------
// parse_command_line - parse the command line
// and update the devices
@ -342,16 +370,7 @@ bool emu_options::parse_command_line(int argc, char *argv[], astring &error_stri
if (old_system_name != system_name())
{
// remove any existing device options
remove_device_options();
add_device_options(true);
bool isfirst = true;
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
while (add_slot_options(isfirst)) {
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
add_device_options(false);
isfirst = false;
}
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
result = parse_slot_devices(argc, argv, error_string, NULL, NULL);
}
return result;
}

View File

@ -215,6 +215,7 @@ public:
// parsing wrappers
bool parse_command_line(int argc, char *argv[], astring &error_string);
void parse_standard_inis(astring &error_string);
bool parse_slot_devices(int argc, char *argv[], astring &error_string, const char *name, const char *value);
// core options
const char *system_name() const { return value(OPTION_SYSTEMNAME); }