mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
Fix for hang, emu_options::add_slot_options was changed, other things are just cleanup (nw)
This commit is contained in:
parent
5f851c7a81
commit
841a55985e
@ -648,7 +648,7 @@ void cli_frontend::listslots(const char *gamename)
|
|||||||
{
|
{
|
||||||
if (slot->fixed()) continue;
|
if (slot->fixed()) continue;
|
||||||
// output the line, up to the list of extensions
|
// output the line, up to the list of extensions
|
||||||
printf("%-13s%-10s ", first ? drivlist.driver().name : "", std::string(slot->device().tag()).erase(0,1).c_str());
|
printf("%-13s%-10s ", first ? drivlist.driver().name : "", std::string(slot->device().tag()).substr(1).c_str());
|
||||||
|
|
||||||
bool first_option = true;
|
bool first_option = true;
|
||||||
|
|
||||||
|
@ -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 we have an 0x prefix, we must be a hex value
|
||||||
if (buffer[0] == '0' && buffer[1] == 'x')
|
if (buffer[0] == '0' && buffer[1] == 'x')
|
||||||
return parse_number(token, buffer.c_str() + 2, 16, expression_error::INVALID_NUMBER);
|
return parse_number(token, buffer.substr(2).c_str(), 16, expression_error::INVALID_NUMBER);
|
||||||
|
|
||||||
// if we have a # prefix, we must be a decimal value
|
// if we have a # prefix, we must be a decimal value
|
||||||
if (buffer[0] == '#')
|
if (buffer[0] == '#')
|
||||||
return parse_number(token, buffer.c_str() + 1, 10, expression_error::INVALID_NUMBER);
|
return parse_number(token, buffer.substr(1).c_str(), 10, expression_error::INVALID_NUMBER);
|
||||||
|
|
||||||
// if we have a $ prefix, we are a hex value
|
// if we have a $ prefix, we are a hex value
|
||||||
if (buffer[0] == '$')
|
if (buffer[0] == '$')
|
||||||
return parse_number(token, buffer.c_str() + 1, 16, expression_error::INVALID_NUMBER);
|
return parse_number(token, buffer.substr(1).c_str(), 16, expression_error::INVALID_NUMBER);
|
||||||
|
|
||||||
// check for a symbol match
|
// check for a symbol match
|
||||||
symbol_entry *symbol = m_symtable->find_deep(buffer.c_str());
|
symbol_entry *symbol = m_symtable->find_deep(buffer.c_str());
|
||||||
|
@ -65,8 +65,8 @@ device_t* device_slot_interface::get_card_device()
|
|||||||
{
|
{
|
||||||
std::string subtag;
|
std::string subtag;
|
||||||
device_t *dev = nullptr;
|
device_t *dev = nullptr;
|
||||||
if (device().mconfig().options().exists(device().tag().c_str()+1))
|
if (device().mconfig().options().exists(device().tag().substr(1).c_str()))
|
||||||
subtag = device().mconfig().options().main_value(device().tag().c_str()+1);
|
subtag = device().mconfig().options().main_value(device().tag().substr(1).c_str());
|
||||||
else if (m_default_option != nullptr)
|
else if (m_default_option != nullptr)
|
||||||
subtag.assign(m_default_option);
|
subtag.assign(m_default_option);
|
||||||
if (!subtag.empty()) {
|
if (!subtag.empty()) {
|
||||||
|
@ -241,19 +241,19 @@ bool emu_options::add_slot_options(bool isfirstpass)
|
|||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
// retrieve info about the device instance
|
// retrieve info about the device instance
|
||||||
const char *name = slot->device().tag().c_str() + 1;
|
std::string name(slot->device().tag().substr(1).c_str());
|
||||||
if (!exists(name))
|
if (!exists(name.c_str()))
|
||||||
{
|
{
|
||||||
// add the option
|
// add the option
|
||||||
UINT32 flags = OPTION_STRING | OPTION_FLAG_DEVICE;
|
UINT32 flags = OPTION_STRING | OPTION_FLAG_DEVICE;
|
||||||
const char *defvalue = slot->default_option();
|
std::string defvalue = (slot->default_option()==nullptr) ? std::string() : slot->default_option();
|
||||||
if (defvalue != nullptr)
|
if (defvalue.length() > 0)
|
||||||
{
|
{
|
||||||
const device_slot_option *option = slot->option(defvalue);
|
const device_slot_option *option = slot->option(defvalue.c_str());
|
||||||
if (option != nullptr && !option->selectable())
|
if (option != nullptr && !option->selectable())
|
||||||
flags |= OPTION_FLAG_INTERNAL;
|
flags |= OPTION_FLAG_INTERNAL;
|
||||||
}
|
}
|
||||||
add_entry(name, nullptr, flags, defvalue, true);
|
add_entry(name.c_str(), nullptr, flags, defvalue.c_str(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (options_count() != starting_count);
|
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())
|
for (device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
|
||||||
{
|
{
|
||||||
// retrieve info about the device instance
|
// retrieve info about the device instance
|
||||||
std::string name(slot->device().tag().c_str()+1);
|
std::string name(slot->device().tag().substr(1).c_str());
|
||||||
if (exists(name.c_str()) && slot->first_option() != nullptr)
|
if (exists(name.c_str()) && slot->first_option() != nullptr)
|
||||||
{
|
{
|
||||||
std::string defvalue = slot->get_default_card_software();
|
std::string defvalue = slot->get_default_card_software();
|
||||||
|
@ -40,9 +40,9 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
|
|||||||
{
|
{
|
||||||
device_t &owner = slot->device();
|
device_t &owner = slot->device();
|
||||||
std::string selval;
|
std::string selval;
|
||||||
bool isdefault = (options.priority(owner.tag().c_str()+1)==OPTION_PRIORITY_DEFAULT);
|
bool isdefault = (options.priority(owner.tag().substr(1).c_str())==OPTION_PRIORITY_DEFAULT);
|
||||||
if (is_selected_driver && options.exists(owner.tag().c_str()+1))
|
if (is_selected_driver && options.exists(owner.tag().substr(1).c_str()))
|
||||||
selval = options.main_value(owner.tag().c_str()+1);
|
selval = options.main_value(owner.tag().substr(1).c_str());
|
||||||
else if (slot->default_option() != nullptr)
|
else if (slot->default_option() != nullptr)
|
||||||
selval.assign(slot->default_option());
|
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);
|
device_t::static_set_input_default(*new_dev, input_device_defaults);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag().c_str()+1);
|
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag().substr(1).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,7 +1460,7 @@ rom_load_manager::rom_load_manager(running_machine &machine)
|
|||||||
if (device->owner() == nullptr) {
|
if (device->owner() == nullptr) {
|
||||||
specbios.assign(machine.options().bios());
|
specbios.assign(machine.options().bios());
|
||||||
} else {
|
} else {
|
||||||
specbios = machine.options().sub_value(std::string(device->owner()->tag()).c_str()+1,"bios");
|
specbios = machine.options().sub_value(std::string(device->owner()->tag()).substr(1).c_str(),"bios");
|
||||||
if (specbios.empty()) {
|
if (specbios.empty()) {
|
||||||
specbios = device->default_bios_tag();
|
specbios = device->default_bios_tag();
|
||||||
}
|
}
|
||||||
|
@ -1140,7 +1140,7 @@ void screen_device::finalize_burnin()
|
|||||||
|
|
||||||
// compute the name and create the file
|
// compute the name and create the file
|
||||||
emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
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().c_str() + 1, ".png") ;
|
file_error filerr = file.open(machine().basename(), PATH_SEPARATOR "burnin-", this->tag().substr(1).c_str(), ".png") ;
|
||||||
if (filerr == FILERR_NONE)
|
if (filerr == FILERR_NONE)
|
||||||
{
|
{
|
||||||
png_info pnginfo = { nullptr };
|
png_info pnginfo = { nullptr };
|
||||||
|
@ -28,7 +28,7 @@ void ui_menu_pty_info::populate()
|
|||||||
|
|
||||||
pty_interface_iterator iter(machine().root_device());
|
pty_interface_iterator iter(machine().root_device());
|
||||||
for (device_pty_interface *pty = iter.first(); pty != nullptr; pty = iter.next()) {
|
for (device_pty_interface *pty = iter.first(); pty != nullptr; pty = iter.next()) {
|
||||||
const char *port_name = pty->device().owner()->tag().c_str() + 1;
|
const char *port_name = pty->device().owner()->tag().substr(1).c_str();
|
||||||
if (pty->is_open()) {
|
if (pty->is_open()) {
|
||||||
item_append(port_name , pty->slave_name() , MENU_FLAG_DISABLE , nullptr);
|
item_append(port_name , pty->slave_name() , MENU_FLAG_DISABLE , nullptr);
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,7 +81,7 @@ void ui_menu_bios_selection::populate()
|
|||||||
val = ROM_GETHASHDATA(rom);
|
val = ROM_GETHASHDATA(rom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_append(device->tag()==":" ? "driver" : device->tag().c_str()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
|
item_append(device->tag()==":" ? "driver" : device->tag().substr(1).c_str(), val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,9 +124,9 @@ void ui_menu_bios_selection::handle()
|
|||||||
assert(error.empty());
|
assert(error.empty());
|
||||||
} else {
|
} else {
|
||||||
std::string error;
|
std::string error;
|
||||||
std::string value = machine().options().main_value(dev->owner()->tag().c_str()+1);
|
std::string value = machine().options().main_value(dev->owner()->tag().substr(1).c_str());
|
||||||
strcatprintf(value,",bios=%d",val-1);
|
strcatprintf(value,",bios=%d",val-1);
|
||||||
machine().options().set_value(dev->owner()->tag().c_str()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error);
|
machine().options().set_value(dev->owner()->tag().substr(1).c_str(), value.c_str(), OPTION_PRIORITY_CMDLINE, error);
|
||||||
assert(error.empty());
|
assert(error.empty());
|
||||||
}
|
}
|
||||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||||
|
@ -29,7 +29,7 @@ device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_in
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current = machine().options().main_value(slot->device().tag().c_str() + 1);
|
current = machine().options().main_value(slot->device().tag().substr(1).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return slot->option(current.c_str());
|
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)
|
void ui_menu_slot_devices::set_slot_device(device_slot_interface *slot, const char *val)
|
||||||
{
|
{
|
||||||
std::string error;
|
std::string error;
|
||||||
machine().options().set_value(slot->device().tag().c_str()+1, val, OPTION_PRIORITY_CMDLINE, error);
|
machine().options().set_value(slot->device().tag().substr(1).c_str(), val, OPTION_PRIORITY_CMDLINE, error);
|
||||||
assert(error.empty());
|
assert(error.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ void ui_menu_slot_devices::populate()
|
|||||||
opt_name.append(" [internal]");
|
opt_name.append(" [internal]");
|
||||||
}
|
}
|
||||||
|
|
||||||
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(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(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
|
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
|
||||||
item_append("Reset", nullptr, 0, (void *)1);
|
item_append("Reset", nullptr, 0, (void *)1);
|
||||||
|
@ -1042,7 +1042,7 @@ void validity_checker::build_output_prefix(std::string &str)
|
|||||||
|
|
||||||
// if we have a current (non-root) device, indicate that
|
// if we have a current (non-root) device, indicate that
|
||||||
if (m_current_device != nullptr && m_current_device->owner() != nullptr)
|
if (m_current_device != nullptr && m_current_device->owner() != nullptr)
|
||||||
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag().c_str()+1).append("': ");
|
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag().substr(1).c_str()).append("': ");
|
||||||
|
|
||||||
// if we have a current port, indicate that as well
|
// if we have a current port, indicate that as well
|
||||||
if (m_current_ioport != nullptr)
|
if (m_current_ioport != nullptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user