Revert "Fix for hang, emu_options::add_slot_options was changed, other things are just cleanup (nw)"

This reverts commit 841a55985e.
This commit is contained in:
Miodrag Milanovic 2016-01-20 21:32:11 +01:00
parent d5464a5799
commit abb7f223b3
11 changed files with 27 additions and 27 deletions

View File

@ -648,7 +648,7 @@ void cli_frontend::listslots(const char *gamename)
{
if (slot->fixed()) continue;
// output the line, up to the list of extensions
printf("%-13s%-10s ", first ? drivlist.driver().name : "", std::string(slot->device().tag()).substr(1).c_str());
printf("%-13s%-10s ", first ? drivlist.driver().name : "", std::string(slot->device().tag()).erase(0,1).c_str());
bool first_option = true;

View File

@ -927,15 +927,15 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *&
// if we have an 0x prefix, we must be a hex value
if (buffer[0] == '0' && buffer[1] == 'x')
return parse_number(token, buffer.substr(2).c_str(), 16, expression_error::INVALID_NUMBER);
return parse_number(token, buffer.c_str() + 2, 16, expression_error::INVALID_NUMBER);
// if we have a # prefix, we must be a decimal value
if (buffer[0] == '#')
return parse_number(token, buffer.substr(1).c_str(), 10, expression_error::INVALID_NUMBER);
return parse_number(token, buffer.c_str() + 1, 10, expression_error::INVALID_NUMBER);
// if we have a $ prefix, we are a hex value
if (buffer[0] == '$')
return parse_number(token, buffer.substr(1).c_str(), 16, expression_error::INVALID_NUMBER);
return parse_number(token, buffer.c_str() + 1, 16, expression_error::INVALID_NUMBER);
// check for a symbol match
symbol_entry *symbol = m_symtable->find_deep(buffer.c_str());

View File

@ -65,8 +65,8 @@ device_t* device_slot_interface::get_card_device()
{
std::string subtag;
device_t *dev = nullptr;
if (device().mconfig().options().exists(device().tag().substr(1).c_str()))
subtag = device().mconfig().options().main_value(device().tag().substr(1).c_str());
if (device().mconfig().options().exists(device().tag().c_str()+1))
subtag = device().mconfig().options().main_value(device().tag().c_str()+1);
else if (m_default_option != nullptr)
subtag.assign(m_default_option);
if (!subtag.empty()) {

View File

@ -241,19 +241,19 @@ bool emu_options::add_slot_options(bool isfirstpass)
first = false;
// retrieve info about the device instance
std::string name(slot->device().tag().substr(1).c_str());
if (!exists(name.c_str()))
const char *name = slot->device().tag().c_str() + 1;
if (!exists(name))
{
// add the option
UINT32 flags = OPTION_STRING | OPTION_FLAG_DEVICE;
std::string defvalue = (slot->default_option()==nullptr) ? std::string() : slot->default_option();
if (defvalue.length() > 0)
const char *defvalue = slot->default_option();
if (defvalue != nullptr)
{
const device_slot_option *option = slot->option(defvalue.c_str());
const device_slot_option *option = slot->option(defvalue);
if (option != nullptr && !option->selectable())
flags |= OPTION_FLAG_INTERNAL;
}
add_entry(name.c_str(), nullptr, flags, defvalue.c_str(), true);
add_entry(name, nullptr, flags, defvalue, true);
}
}
return (options_count() != starting_count);
@ -278,7 +278,7 @@ void emu_options::update_slot_options()
for (device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
{
// retrieve info about the device instance
std::string name(slot->device().tag().substr(1).c_str());
std::string name(slot->device().tag().c_str()+1);
if (exists(name.c_str()) && slot->first_option() != nullptr)
{
std::string defvalue = slot->get_default_card_software();

View File

@ -40,9 +40,9 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
{
device_t &owner = slot->device();
std::string selval;
bool isdefault = (options.priority(owner.tag().substr(1).c_str())==OPTION_PRIORITY_DEFAULT);
if (is_selected_driver && options.exists(owner.tag().substr(1).c_str()))
selval = options.main_value(owner.tag().substr(1).c_str());
bool isdefault = (options.priority(owner.tag().c_str()+1)==OPTION_PRIORITY_DEFAULT);
if (is_selected_driver && options.exists(owner.tag().c_str()+1))
selval = options.main_value(owner.tag().c_str()+1);
else if (slot->default_option() != nullptr)
selval.assign(slot->default_option());
@ -67,7 +67,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
device_t::static_set_input_default(*new_dev, input_device_defaults);
}
else
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag().substr(1).c_str());
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag().c_str()+1);
}
}

View File

@ -1460,7 +1460,7 @@ rom_load_manager::rom_load_manager(running_machine &machine)
if (device->owner() == nullptr) {
specbios.assign(machine.options().bios());
} else {
specbios = machine.options().sub_value(std::string(device->owner()->tag()).substr(1).c_str(),"bios");
specbios = machine.options().sub_value(std::string(device->owner()->tag()).c_str()+1,"bios");
if (specbios.empty()) {
specbios = device->default_bios_tag();
}

View File

@ -1140,7 +1140,7 @@ void screen_device::finalize_burnin()
// compute the name and create the file
emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "burnin-", this->tag().substr(1).c_str(), ".png") ;
file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "burnin-", this->tag().c_str() + 1, ".png") ;
if (filerr == FILERR_NONE)
{
png_info pnginfo = { nullptr };

View File

@ -28,7 +28,7 @@ void ui_menu_pty_info::populate()
pty_interface_iterator iter(machine().root_device());
for (device_pty_interface *pty = iter.first(); pty != nullptr; pty = iter.next()) {
const char *port_name = pty->device().owner()->tag().substr(1).c_str();
const char *port_name = pty->device().owner()->tag().c_str() + 1;
if (pty->is_open()) {
item_append(port_name , pty->slave_name() , MENU_FLAG_DISABLE , nullptr);
} else {

View File

@ -81,7 +81,7 @@ void ui_menu_bios_selection::populate()
val = ROM_GETHASHDATA(rom);
}
}
item_append(device->tag()==":" ? "driver" : device->tag().substr(1).c_str(), val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
item_append(device->tag()==":" ? "driver" : device->tag().c_str()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
}
}
@ -124,9 +124,9 @@ void ui_menu_bios_selection::handle()
assert(error.empty());
} else {
std::string error;
std::string value = machine().options().main_value(dev->owner()->tag().substr(1).c_str());
std::string value = machine().options().main_value(dev->owner()->tag().c_str()+1);
strcatprintf(value,",bios=%d",val-1);
machine().options().set_value(dev->owner()->tag().substr(1).c_str(), value.c_str(), OPTION_PRIORITY_CMDLINE, error);
machine().options().set_value(dev->owner()->tag().c_str()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error);
assert(error.empty());
}
reset(UI_MENU_RESET_REMEMBER_REF);

View File

@ -29,7 +29,7 @@ device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_in
}
else
{
current = machine().options().main_value(slot->device().tag().substr(1).c_str());
current = machine().options().main_value(slot->device().tag().c_str() + 1);
}
return slot->option(current.c_str());
@ -135,7 +135,7 @@ const char *ui_menu_slot_devices::slot_get_option(device_slot_interface *slot, i
void ui_menu_slot_devices::set_slot_device(device_slot_interface *slot, const char *val)
{
std::string error;
machine().options().set_value(slot->device().tag().substr(1).c_str(), val, OPTION_PRIORITY_CMDLINE, error);
machine().options().set_value(slot->device().tag().c_str()+1, val, OPTION_PRIORITY_CMDLINE, error);
assert(error.empty());
}
@ -166,7 +166,7 @@ void ui_menu_slot_devices::populate()
opt_name.append(" [internal]");
}
item_append(slot->device().tag().substr(1).c_str(), opt_name.c_str(), (slot->fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot);
item_append(slot->device().tag().c_str() + 1, opt_name.c_str(), (slot->fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot);
}
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
item_append("Reset", nullptr, 0, (void *)1);

View File

@ -1042,7 +1042,7 @@ void validity_checker::build_output_prefix(std::string &str)
// if we have a current (non-root) device, indicate that
if (m_current_device != nullptr && m_current_device->owner() != nullptr)
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag().substr(1).c_str()).append("': ");
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag().c_str()+1).append("': ");
// if we have a current port, indicate that as well
if (m_current_ioport != nullptr)