This commit is contained in:
David Haywood 2016-04-20 21:43:52 +01:00
commit b5c2c8f1a5
92 changed files with 1388 additions and 1512 deletions

View File

@ -5385,6 +5385,37 @@
</part>
</software>
<!--***************************************
dev board, same ID as gowcaizr
***************************************-->
<software name="dragonsh">
<description>Dragon's Heaven (development board)</description>
<year>1997</year>
<publisher>Face</publisher>
<sharedfeat name="release" value="MVS" />
<sharedfeat name="compatibility" value="MVS,AES" />
<part name="cart" interface="neo_cart">
<dataarea name="maincpu" width="16" endianness="big" size="0x100000">
<rom loadflag="load16_byte" name="EP2.bin" offset="0x000000" size="0x080000" crc="f25c71ad" sha1="803fb6cd6a7ada59678ad901ff9788b1e54ddd0c" />
<rom loadflag="load16_byte" name="EP1.bin" offset="0x000001" size="0x080000" crc="f353448c" sha1="f0f966ca15d503e01b40e901765ff0888463b65d" />
</dataarea>
<dataarea name="fixed" size="0x040000">
<rom offset="0x000000" size="0x020000" name="s1.s1" status="baddump" crc="706477a7" sha1="8cbee7f6832e7edd2dc792ca330420a6a984b879" />
</dataarea>
<dataarea name="audiocpu" size="0x30000">
<rom value="0xff" size="0x30000" offset="0" loadflag="fill" />
</dataarea>
<dataarea name="ymsnd" size="0x200000">
<rom offset="0x000000" size="0x200000" name="sram.v1" status="nodump" />
</dataarea>
<dataarea name="sprites" size="0x2000000">
<rom loadflag="load16_byte" name="no3.bin" offset="0x000000" size="0x1000000" crc="81821826" sha1="b7c1a53e32633383675206a16c68f6f2ff984865" />
<rom loadflag="load16_byte" name="no4.bin" offset="0x000001" size="0x1000000" crc="3601d568" sha1="800323e52f5d33b402f84d31850b42c688082d67" />
</dataarea>
</part>
</software>
<!--***************************************
ID-0095
. NGM-095

View File

@ -754,7 +754,7 @@ msgstr "チート"
#: src/emu/ui/mainmenu.cpp:135
msgid "Plugin Options"
msgstr ""
msgstr "プラグイン設定"
#: src/emu/ui/mainmenu.cpp:139
msgid "External DAT View"
@ -892,15 +892,15 @@ msgstr "%s.txtをuiフォルダーに保存しました。"
#: src/emu/ui/miscmenu.cpp:677
msgid "Export list in XML format (like -listxml)"
msgstr ""
msgstr "XML形式でリストを出力-listxml同様"
#: src/emu/ui/miscmenu.cpp:678
msgid "Export list in XML format (like -listxml, but exclude devices)"
msgstr ""
msgstr "XML形式でリストを出力-listxml同様、デバイスを除く"
#: src/emu/ui/miscmenu.cpp:679
msgid "Export list in TXT format (like -listfull)"
msgstr ""
msgstr "TXT形式でリストを出力-listfull同様"
#: src/emu/ui/miscmenu.cpp:729 src/emu/ui/optsmenu.cpp:376
msgid ""
@ -918,7 +918,7 @@ msgstr ""
#: src/emu/ui/miscmenu.cpp:776
msgid "Driver"
msgstr ""
msgstr "ドライバ"
#: src/emu/ui/miscmenu.cpp:790
msgid "Save machine configuration"
@ -926,7 +926,7 @@ msgstr "マシン設定を保存する"
#: src/emu/ui/miscmenu.cpp:806
msgid "Configure machine:"
msgstr ""
msgstr "マシン設定"
#: src/emu/ui/miscmenu.cpp:868 src/emu/ui/selsoft.cpp:109
msgid " (default)"
@ -1026,6 +1026,10 @@ msgid ""
"\n"
"Press any key to continue."
msgstr ""
"選択したマシンに必要な1つ以上のROMまたはCHDが不足しています。"
"別のマシンを選択してください。\n"
"\n"
"進めるには、何かキーを押してください。"
#: src/emu/ui/selgame.cpp:595 src/emu/ui/simpleselgame.cpp:265
msgid "Configure Options"
@ -1304,11 +1308,15 @@ msgid ""
"\n"
"Press any key to continue."
msgstr ""
"選択したソフトウェアに必要な1つ以上のファイルが不足しています。"
"別のソフトウェアを選択してください。\n"
"\n"
"進めるには、何かキーを押してください。"
#: src/emu/ui/selsoft.cpp:683
#, c-format
msgid "%1$s %2$s ( %3$d / %4$d software packages )"
msgstr ""
msgstr "%1$s %2$s %3$d / %4$d ソフトウェアパッケージ "
#: src/emu/ui/selsoft.cpp:684
#, c-format

View File

@ -67,8 +67,6 @@ files {
MAME_DIR .. "src/emu/cheat.h",
MAME_DIR .. "src/emu/clifront.cpp",
MAME_DIR .. "src/emu/clifront.h",
MAME_DIR .. "src/emu/cliopts.cpp",
MAME_DIR .. "src/emu/cliopts.h",
MAME_DIR .. "src/emu/config.cpp",
MAME_DIR .. "src/emu/config.h",
MAME_DIR .. "src/emu/crsshair.cpp",

View File

@ -252,11 +252,9 @@ void abc890_t::device_reset()
void abc890_t::abcbus_cs(UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->cs_w(data);
slot.cs_w(data);
}
}
@ -269,11 +267,9 @@ UINT8 abc890_t::abcbus_inp()
{
UINT8 data = 0xff;
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
data &= slot->inp_r();
data &= slot.inp_r();
}
return data;
@ -286,11 +282,9 @@ UINT8 abc890_t::abcbus_inp()
void abc890_t::abcbus_out(UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->out_w(data);
slot.out_w(data);
}
}
@ -303,11 +297,9 @@ UINT8 abc890_t::abcbus_stat()
{
UINT8 data = 0xff;
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
data &= slot->stat_r();
data &= slot.stat_r();
}
return data;
@ -320,11 +312,9 @@ UINT8 abc890_t::abcbus_stat()
void abc890_t::abcbus_c1(UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->c1_w(data);
slot.c1_w(data);
}
}
@ -335,11 +325,9 @@ void abc890_t::abcbus_c1(UINT8 data)
void abc890_t::abcbus_c2(UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->c2_w(data);
slot.c2_w(data);
}
}
@ -350,11 +338,9 @@ void abc890_t::abcbus_c2(UINT8 data)
void abc890_t::abcbus_c3(UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->c3_w(data);
slot.c3_w(data);
}
}
@ -365,11 +351,9 @@ void abc890_t::abcbus_c3(UINT8 data)
void abc890_t::abcbus_c4(UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->c4_w(data);
slot.c4_w(data);
}
}
@ -382,11 +366,9 @@ UINT8 abc890_t::abcbus_xmemfl(offs_t offset)
{
UINT8 data = 0xff;
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
data &= slot->xmemfl_r(offset);
data &= slot.xmemfl_r(offset);
}
return data;
@ -399,10 +381,8 @@ UINT8 abc890_t::abcbus_xmemfl(offs_t offset)
void abc890_t::abcbus_xmemw(offs_t offset, UINT8 data)
{
abcbus_slot_device_iterator iter(*this);
for (abcbus_slot_t *slot = iter.first(); slot != nullptr; slot = iter.next())
for (abcbus_slot_t &slot : abcbus_slot_device_iterator(*this))
{
slot->xmemw_w(offset, data);
slot.xmemw_w(offset, data);
}
}

View File

@ -74,17 +74,13 @@ c64_bn1541_device::c64_bn1541_device(const machine_config &mconfig, const char *
void c64_bn1541_device::device_start()
{
device_iterator iter(machine().root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
for (device_t &device : device_iterator(machine().root_device()))
{
device_iterator subiter(*device);
for (device_t *subdevice = subiter.first(); subdevice != nullptr; subdevice = iter.next())
for (device_t &subdevice : device_iterator(device))
{
if (subdevice->interface(m_other) && subdevice != this)
if (subdevice.interface(m_other) && &subdevice != this)
{
if (LOG) logerror("Parallel device %s\n", subdevice->tag());
if (LOG) logerror("Parallel device %s\n", subdevice.tag());
// grab the first 1541/1571 and run to the hills
m_other->m_other = this;

View File

@ -372,7 +372,6 @@ void cassette_image_device::call_display()
int n;
double position, length;
cassette_state uistate;
cassette_image_device *dev;
static const UINT8 shapes[8] = { 0x2d, 0x5c, 0x7c, 0x2f, 0x2d, 0x20, 0x20, 0x20 };
/* abort if we should not be showing the image */
@ -390,9 +389,7 @@ void cassette_image_device::call_display()
x = 0.2f;
y = 0.5f;
cassette_device_iterator iter(device().machine().root_device());
for (dev = iter.first(); dev != nullptr && strcmp( dev->tag(), device().tag() ); dev = iter.next())
y += 1;
y += cassette_device_iterator(device().machine().root_device()).indexof(*this);
y *= device().machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
/* choose which frame of the animation we are at */

View File

@ -5010,12 +5010,11 @@ void voodoo_device::common_start_voodoo(UINT8 type)
}
/* set the type, and initialize the chip mask */
device_iterator iter(machine().root_device());
index = 0;
for (device_t *scan = iter.first(); scan != nullptr; scan = iter.next())
if (scan->type() == this->type())
for (device_t &scan : device_iterator(machine().root_device()))
if (scan.type() == this->type())
{
if (scan == this)
if (&scan == this)
break;
index++;
}

View File

@ -696,11 +696,10 @@ void address_map::map_validity_check(validity_checker &valid, const device_t &de
std::string entry_region = entry.m_devbase.subtag(entry.m_region);
// look for the region
device_iterator deviter(device.mconfig().root_device());
for (device_t *dev = deviter.first(); dev != nullptr; dev = deviter.next())
for (const rom_entry *romp = rom_first_region(*dev); romp != nullptr && !found; romp = rom_next_region(romp))
for (device_t &dev : device_iterator(device.mconfig().root_device()))
for (const rom_entry *romp = rom_first_region(dev); romp != nullptr && !found; romp = rom_next_region(romp))
{
if (rom_region_name(*dev, romp) == entry_region)
if (rom_region_name(dev, romp) == entry_region)
{
// verify the address range is within the region's bounds
offs_t length = ROMREGION_GETLENGTH(romp);

View File

@ -54,26 +54,25 @@ const char *driverpath = m_enumerator.config().root_device().searchpath();
int shared_required = 0;
// iterate over devices and regions
device_iterator deviter(m_enumerator.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (device_t &device : device_iterator(m_enumerator.config().root_device()))
{
// determine the search path for this source and iterate through the regions
m_searchpath = device->searchpath();
m_searchpath = device.searchpath();
// now iterate over regions and ROMs within
for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
{
// temporary hack: add the driver path & region name
std::string combinedpath = std::string(device->searchpath()).append(";").append(driverpath);
if (device->shortname())
combinedpath.append(";").append(device->shortname());
std::string combinedpath = std::string(device.searchpath()).append(";").append(driverpath);
if (device.shortname())
combinedpath.append(";").append(device.shortname());
m_searchpath = combinedpath.c_str();
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
const char *name = ROM_GETNAME(rom);
hash_collection hashes(ROM_GETHASHDATA(rom));
device_t *shared_device = find_shared_device(*device, name, hashes, ROM_GETLENGTH(rom));
device_t *shared_device = find_shared_device(device, name, hashes, ROM_GETLENGTH(rom));
// count the number of files with hashes
if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom))
@ -95,7 +94,7 @@ m_searchpath = combinedpath.c_str();
if (record != nullptr)
{
// count the number of files that are found.
if (record->status() == audit_record::STATUS_GOOD || (record->status() == audit_record::STATUS_FOUND_INVALID && find_shared_device(*device, name, record->actual_hashes(), record->actual_length()) == nullptr))
if (record->status() == audit_record::STATUS_GOOD || (record->status() == audit_record::STATUS_FOUND_INVALID && find_shared_device(device, name, record->actual_hashes(), record->actual_length()) == nullptr))
{
found++;
if (shared_device != nullptr)
@ -124,20 +123,20 @@ m_searchpath = combinedpath.c_str();
// audit_device - audit the device
//-------------------------------------------------
media_auditor::summary media_auditor::audit_device(device_t *device, const char *validation)
media_auditor::summary media_auditor::audit_device(device_t &device, const char *validation)
{
// start fresh
m_record_list.reset();
// store validation for later
m_validation = validation;
m_searchpath = device->shortname();
m_searchpath = device.shortname();
int found = 0;
int required = 0;
// now iterate over regions and ROMs within
for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
{
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
@ -173,7 +172,7 @@ media_auditor::summary media_auditor::audit_device(device_t *device, const char
}
// return a summary
return summarize(device->shortname());
return summarize(device.shortname());
}
@ -270,14 +269,13 @@ media_auditor::summary media_auditor::audit_samples()
int found = 0;
// iterate over sample entries
samples_device_iterator iterator(m_enumerator.config().root_device());
for (samples_device *device = iterator.first(); device != nullptr; device = iterator.next())
for (samples_device &device : samples_device_iterator(m_enumerator.config().root_device()))
{
// by default we just search using the driver name
std::string searchpath(m_enumerator.driver().name);
// add the alternate path if present
samples_iterator iter(*device);
samples_iterator iter(device);
if (iter.altbasename() != nullptr)
searchpath.append(";").append(iter.altbasename());
@ -560,15 +558,14 @@ device_t *media_auditor::find_shared_device(device_t &device, const char *name,
// iterate up the parent chain
for (int drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex != -1; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent))
{
device_iterator deviter(m_enumerator.config(drvindex).root_device());
for (device_t *scandevice = deviter.first(); scandevice != nullptr; scandevice = deviter.next())
for (const rom_entry *region = rom_first_region(*scandevice); region; region = rom_next_region(region))
for (device_t &scandevice : device_iterator(m_enumerator.config(drvindex).root_device()))
for (const rom_entry *region = rom_first_region(scandevice); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name))
highest_device = scandevice;
highest_device = &scandevice;
}
}
}

View File

@ -145,7 +145,7 @@ public:
// audit operations
summary audit_media(const char *validation = AUDIT_VALIDATE_FULL);
summary audit_device(device_t *device, const char *validation = AUDIT_VALIDATE_FULL);
summary audit_device(device_t &device, const char *validation = AUDIT_VALIDATE_FULL);
summary audit_software(const char *list_name, software_info *swinfo, const char *validation = AUDIT_VALIDATE_FULL);
summary audit_samples();
summary summarize(const char *name,std::string *output = nullptr);

View File

@ -820,7 +820,7 @@ bool cheat_entry::activate()
{
execute_on_script();
changed = true;
manager().machine().popmessage("Activated %s", m_description.c_str());
m_manager.machine().popmessage("Activated %s", m_description.c_str());
}
// if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change
@ -828,7 +828,7 @@ bool cheat_entry::activate()
{
execute_change_script();
changed = true;
manager().machine().popmessage("Activated\n %s = %s", m_description.c_str(), m_parameter->text());
m_manager.machine().popmessage("Activated\n %s = %s", m_description.c_str(), m_parameter->text());
}
return changed;
@ -1141,22 +1141,21 @@ void cheat_manager::reload()
// load the cheat file, if it's a system that has a software list then try softlist_name/shortname.xml first,
// if it fails to load then try to load via crc32 - basename/crc32.xml ( eg. 01234567.xml )
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
if (image->exists())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
if (image.exists())
{
// if we are loading through a software list, try to load softlist_name/shortname.xml
// this allows the coexistence of arcade cheats with cheats for home conversions which
// have the same shortname
if (image->software_entry() != nullptr)
if (image.software_entry() != nullptr)
{
load_cheats(string_format("%s%s%s", image->software_list_name(), PATH_SEPARATOR, image->basename()).c_str());
load_cheats(string_format("%s%s%s", image.software_list_name(), PATH_SEPARATOR, image.basename()).c_str());
break;
}
// else we are loading outside the software list, try to load machine_basename/crc32.xml
else
{
UINT32 crc = image->crc();
UINT32 crc = image.crc();
if (crc != 0)
{
load_cheats(string_format("%s%s%08X", machine().basename(), PATH_SEPARATOR, crc).c_str());

View File

@ -17,7 +17,6 @@
#include "unzip.h"
#include "validity.h"
#include "sound/samples.h"
#include "cliopts.h"
#include "clifront.h"
#include "xmlfile.h"
@ -32,6 +31,80 @@
#include <ctype.h>
//**************************************************************************
// CONSTANTS
//**************************************************************************
// core commands
#define CLICOMMAND_HELP "help"
#define CLICOMMAND_VALIDATE "validate"
// configuration commands
#define CLICOMMAND_CREATECONFIG "createconfig"
#define CLICOMMAND_SHOWCONFIG "showconfig"
#define CLICOMMAND_SHOWUSAGE "showusage"
// frontend commands
#define CLICOMMAND_LISTXML "listxml"
#define CLICOMMAND_LISTFULL "listfull"
#define CLICOMMAND_LISTSOURCE "listsource"
#define CLICOMMAND_LISTCLONES "listclones"
#define CLICOMMAND_LISTBROTHERS "listbrothers"
#define CLICOMMAND_LISTCRC "listcrc"
#define CLICOMMAND_LISTROMS "listroms"
#define CLICOMMAND_LISTSAMPLES "listsamples"
#define CLICOMMAND_VERIFYROMS "verifyroms"
#define CLICOMMAND_VERIFYSAMPLES "verifysamples"
#define CLICOMMAND_ROMIDENT "romident"
#define CLICOMMAND_LISTDEVICES "listdevices"
#define CLICOMMAND_LISTSLOTS "listslots"
#define CLICOMMAND_LISTMEDIA "listmedia" // needed by MESS
#define CLICOMMAND_LISTSOFTWARE "listsoftware"
#define CLICOMMAND_VERIFYSOFTWARE "verifysoftware"
#define CLICOMMAND_GETSOFTLIST "getsoftlist"
#define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist"
//**************************************************************************
// COMMAND-LINE OPTIONS
//**************************************************************************
static const options_entry cli_option_entries[] =
{
/* core commands */
{ nullptr, nullptr, OPTION_HEADER, "CORE COMMANDS" },
{ CLICOMMAND_HELP ";h;?", "0", OPTION_COMMAND, "show help message" },
{ CLICOMMAND_VALIDATE ";valid", "0", OPTION_COMMAND, "perform driver validation on all game drivers" },
/* configuration commands */
{ nullptr, nullptr, OPTION_HEADER, "CONFIGURATION COMMANDS" },
{ CLICOMMAND_CREATECONFIG ";cc", "0", OPTION_COMMAND, "create the default configuration file" },
{ CLICOMMAND_SHOWCONFIG ";sc", "0", OPTION_COMMAND, "display running parameters" },
{ CLICOMMAND_SHOWUSAGE ";su", "0", OPTION_COMMAND, "show this help" },
/* frontend commands */
{ nullptr, nullptr, OPTION_HEADER, "FRONTEND COMMANDS" },
{ CLICOMMAND_LISTXML ";lx", "0", OPTION_COMMAND, "all available info on driver in XML format" },
{ CLICOMMAND_LISTFULL ";ll", "0", OPTION_COMMAND, "short name, full name" },
{ CLICOMMAND_LISTSOURCE ";ls", "0", OPTION_COMMAND, "driver sourcefile" },
{ CLICOMMAND_LISTCLONES ";lc", "0", OPTION_COMMAND, "show clones" },
{ CLICOMMAND_LISTBROTHERS ";lb", "0", OPTION_COMMAND, "show \"brothers\", or other drivers from same sourcefile" },
{ CLICOMMAND_LISTCRC, "0", OPTION_COMMAND, "CRC-32s" },
{ CLICOMMAND_LISTROMS ";lr", "0", OPTION_COMMAND, "list required roms for a driver" },
{ CLICOMMAND_LISTSAMPLES, "0", OPTION_COMMAND, "list optional samples for a driver" },
{ CLICOMMAND_VERIFYROMS, "0", OPTION_COMMAND, "report romsets that have problems" },
{ CLICOMMAND_VERIFYSAMPLES, "0", OPTION_COMMAND, "report samplesets that have problems" },
{ CLICOMMAND_ROMIDENT, "0", OPTION_COMMAND, "compare files with known MAME roms" },
{ CLICOMMAND_LISTDEVICES ";ld", "0", OPTION_COMMAND, "list available devices" },
{ CLICOMMAND_LISTSLOTS ";lslot", "0", OPTION_COMMAND, "list available slots and slot devices" },
{ CLICOMMAND_LISTMEDIA ";lm", "0", OPTION_COMMAND, "list available media for the system" },
{ CLICOMMAND_LISTSOFTWARE ";lsoft", "0", OPTION_COMMAND, "list known software for the system" },
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" },
{ CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" },
{ CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" },
{ nullptr }
};
// media_identifier class identifies media by hash via a search in
// the driver database
@ -39,7 +112,7 @@ class media_identifier
{
public:
// construction/destruction
media_identifier(cli_options &options);
media_identifier(emu_options &options);
// getters
int total() const { return m_total; }
@ -70,11 +143,12 @@ private:
// cli_frontend - constructor
//-------------------------------------------------
cli_frontend::cli_frontend(cli_options &options, osd_interface &osd)
cli_frontend::cli_frontend(emu_options &options, osd_interface &osd)
: m_options(options),
m_osd(osd),
m_result(MAMERR_NONE)
{
m_options.add_entries(cli_option_entries);
}
@ -123,37 +197,36 @@ int cli_frontend::execute(int argc, char **argv)
throw emu_fatalerror(MAMERR_FATALERROR, "Error: unknown option: %s\n", m_options.software_name());
bool found = false;
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
for (software_list_device &swlistdev : iter)
{
software_info *swinfo = swlistdev->find(m_options.software_name());
software_info *swinfo = swlistdev.find(m_options.software_name());
if (swinfo != nullptr)
{
// loop through all parts
for (software_part &swpart : swinfo->parts())
{
const char *mount = swpart.feature("automount");
if (swpart.is_compatible(*swlistdev))
if (swpart.is_compatible(swlistdev))
{
if (mount == nullptr || strcmp(mount,"no") != 0)
{
// search for an image device with the right interface
image_interface_iterator imgiter(config.root_device());
for (device_image_interface *image = imgiter.first(); image != nullptr; image = imgiter.next())
for (device_image_interface &image : image_interface_iterator(config.root_device()))
{
const char *interface = image->image_interface();
const char *interface = image.image_interface();
if (interface != nullptr)
{
if (swpart.matches_interface(interface))
{
const char *option = m_options.value(image->brief_instance_name());
const char *option = m_options.value(image.brief_instance_name());
// mount only if not already mounted
if (*option == 0)
{
std::string val = string_format("%s:%s:%s", swlistdev->list_name(), m_options.software_name(), swpart.name());
std::string val = string_format("%s:%s:%s", swlistdev.list_name(), m_options.software_name(), swpart.name());
// call this in order to set slot devices according to mounting
m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.c_str(), &swpart);
m_options.parse_slot_devices(argc, argv, option_errors, image.instance_name(), val.c_str(), &swpart);
break;
}
}
@ -434,15 +507,14 @@ void cli_frontend::listcrc(const char *gamename)
// iterate through matches, and then through ROMs
while (drivlist.next())
{
device_iterator deviter(drivlist.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region; region = rom_next_region(region))
for (device_t &device : device_iterator(drivlist.config().root_device()))
for (const rom_entry *region = rom_first_region(device); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
// if we have a CRC, display it
UINT32 crc;
if (hash_collection(ROM_GETHASHDATA(rom)).crc(crc))
osd_printf_info("%08x %-16s \t %-8s \t %s\n", crc, ROM_GETNAME(rom), device->shortname(), device->name());
osd_printf_info("%08x %-16s \t %-8s \t %s\n", crc, ROM_GETNAME(rom), device.shortname(), device.name());
}
}
}
@ -472,9 +544,8 @@ void cli_frontend::listroms(const char *gamename)
"Name Size Checksum\n", drivlist.driver().name);
// iterate through roms
device_iterator deviter(drivlist.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region; region = rom_next_region(region))
for (device_t &device : device_iterator(drivlist.config().root_device()))
for (const rom_entry *region = rom_first_region(device); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
// accumulate the total length of all chunks
@ -538,9 +609,9 @@ void cli_frontend::listsamples(const char *gamename)
osd_printf_info("Samples required for driver \"%s\".\n", drivlist.driver().name);
// iterate over samples devices and print the samples from each one
for (samples_device *device = iter.first(); device != nullptr; device = iter.next())
for (samples_device &device : iter)
{
samples_iterator sampiter(*device);
samples_iterator sampiter(device);
for (const char *samplename = sampiter.first(); samplename != nullptr; samplename = sampiter.next())
osd_printf_info("%s\n", samplename);
}
@ -578,10 +649,9 @@ void cli_frontend::listdevices(const char *gamename)
printf("Driver %s (%s):\n", drivlist.driver().name, drivlist.driver().description);
// build a list of devices
device_iterator iter(drivlist.config().root_device());
std::vector<device_t *> device_list;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device_list.push_back(device);
for (device_t &device : device_iterator(drivlist.config().root_device()))
device_list.push_back(&device);
// sort them by tag
qsort(&device_list[0], device_list.size(), sizeof(device_list[0]), compare_devices);
@ -649,18 +719,17 @@ void cli_frontend::listslots(const char *gamename)
while (drivlist.next())
{
// iterate
slot_interface_iterator iter(drivlist.config().root_device());
bool first = true;
for (const device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
for (const device_slot_interface &slot : slot_interface_iterator(drivlist.config().root_device()))
{
if (slot->fixed()) continue;
if (slot.fixed()) continue;
// output the line, up to the list of extensions
printf("%-13s%-10s ", first ? drivlist.driver().name : "", slot->device().tag()+1);
printf("%-13s%-10s ", first ? drivlist.driver().name : "", slot.device().tag()+1);
bool first_option = true;
// get the options and print them
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
if (option.selectable())
{
@ -710,21 +779,20 @@ void cli_frontend::listmedia(const char *gamename)
while (drivlist.next())
{
// iterate
image_interface_iterator iter(drivlist.config().root_device());
bool first = true;
for (const device_image_interface *imagedev = iter.first(); imagedev != nullptr; imagedev = iter.next())
for (const device_image_interface &imagedev : image_interface_iterator(drivlist.config().root_device()))
{
if (!imagedev->user_loadable())
continue;
if (!imagedev.user_loadable())
continue;
// extract the shortname with parentheses
std::string paren_shortname = string_format("(%s)", imagedev->brief_instance_name());
std::string paren_shortname = string_format("(%s)", imagedev.brief_instance_name());
// output the line, up to the list of extensions
printf("%-13s%-12s%-8s ", first ? drivlist.driver().name : "", imagedev->instance_name(), paren_shortname.c_str());
printf("%-13s%-12s%-8s ", first ? drivlist.driver().name : "", imagedev.instance_name(), paren_shortname.c_str());
// get the extensions and print them
std::string extensions(imagedev->file_extensions());
std::string extensions(imagedev.file_extensions());
for (int start = 0, end = extensions.find_first_of(',');; start = end + 1, end = extensions.find_first_of(',', start))
{
std::string curext(extensions, start, (end == -1) ? extensions.length() - start : end - start);
@ -817,11 +885,10 @@ void cli_frontend::verifyroms(const char *gamename)
while (dummy_drivlist.next())
{
machine_config &config = dummy_drivlist.config();
device_iterator iter(config.root_device());
for (device_t *dev = iter.first(); dev != nullptr; dev = iter.next())
for (device_t &dev : device_iterator(config.root_device()))
{
if (dev->owner() != nullptr && (*(dev->shortname()) != 0) && dev->rom_region() != nullptr && (device_map.insert(dev->shortname()).second)) {
if (core_strwildcmp(gamename, dev->shortname()) == 0)
if (dev.owner() != nullptr && (*(dev.shortname()) != 0) && dev.rom_region() != nullptr && (device_map.insert(dev.shortname()).second)) {
if (core_strwildcmp(gamename, dev.shortname()) == 0)
{
matched++;
@ -836,11 +903,11 @@ void cli_frontend::verifyroms(const char *gamename)
{
// output the summary of the audit
std::string summary_string;
auditor.summarize(dev->shortname(),&summary_string);
auditor.summarize(dev.shortname(),&summary_string);
osd_printf_info("%s", summary_string.c_str());
// display information about what we discovered
osd_printf_info("romset %s ", dev->shortname());
osd_printf_info("romset %s ", dev.shortname());
// switch off of the result
switch (summary)
@ -868,20 +935,18 @@ void cli_frontend::verifyroms(const char *gamename)
}
}
slot_interface_iterator slotiter(config.root_device());
for (const device_slot_interface *slot = slotiter.first(); slot != nullptr; slot = slotiter.next())
for (const device_slot_interface &slot : slot_interface_iterator(config.root_device()))
{
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
std::string temptag("_");
temptag.append(option.name());
device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.c_str(), option.devtype(), 0);
// notify this device and all its subdevices that they are now configured
device_iterator subiter(*dev);
for (device_t *device = subiter.first(); device != nullptr; device = subiter.next())
if (!device->configured())
device->config_complete();
for (device_t &device : device_iterator(*dev))
if (!device.configured())
device.config_complete();
if (device_map.insert(dev->shortname()).second) {
if (core_strwildcmp(gamename, dev->shortname()) == 0)
@ -890,7 +955,7 @@ void cli_frontend::verifyroms(const char *gamename)
if (dev->rom_region() != nullptr)
{
// audit the ROMs in this set
media_auditor::summary summary = auditor.audit_device(dev, AUDIT_VALIDATE_FAST);
media_auditor::summary summary = auditor.audit_device(*dev, AUDIT_VALIDATE_FAST);
// if not found, count that and leave it at that
if (summary == media_auditor::NOTFOUND)
@ -933,17 +998,15 @@ void cli_frontend::verifyroms(const char *gamename)
}
} else {
// check for subdevices with ROMs (a few devices are missed otherwise, e.g. MPU401)
device_iterator subiter(*dev);
for (device_t *device = subiter.first(); device != nullptr; device = subiter.next())
for (device_t &device : device_iterator(*dev))
{
device_iterator subsubiter(*device);
for (device_t *subdev = subsubiter.first(); subdev != nullptr; subdev = subsubiter.next())
for (device_t &subdev : device_iterator(device))
{
if (subdev->owner() == device && subdev->rom_region() != nullptr && subdev->shortname() != nullptr && subdev->shortname()[0] != '\0')
if (subdev.owner() == &device && subdev.rom_region() != nullptr && subdev.shortname() != nullptr && subdev.shortname()[0] != '\0')
{
if (device_map.insert(subdev->shortname()).second)
if (device_map.insert(subdev.shortname()).second)
{
if (core_strwildcmp(gamename, subdev->shortname()) == 0)
if (core_strwildcmp(gamename, subdev.shortname()) == 0)
{
matched++;
@ -959,11 +1022,11 @@ void cli_frontend::verifyroms(const char *gamename)
{
// output the summary of the audit
std::string summary_string;
auditor.summarize(subdev->shortname(),&summary_string);
auditor.summarize(subdev.shortname(),&summary_string);
osd_printf_info("%s", summary_string.c_str());
// display information about what we discovered
osd_printf_info("romset %s ", subdev->shortname());
osd_printf_info("romset %s ", subdev.shortname());
// switch off of the result
switch (summary)
@ -1311,13 +1374,12 @@ void cli_frontend::listsoftware(const char *gamename)
while (drivlist.next())
{
software_list_device_iterator iter(drivlist.config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (list_map.insert(swlistdev->list_name()).second)
if (!swlistdev->get_info().empty())
for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device()))
if (list_map.insert(swlistdev.list_name()).second)
if (!swlistdev.get_info().empty())
{
if (isfirst) { fprintf(out, SOFTLIST_XML_BEGIN); isfirst = false; }
output_single_softlist(out, *swlistdev);
output_single_softlist(out, swlistdev);
}
}
@ -1354,16 +1416,15 @@ void cli_frontend::verifysoftware(const char *gamename)
{
matched++;
software_list_device_iterator iter(drivlist.config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (swlistdev->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
if (list_map.insert(swlistdev->list_name()).second)
if (!swlistdev->get_info().empty())
for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device()))
if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
if (list_map.insert(swlistdev.list_name()).second)
if (!swlistdev.get_info().empty())
{
nrlists++;
for (software_info &swinfo : swlistdev->get_info())
for (software_info &swinfo : swlistdev.get_info())
{
media_auditor::summary summary = auditor.audit_software(swlistdev->list_name(), &swinfo, AUDIT_VALIDATE_FAST);
media_auditor::summary summary = auditor.audit_software(swlistdev.list_name(), &swinfo, AUDIT_VALIDATE_FAST);
// if not found, count that and leave it at that
if (summary == media_auditor::NOTFOUND)
@ -1379,7 +1440,7 @@ void cli_frontend::verifysoftware(const char *gamename)
osd_printf_info("%s", summary_string.c_str());
// display information about what we discovered
osd_printf_info("romset %s:%s ", swlistdev->list_name(), swinfo.shortname());
osd_printf_info("romset %s:%s ", swlistdev.list_name(), swinfo.shortname());
// switch off of the result
switch (summary)
@ -1442,13 +1503,12 @@ void cli_frontend::getsoftlist(const char *gamename)
driver_enumerator drivlist(m_options);
while (drivlist.next())
{
software_list_device_iterator iter(drivlist.config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (core_strwildcmp(gamename, swlistdev->list_name()) == 0 && list_map.insert(swlistdev->list_name()).second)
if (!swlistdev->get_info().empty())
for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device()))
if (core_strwildcmp(gamename, swlistdev.list_name()) == 0 && list_map.insert(swlistdev.list_name()).second)
if (!swlistdev.get_info().empty())
{
if (isfirst) { fprintf( out, SOFTLIST_XML_BEGIN); isfirst = FALSE; }
output_single_softlist(out, *swlistdev);
output_single_softlist(out, swlistdev);
}
}
@ -1475,17 +1535,16 @@ void cli_frontend::verifysoftlist(const char *gamename)
while (drivlist.next())
{
software_list_device_iterator iter(drivlist.config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (core_strwildcmp(gamename, swlistdev->list_name()) == 0 && list_map.insert(swlistdev->list_name()).second)
if (!swlistdev->get_info().empty())
for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device()))
if (core_strwildcmp(gamename, swlistdev.list_name()) == 0 && list_map.insert(swlistdev.list_name()).second)
if (!swlistdev.get_info().empty())
{
matched++;
// Get the actual software list contents
for (software_info &swinfo : swlistdev->get_info())
for (software_info &swinfo : swlistdev.get_info())
{
media_auditor::summary summary = auditor.audit_software(swlistdev->list_name(), &swinfo, AUDIT_VALIDATE_FAST);
media_auditor::summary summary = auditor.audit_software(swlistdev.list_name(), &swinfo, AUDIT_VALIDATE_FAST);
// if not found, count that and leave it at that
if (summary == media_auditor::NOTFOUND)
@ -1501,7 +1560,7 @@ void cli_frontend::verifysoftlist(const char *gamename)
osd_printf_info("%s", summary_string.c_str());
// display information about what we discovered
osd_printf_info("romset %s:%s ", swlistdev->list_name(), swinfo.shortname());
osd_printf_info("romset %s:%s ", swlistdev.list_name(), swinfo.shortname());
// switch off of the result
switch (summary)
@ -1742,7 +1801,7 @@ void cli_frontend::display_suggestions(const char *gamename)
// media_identifier - constructor
//-------------------------------------------------
media_identifier::media_identifier(cli_options &options)
media_identifier::media_identifier(emu_options &options)
: m_drivlist(options),
m_total(0),
m_matches(0),
@ -1937,13 +1996,12 @@ int media_identifier::find_by_hash(const hash_collection &hashes, int length)
m_drivlist.reset();
while (m_drivlist.next())
{
// iterate over devices, regions and files within the region */
device_iterator deviter(m_drivlist.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
// iterate over devices, regions and files within the region
for (device_t &device : device_iterator(m_drivlist.config().root_device()))
{
if (shortnames.insert(device->shortname()).second)
if (shortnames.insert(device.shortname()).second)
{
for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom))
{
hash_collection romhashes(ROM_GETHASHDATA(rom));
@ -1962,12 +2020,11 @@ int media_identifier::find_by_hash(const hash_collection &hashes, int length)
}
// next iterate over softlists
software_list_device_iterator iter(m_drivlist.config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
for (software_list_device &swlistdev : software_list_device_iterator(m_drivlist.config().root_device()))
{
if (listnames.insert(swlistdev->list_name()).second)
if (listnames.insert(swlistdev.list_name()).second)
{
for (software_info &swinfo : swlistdev->get_info())
for (software_info &swinfo : swlistdev.get_info())
for (software_part &part : swinfo.parts())
for (const rom_entry *region = part.romdata(); region != nullptr; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom))
@ -1980,7 +2037,7 @@ int media_identifier::find_by_hash(const hash_collection &hashes, int length)
// output information about the match
if (found)
osd_printf_info(" ");
osd_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlistdev->list_name(), swinfo.shortname(), swinfo.longname());
osd_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlistdev.list_name(), swinfo.shortname(), swinfo.longname());
found++;
}
}

View File

@ -14,7 +14,7 @@
#define __CLIFRONT_H__
#include "emu.h"
#include "cliopts.h"
#include "emuopts.h"
// don't include osd_interface in header files
class osd_interface;
@ -29,7 +29,7 @@ class cli_frontend
{
public:
// construction/destruction
cli_frontend(cli_options &options, osd_interface &osd);
cli_frontend(emu_options &options, osd_interface &osd);
~cli_frontend();
// execute based on the incoming argc/argv
@ -64,7 +64,7 @@ private:
void output_single_softlist(FILE *out, software_list_device &swlist);
// internal state
cli_options & m_options;
emu_options & m_options;
osd_interface & m_osd;
int m_result;
};

View File

@ -1,63 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
cliopts.c
***************************************************************************/
#include "cliopts.h"
//**************************************************************************
// COMMAND-LINE OPTIONS
//**************************************************************************
const options_entry cli_options::s_option_entries[] =
{
/* core commands */
{ nullptr, nullptr, OPTION_HEADER, "CORE COMMANDS" },
{ CLICOMMAND_HELP ";h;?", "0", OPTION_COMMAND, "show help message" },
{ CLICOMMAND_VALIDATE ";valid", "0", OPTION_COMMAND, "perform driver validation on all game drivers" },
/* configuration commands */
{ nullptr, nullptr, OPTION_HEADER, "CONFIGURATION COMMANDS" },
{ CLICOMMAND_CREATECONFIG ";cc", "0", OPTION_COMMAND, "create the default configuration file" },
{ CLICOMMAND_SHOWCONFIG ";sc", "0", OPTION_COMMAND, "display running parameters" },
{ CLICOMMAND_SHOWUSAGE ";su", "0", OPTION_COMMAND, "show this help" },
/* frontend commands */
{ nullptr, nullptr, OPTION_HEADER, "FRONTEND COMMANDS" },
{ CLICOMMAND_LISTXML ";lx", "0", OPTION_COMMAND, "all available info on driver in XML format" },
{ CLICOMMAND_LISTFULL ";ll", "0", OPTION_COMMAND, "short name, full name" },
{ CLICOMMAND_LISTSOURCE ";ls", "0", OPTION_COMMAND, "driver sourcefile" },
{ CLICOMMAND_LISTCLONES ";lc", "0", OPTION_COMMAND, "show clones" },
{ CLICOMMAND_LISTBROTHERS ";lb", "0", OPTION_COMMAND, "show \"brothers\", or other drivers from same sourcefile" },
{ CLICOMMAND_LISTCRC, "0", OPTION_COMMAND, "CRC-32s" },
{ CLICOMMAND_LISTROMS ";lr", "0", OPTION_COMMAND, "list required roms for a driver" },
{ CLICOMMAND_LISTSAMPLES, "0", OPTION_COMMAND, "list optional samples for a driver" },
{ CLICOMMAND_VERIFYROMS, "0", OPTION_COMMAND, "report romsets that have problems" },
{ CLICOMMAND_VERIFYSAMPLES, "0", OPTION_COMMAND, "report samplesets that have problems" },
{ CLICOMMAND_ROMIDENT, "0", OPTION_COMMAND, "compare files with known MAME roms" },
{ CLICOMMAND_LISTDEVICES ";ld", "0", OPTION_COMMAND, "list available devices" },
{ CLICOMMAND_LISTSLOTS ";lslot", "0", OPTION_COMMAND, "list available slots and slot devices" },
{ CLICOMMAND_LISTMEDIA ";lm", "0", OPTION_COMMAND, "list available media for the system" },
{ CLICOMMAND_LISTSOFTWARE ";lsoft", "0", OPTION_COMMAND, "list known software for the system" },
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" },
{ CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" },
{ CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" },
{ nullptr }
};
//**************************************************************************
// CLI OPTIONS
//**************************************************************************
//-------------------------------------------------
// cli_options - constructor
//-------------------------------------------------
cli_options::cli_options()
: emu_options()
{
add_entries(cli_options::s_option_entries);
}

View File

@ -1,67 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
cliopts.h
Command-line interface frontend for MAME.
***************************************************************************/
#pragma once
#ifndef __CLIOPTS_H__
#define __CLIOPTS_H__
#include "emuopts.h"
//**************************************************************************
// CONSTANTS
//**************************************************************************
// core commands
#define CLICOMMAND_HELP "help"
#define CLICOMMAND_VALIDATE "validate"
// configuration commands
#define CLICOMMAND_CREATECONFIG "createconfig"
#define CLICOMMAND_SHOWCONFIG "showconfig"
#define CLICOMMAND_SHOWUSAGE "showusage"
// frontend commands
#define CLICOMMAND_LISTXML "listxml"
#define CLICOMMAND_LISTFULL "listfull"
#define CLICOMMAND_LISTSOURCE "listsource"
#define CLICOMMAND_LISTCLONES "listclones"
#define CLICOMMAND_LISTBROTHERS "listbrothers"
#define CLICOMMAND_LISTCRC "listcrc"
#define CLICOMMAND_LISTROMS "listroms"
#define CLICOMMAND_LISTSAMPLES "listsamples"
#define CLICOMMAND_VERIFYROMS "verifyroms"
#define CLICOMMAND_VERIFYSAMPLES "verifysamples"
#define CLICOMMAND_ROMIDENT "romident"
#define CLICOMMAND_LISTDEVICES "listdevices"
#define CLICOMMAND_LISTSLOTS "listslots"
#define CLICOMMAND_LISTMEDIA "listmedia" // needed by MESS
#define CLICOMMAND_LISTSOFTWARE "listsoftware"
#define CLICOMMAND_VERIFYSOFTWARE "verifysoftware"
#define CLICOMMAND_GETSOFTLIST "getsoftlist"
#define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// cli_options wraps the general emu options with CLI-specific additions
class cli_options : public emu_options
{
public:
// construction/destruction
cli_options();
private:
static const options_entry s_option_entries[];
};
#endif /* __CLIFRONT_H__ */

View File

@ -569,19 +569,15 @@ int debug_command_parameter_cpu(running_machine &machine, const char *param, dev
}
/* if we got a valid one, return */
const UINT64 original_cpunum = cpunum;
execute_interface_iterator iter(machine.root_device());
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
device_execute_interface *exec = execute_interface_iterator(machine.root_device()).byindex(cpunum);
if (exec != nullptr)
{
if (cpunum-- == 0)
{
*result = &exec->device();
return TRUE;
}
*result = &exec->device();
return TRUE;
}
/* if out of range, complain */
debug_console_printf(machine, "Invalid CPU index %d\n", (UINT32)original_cpunum);
debug_console_printf(machine, "Invalid CPU index %d\n", (int)cpunum);
return FALSE;
}
@ -1009,10 +1005,9 @@ static void execute_focus(running_machine &machine, int ref, int params, const c
cpu->debug()->ignore(false);
/* then loop over CPUs and set the ignore flags on all other CPUs */
execute_interface_iterator iter(machine.root_device());
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
if (&exec->device() != cpu)
exec->device().debug()->ignore(true);
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
if (&exec.device() != cpu)
exec.device().debug()->ignore(true);
debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag());
}
@ -1029,16 +1024,15 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all executable devices */
execute_interface_iterator iter(machine.root_device());
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
/* build up a comma-separated list */
if (!exec->device().debug()->observing())
if (!exec.device().debug()->observing())
{
if (buffer.empty())
buffer = string_format("Currently ignoring device '%s'", exec->device().tag());
buffer = string_format("Currently ignoring device '%s'", exec.device().tag());
else
buffer.append(string_format(", '%s'", exec->device().tag()));
buffer.append(string_format(", '%s'", exec.device().tag()));
}
/* special message for none */
@ -1061,10 +1055,9 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
for (int paramnum = 0; paramnum < params; paramnum++)
{
/* make sure this isn't the last live CPU */
execute_interface_iterator iter(machine.root_device());
bool gotone = false;
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
if (&exec->device() != devicelist[paramnum] && exec->device().debug()->observing())
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
if (&exec.device() != devicelist[paramnum] && exec.device().debug()->observing())
{
gotone = true;
break;
@ -1094,16 +1087,15 @@ static void execute_observe(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all executable devices */
execute_interface_iterator iter(machine.root_device());
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
/* build up a comma-separated list */
if (exec->device().debug()->observing())
if (exec.device().debug()->observing())
{
if (buffer.empty())
buffer = string_format("Currently observing CPU '%s'", exec->device().tag());
buffer = string_format("Currently observing CPU '%s'", exec.device().tag());
else
buffer.append(string_format(", '%s'", exec->device().tag()));
buffer.append(string_format(", '%s'", exec.device().tag()));
}
/* special message for none */
@ -1246,9 +1238,8 @@ static void execute_bpclear(running_machine &machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->breakpoint_clear_all();
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->breakpoint_clear_all();
debug_console_printf(machine, "Cleared all breakpoints\n");
}
@ -1257,10 +1248,9 @@ static void execute_bpclear(running_machine &machine, int ref, int params, const
return;
else
{
device_iterator iter(machine.root_device());
bool found = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->breakpoint_clear(bpindex))
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->breakpoint_clear(bpindex))
found = true;
if (found)
debug_console_printf(machine, "Breakpoint %X cleared\n", (UINT32)bpindex);
@ -1282,9 +1272,8 @@ static void execute_bpdisenable(running_machine &machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->breakpoint_enable_all(ref);
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->breakpoint_enable_all(ref);
if (ref == 0)
debug_console_printf(machine, "Disabled all breakpoints\n");
else
@ -1296,10 +1285,9 @@ static void execute_bpdisenable(running_machine &machine, int ref, int params, c
return;
else
{
device_iterator iter(machine.root_device());
bool found = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->breakpoint_enable(bpindex, ref))
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->breakpoint_enable(bpindex, ref))
found = true;
if (found)
debug_console_printf(machine, "Breakpoint %X %s\n", (UINT32)bpindex, ref ? "enabled" : "disabled");
@ -1320,16 +1308,15 @@ static void execute_bplist(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all CPUs */
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->breakpoint_first() != nullptr)
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->breakpoint_first() != nullptr)
{
debug_console_printf(machine, "Device '%s' breakpoints:\n", device->tag());
debug_console_printf(machine, "Device '%s' breakpoints:\n", device.tag());
/* loop over the breakpoints */
for (device_debug::breakpoint *bp = device->debug()->breakpoint_first(); bp != nullptr; bp = bp->next())
for (device_debug::breakpoint *bp = device.debug()->breakpoint_first(); bp != nullptr; bp = bp->next())
{
buffer = string_format("%c%4X @ %0*X", bp->enabled() ? ' ' : 'D', bp->index(), device->debug()->logaddrchars(), bp->address());
buffer = string_format("%c%4X @ %0*X", bp->enabled() ? ' ' : 'D', bp->index(), device.debug()->logaddrchars(), bp->address());
if (std::string(bp->condition()).compare("1") != 0)
buffer.append(string_format(" if %s", bp->condition()));
if (std::string(bp->action()).compare("") != 0)
@ -1409,9 +1396,8 @@ static void execute_wpclear(running_machine &machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->watchpoint_clear_all();
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->watchpoint_clear_all();
debug_console_printf(machine, "Cleared all watchpoints\n");
}
@ -1420,10 +1406,9 @@ static void execute_wpclear(running_machine &machine, int ref, int params, const
return;
else
{
device_iterator iter(machine.root_device());
bool found = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->watchpoint_clear(wpindex))
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->watchpoint_clear(wpindex))
found = true;
if (found)
debug_console_printf(machine, "Watchpoint %X cleared\n", (UINT32)wpindex);
@ -1445,9 +1430,8 @@ static void execute_wpdisenable(running_machine &machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->watchpoint_enable_all(ref);
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->watchpoint_enable_all(ref);
if (ref == 0)
debug_console_printf(machine, "Disabled all watchpoints\n");
else
@ -1459,10 +1443,9 @@ static void execute_wpdisenable(running_machine &machine, int ref, int params, c
return;
else
{
device_iterator iter(machine.root_device());
bool found = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->watchpoint_enable(wpindex, ref))
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->watchpoint_enable(wpindex, ref))
found = true;
if (found)
debug_console_printf(machine, "Watchpoint %X %s\n", (UINT32)wpindex, ref ? "enabled" : "disabled");
@ -1483,18 +1466,17 @@ static void execute_wplist(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all CPUs */
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
for (device_t &device : device_iterator(machine.root_device()))
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; ++spacenum)
if (device->debug()->watchpoint_first(spacenum) != nullptr)
if (device.debug()->watchpoint_first(spacenum) != nullptr)
{
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device->tag(),
device->debug()->watchpoint_first(spacenum)->space().name());
debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device.tag(),
device.debug()->watchpoint_first(spacenum)->space().name());
/* loop over the watchpoints */
for (device_debug::watchpoint *wp = device->debug()->watchpoint_first(spacenum); wp != nullptr; wp = wp->next())
for (device_debug::watchpoint *wp = device.debug()->watchpoint_first(spacenum); wp != nullptr; wp = wp->next())
{
buffer = string_format("%c%4X @ %0*X-%0*X %s", wp->enabled() ? ' ' : 'D', wp->index(),
wp->space().addrchars(), wp->space().byte_to_address(wp->address()),
@ -1556,9 +1538,8 @@ static void execute_rpclear(running_machine &machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->registerpoint_clear_all();
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->registerpoint_clear_all();
debug_console_printf(machine, "Cleared all registerpoints\n");
}
@ -1567,10 +1548,9 @@ static void execute_rpclear(running_machine &machine, int ref, int params, const
return;
else
{
device_iterator iter(machine.root_device());
bool found = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->registerpoint_clear(rpindex))
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->registerpoint_clear(rpindex))
found = true;
if (found)
debug_console_printf(machine, "Registerpoint %X cleared\n", (UINT32)rpindex);
@ -1592,9 +1572,8 @@ static void execute_rpdisenable(running_machine &machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->registerpoint_enable_all(ref);
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->registerpoint_enable_all(ref);
if (ref == 0)
debug_console_printf(machine, "Disabled all registerpoints\n");
else
@ -1606,10 +1585,9 @@ static void execute_rpdisenable(running_machine &machine, int ref, int params, c
return;
else
{
device_iterator iter(machine.root_device());
bool found = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->registerpoint_enable(rpindex, ref))
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->registerpoint_enable(rpindex, ref))
found = true;
if (found)
debug_console_printf(machine, "Registerpoint %X %s\n", (UINT32)rpindex, ref ? "enabled" : "disabled");
@ -1630,14 +1608,13 @@ static void execute_rplist(running_machine &machine, int ref, int params, const
std::string buffer;
/* loop over all CPUs */
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->registerpoint_first() != nullptr)
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->registerpoint_first() != nullptr)
{
debug_console_printf(machine, "Device '%s' registerpoints:\n", device->tag());
debug_console_printf(machine, "Device '%s' registerpoints:\n", device.tag());
/* loop over the breakpoints */
for (device_debug::registerpoint *rp = device->debug()->registerpoint_first(); rp != nullptr; rp = rp->next())
for (device_debug::registerpoint *rp = device.debug()->registerpoint_first(); rp != nullptr; rp = rp->next())
{
buffer = string_format("%c%4X if %s", rp->enabled() ? ' ' : 'D', rp->index(), rp->condition());
if (rp->action() != nullptr)
@ -1665,12 +1642,11 @@ static void execute_hotspot(running_machine &machine, int ref, int params, const
bool cleared = false;
/* loop over CPUs and find live spots */
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug()->hotspot_tracking_enabled())
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug()->hotspot_tracking_enabled())
{
device->debug()->hotspot_track(0, 0);
debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", device->tag());
device.debug()->hotspot_track(0, 0);
debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", device.tag());
cleared = true;
}
@ -1718,11 +1694,10 @@ static void execute_stateload(running_machine &machine, int ref, int params, con
machine.immediate_load(filename.c_str());
// Clear all PC & memory tracks
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
for (device_t &device : device_iterator(machine.root_device()))
{
device->debug()->track_pc_data_clear();
device->debug()->track_mem_data_clear();
device.debug()->track_pc_data_clear();
device.debug()->track_mem_data_clear();
}
debug_console_printf(machine, "State load attempted. Please refer to window message popup for results.\n");
}
@ -3036,13 +3011,10 @@ static void execute_hardreset(running_machine &machine, int ref, int params, con
static void execute_images(running_machine &machine, int ref, int params, const char **param)
{
image_interface_iterator iter(machine.root_device());
for (device_image_interface *img = iter.first(); img != nullptr; img = iter.next())
{
debug_console_printf(machine, "%s: %s\n",img->brief_instance_name(),img->exists() ? img->filename() : "[empty slot]");
}
if (iter.first() == nullptr) {
for (device_image_interface &img : iter)
debug_console_printf(machine, "%s: %s\n", img.brief_instance_name(), img.exists() ? img.filename() : "[empty slot]");
if (iter.first() == nullptr)
debug_console_printf(machine, "No image devices in this driver\n");
}
}
/*-------------------------------------------------
@ -3051,16 +3023,15 @@ static void execute_images(running_machine &machine, int ref, int params, const
static void execute_mount(running_machine &machine, int ref, int params, const char **param)
{
image_interface_iterator iter(machine.root_device());
bool done = false;
for (device_image_interface *img = iter.first(); img != nullptr; img = iter.next())
for (device_image_interface &img : image_interface_iterator(machine.root_device()))
{
if (strcmp(img->brief_instance_name(),param[0])==0) {
if (img->load(param[1])==IMAGE_INIT_FAIL) {
if (strcmp(img.brief_instance_name(),param[0]) == 0)
{
if (img.load(param[1])==IMAGE_INIT_FAIL)
debug_console_printf(machine, "Unable to mount file %s on %s\n",param[1],param[0]);
} else {
else
debug_console_printf(machine, "File %s mounted on %s\n",param[1],param[0]);
}
done = true;
break;
}
@ -3075,12 +3046,12 @@ static void execute_mount(running_machine &machine, int ref, int params, const c
static void execute_unmount(running_machine &machine, int ref, int params, const char **param)
{
image_interface_iterator iter(machine.root_device());
bool done = false;
for (device_image_interface *img = iter.first(); img != nullptr; img = iter.next())
for (device_image_interface &img : image_interface_iterator(machine.root_device()))
{
if (strcmp(img->brief_instance_name(),param[0])==0) {
img->unload();
if (strcmp(img.brief_instance_name(),param[0]) == 0)
{
img.unload();
debug_console_printf(machine, "Unmounted file from : %s\n",param[0]);
done = true;
break;

View File

@ -172,10 +172,9 @@ void debug_cpu_flush_traces(running_machine &machine)
{
/* this can be called on exit even when no debugging is enabled, so
make sure the devdebug is valid before proceeding */
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug() != nullptr)
device->debug()->trace_flush();
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug() != nullptr)
device.debug()->trace_flush();
}
@ -311,19 +310,18 @@ bool debug_comment_save(running_machine &machine)
xml_set_attribute(systemnode, "name", machine.system().name);
// for each device
device_iterator iter(machine.root_device());
bool found_comments = false;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (device->debug() && device->debug()->comment_count() > 0)
for (device_t &device : device_iterator(machine.root_device()))
if (device.debug() && device.debug()->comment_count() > 0)
{
// create a node for this device
xml_data_node *curnode = xml_add_child(systemnode, "cpu", nullptr);
if (curnode == nullptr)
throw emu_exception();
xml_set_attribute(curnode, "tag", device->tag());
xml_set_attribute(curnode, "tag", device.tag());
// export the comments
if (!device->debug()->comment_export(*curnode))
if (!device.debug()->comment_export(*curnode))
throw emu_exception();
found_comments = true;
}
@ -1049,9 +1047,8 @@ static void on_vblank(running_machine &machine, screen_device &device, bool vbla
static void reset_transient_flags(running_machine &machine)
{
/* loop over CPUs and reset the transient flags */
device_iterator iter(machine.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->debug()->reset_transient_flag();
for (device_t &device : device_iterator(machine.root_device()))
device.debug()->reset_transient_flag();
machine.debugcpu_data->m_stop_when_not_device = nullptr;
}

View File

@ -132,12 +132,11 @@ void debug_view_breakpoints::enumerate_sources()
m_source_list.reset();
// iterate over devices with disassembly interfaces
disasm_interface_iterator iter(machine().root_device());
for (device_disasm_interface *dasm = iter.first(); dasm != nullptr; dasm = iter.next())
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
{
std::string name;
name = string_format("%s '%s'", dasm->device().name(), dasm->device().tag());
m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm->device())));
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm.device())));
}
// reset the source to a known good entry

View File

@ -98,13 +98,12 @@ void debug_view_disasm::enumerate_sources()
m_source_list.reset();
// iterate over devices with disassembly interfaces
disasm_interface_iterator iter(machine().root_device());
std::string name;
for (device_disasm_interface *dasm = iter.first(); dasm != nullptr; dasm = iter.next())
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
{
name = string_format("%s '%s'", dasm->device().name(), dasm->device().tag());
if (dasm->device().memory().space_config(AS_PROGRAM)!=nullptr)
m_source_list.append(*global_alloc(debug_view_disasm_source(name.c_str(), dasm->device())));
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
if (dasm.device().memory().space_config(AS_PROGRAM)!=nullptr)
m_source_list.append(*global_alloc(debug_view_disasm_source(name.c_str(), dasm.device())));
}
// reset the source to a known good entry

View File

@ -135,14 +135,13 @@ void debug_view_memory::enumerate_sources()
std::string name;
// first add all the devices' address spaces
memory_interface_iterator iter(machine().root_device());
for (device_memory_interface *memintf = iter.first(); memintf != nullptr; memintf = iter.next())
if (&memintf->device() != &machine().root_device())
for (device_memory_interface &memintf : memory_interface_iterator(machine().root_device()))
if (&memintf.device() != &machine().root_device())
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; ++spacenum)
if (memintf->has_space(spacenum))
if (memintf.has_space(spacenum))
{
address_space &space = memintf->space(spacenum);
name = string_format("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name());
address_space &space = memintf.space(spacenum);
name = string_format("%s '%s' %s space memory", memintf.device().name(), memintf.device().tag(), space.name());
m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), space)));
}

View File

@ -74,12 +74,11 @@ void debug_view_state::enumerate_sources()
m_source_list.reset();
// iterate over devices that have state interfaces
state_interface_iterator iter(machine().root_device());
std::string name;
for (device_state_interface *state = iter.first(); state != nullptr; state = iter.next())
for (device_state_interface &state : state_interface_iterator(machine().root_device()))
{
name = string_format("%s '%s'", state->device().name(), state->device().tag());
m_source_list.append(*global_alloc(debug_view_state_source(name.c_str(), state->device())));
name = string_format("%s '%s'", state.device().name(), state.device().tag());
m_source_list.append(*global_alloc(debug_view_state_source(name.c_str(), state.device())));
}
// reset the source to a known good entry

View File

@ -153,12 +153,11 @@ void debug_view_watchpoints::enumerate_sources()
m_source_list.reset();
// iterate over devices with disassembly interfaces
disasm_interface_iterator iter(machine().root_device());
for (device_disasm_interface *dasm = iter.first(); dasm != nullptr; dasm = iter.next())
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
{
std::string name;
name = string_format("%s '%s'", dasm->device().name(), dasm->device().tag());
m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm->device())));
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm.device())));
}
// reset the source to a known good entry

View File

@ -86,16 +86,19 @@ bool finder_base::validate_memregion(size_t bytes, bool required) const
std::string region_fulltag = m_base.subtag(m_tag);
// look for the region
device_iterator deviter(m_base.mconfig().root_device());
for (device_t *dev = deviter.first(); dev != nullptr && bytes_found == 0; dev = deviter.next())
for (const rom_entry *romp = rom_first_region(*dev); romp != nullptr; romp = rom_next_region(romp))
for (device_t &dev : device_iterator(m_base.mconfig().root_device()))
{
for (const rom_entry *romp = rom_first_region(dev); romp != nullptr; romp = rom_next_region(romp))
{
if (rom_region_name(*dev, romp) == region_fulltag)
if (rom_region_name(dev, romp) == region_fulltag)
{
bytes_found = ROMREGION_GETLENGTH(romp);
break;
}
}
if (bytes_found != 0)
break;
}
if (bytes_found != 0)
{

View File

@ -117,6 +117,8 @@ public:
// getters
device_t *first() const { return m_list.first(); }
int count() const { return m_list.count(); }
bool empty() const { return m_list.empty(); }
// range iterators
using auto_iterator = simple_list<device_t>::auto_iterator;
@ -418,92 +420,116 @@ protected:
class device_iterator
{
public:
class auto_iterator
{
public:
// construction
auto_iterator(device_t *devptr, int curdepth, int maxdepth)
: m_curdevice(devptr),
m_curdepth(curdepth),
m_maxdepth(maxdepth) { }
// getters
device_t *current() const { return m_curdevice; }
int depth() const { return m_curdepth; }
// required operator overrides
bool operator!=(const auto_iterator &iter) const { return m_curdevice != iter.m_curdevice; }
device_t &operator*() const { assert(m_curdevice != nullptr); return *m_curdevice; }
const auto_iterator &operator++() { advance(); return *this; }
protected:
// search depth-first for the next device
void advance()
{
// remember our starting position, and end immediately if we're NULL
device_t *start = m_curdevice;
if (start == nullptr)
return;
// search down first
if (m_curdepth < m_maxdepth)
{
m_curdevice = start->subdevices().first();
if (m_curdevice != nullptr)
{
m_curdepth++;
return;
}
}
// search next for neighbors up the ownership chain
while (m_curdepth > 0 && start != nullptr)
{
// found a neighbor? great!
m_curdevice = start->next();
if (m_curdevice != nullptr)
return;
// no? try our parent
start = start->owner();
m_curdepth--;
}
// returned to the top; we're done
m_curdevice = nullptr;
}
// protected state
device_t * m_curdevice;
int m_curdepth;
const int m_maxdepth;
};
// construction
device_iterator(device_t &root, int maxdepth = 255)
: m_root(&root),
m_current(nullptr),
m_curdepth(0),
m_maxdepth(maxdepth) { }
: m_root(root), m_maxdepth(maxdepth) { }
// getters
device_t *current() const { return m_current; }
// standard iterators
auto_iterator begin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
auto_iterator end() const { return auto_iterator(nullptr, 0, m_maxdepth); }
// reset and return first item
device_t *first()
{
m_current = m_root;
return m_current;
}
// advance depth-first
device_t *next()
{
// remember our starting position, and end immediately if we're NULL
device_t *start = m_current;
if (start == nullptr)
return nullptr;
// search down first
if (m_curdepth < m_maxdepth)
{
m_current = start->subdevices().first();
if (m_current != nullptr)
{
m_curdepth++;
return m_current;
}
}
// search next for neighbors up the ownership chain
while (m_curdepth > 0 && start != nullptr)
{
// found a neighbor? great!
m_current = start->next();
if (m_current != nullptr)
return m_current;
// no? try our parent
start = start->owner();
m_curdepth--;
}
// returned to the top; we're done
return m_current = nullptr;
}
// return first item
device_t *first() const { return begin().current(); }
// return the number of items available
int count()
int count() const
{
int result = 0;
for (device_t *item = first(); item != nullptr; item = next())
for (device_t &item : *this)
{
(void)&item;
result++;
}
return result;
}
// return the index of a given item in the virtual list
int indexof(device_t &device)
int indexof(device_t &device) const
{
int index = 0;
for (device_t *item = first(); item != nullptr; item = next(), index++)
if (item == &device)
for (device_t &item : *this)
{
if (&item == &device)
return index;
else
index++;
}
return -1;
}
// return the indexed item in the list
device_t *byindex(int index)
device_t *byindex(int index) const
{
for (device_t *item = first(); item != nullptr; item = next(), index--)
if (index == 0)
return item;
for (device_t &item : *this)
if (index-- == 0)
return &item;
return nullptr;
}
private:
// internal state
device_t * m_root;
device_t * m_current;
int m_curdepth;
device_t & m_root;
int m_maxdepth;
};
@ -514,132 +540,181 @@ private:
template<device_type _DeviceType, class _DeviceClass = device_t>
class device_type_iterator
{
public:
class auto_iterator : public device_iterator::auto_iterator
{
public:
// construction
auto_iterator(device_t *devptr, int curdepth, int maxdepth)
: device_iterator::auto_iterator(devptr, curdepth, maxdepth)
{
// make sure the first device is of the specified type
while (m_curdevice != nullptr && m_curdevice->type() != _DeviceType)
advance();
}
// getters returning specified device type
_DeviceClass *current() const { return downcast<_DeviceClass *>(m_curdevice); }
_DeviceClass &operator*() const { assert(m_curdevice != nullptr); return downcast<_DeviceClass &>(*m_curdevice); }
// search for devices of the specified type
const auto_iterator &operator++()
{
advance();
while (m_curdevice != nullptr && m_curdevice->type() != _DeviceType)
advance();
return *this;
}
};
public:
// construction
device_type_iterator(device_t &root, int maxdepth = 255)
: m_iterator(root, maxdepth) { }
: m_root(root), m_maxdepth(maxdepth) { }
// getters
_DeviceClass *current() const { return downcast<_DeviceClass *>(m_iterator.current()); }
// standard iterators
auto_iterator begin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
auto_iterator end() const { return auto_iterator(nullptr, 0, m_maxdepth); }
// reset and return first item
_DeviceClass *first()
{
for (device_t *device = m_iterator.first(); device != nullptr; device = m_iterator.next())
if (device->type() == _DeviceType)
return downcast<_DeviceClass *>(device);
return nullptr;
}
// advance depth-first
_DeviceClass *next()
{
for (device_t *device = m_iterator.next(); device != nullptr; device = m_iterator.next())
if (device->type() == _DeviceType)
return downcast<_DeviceClass *>(device);
return nullptr;
}
// return first item
_DeviceClass *first() const { return begin().current(); }
// return the number of items available
int count()
int count() const
{
int result = 0;
for (_DeviceClass *item = first(); item != nullptr; item = next())
for (_DeviceClass &item : *this)
{
(void)&item;
result++;
}
return result;
}
// return the index of a given item in the virtual list
int indexof(_DeviceClass &device)
int indexof(_DeviceClass &device) const
{
int index = 0;
for (_DeviceClass *item = first(); item != nullptr; item = next(), index++)
if (item == &device)
for (_DeviceClass &item : *this)
{
if (&item == &device)
return index;
else
index++;
}
return -1;
}
// return the indexed item in the list
_DeviceClass *byindex(int index)
_DeviceClass *byindex(int index) const
{
for (_DeviceClass *item = first(); item != nullptr; item = next(), index--)
if (index == 0)
return item;
for (_DeviceClass &item : *this)
if (index-- == 0)
return &item;
return nullptr;
}
private:
// internal state
device_iterator m_iterator;
device_t & m_root;
int m_maxdepth;
};
// ======================> device_interface_iterator
// helper class to find devices with a given interface in the device hierarchy
// also works for findnig devices derived from a given subclass
// also works for finding devices derived from a given subclass
template<class _InterfaceClass>
class device_interface_iterator
{
public:
class auto_iterator : public device_iterator::auto_iterator
{
public:
// construction
auto_iterator(device_t *devptr, int curdepth, int maxdepth)
: device_iterator::auto_iterator(devptr, curdepth, maxdepth)
{
// set the iterator for the first device with the interface
find_interface();
}
// getters returning specified interface type
_InterfaceClass *current() const { return m_interface; }
_InterfaceClass &operator*() const { assert(m_interface != nullptr); return *m_interface; }
// search for devices with the specified interface
const auto_iterator &operator++() { advance(); find_interface(); return *this; }
private:
// private helper
void find_interface()
{
// advance until finding a device with the interface
for ( ; m_curdevice != nullptr; advance())
if (m_curdevice->interface(m_interface))
return;
// if we run out of devices, make sure the interface pointer is null
m_interface = nullptr;
}
// private state
_InterfaceClass *m_interface;
};
public:
// construction
device_interface_iterator(device_t &root, int maxdepth = 255)
: m_iterator(root, maxdepth),
m_current(nullptr) { }
: m_root(root), m_maxdepth(maxdepth) { }
// getters
_InterfaceClass *current() const { return m_current; }
// standard iterators
auto_iterator begin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
auto_iterator end() const { return auto_iterator(nullptr, 0, m_maxdepth); }
// reset and return first item
_InterfaceClass *first()
{
for (device_t *device = m_iterator.first(); device != nullptr; device = m_iterator.next())
if (device->interface(m_current))
return m_current;
return nullptr;
}
// advance depth-first
_InterfaceClass *next()
{
for (device_t *device = m_iterator.next(); device != nullptr; device = m_iterator.next())
if (device->interface(m_current))
return m_current;
return nullptr;
}
// return first item
_InterfaceClass *first() const { return begin().current(); }
// return the number of items available
int count()
int count() const
{
int result = 0;
for (_InterfaceClass *item = first(); item != nullptr; item = next())
for (_InterfaceClass &item : *this)
{
(void)&item;
result++;
}
return result;
}
// return the index of a given item in the virtual list
int indexof(_InterfaceClass &intrf)
int indexof(_InterfaceClass &intrf) const
{
int index = 0;
for (_InterfaceClass *item = first(); item != nullptr; item = next(), index++)
if (item == &intrf)
for (_InterfaceClass &item : *this)
{
if (&item == &intrf)
return index;
else
index++;
}
return -1;
}
// return the indexed item in the list
_InterfaceClass *byindex(int index)
_InterfaceClass *byindex(int index) const
{
for (_InterfaceClass *item = first(); item != nullptr; item = next(), index--)
if (index == 0)
return item;
for (_InterfaceClass &item : *this)
if (index-- == 0)
return &item;
return nullptr;
}
private:
// internal state
device_iterator m_iterator;
_InterfaceClass * m_current;
device_t & m_root;
int m_maxdepth;
};

View File

@ -476,8 +476,7 @@ void device_execute_interface::interface_pre_start()
m_driver_irq.bind_relative_to(*device().owner());
// fill in the initial states
device_iterator iter(device().machine().root_device());
int index = iter.indexof(*this);
int index = device_iterator(device().machine().root_device()).indexof(*this);
m_suspend = SUSPEND_REASON_RESET;
m_profiler = profile_type(index + PROFILER_DEVICE_FIRST);
m_inttrigger = index + TRIGGER_INT;

View File

@ -1151,14 +1151,13 @@ void device_image_interface::unload()
void device_image_interface::update_names(const device_type device_type, const char *inst, const char *brief)
{
image_interface_iterator iter(device().mconfig().root_device());
int count = 0;
int index = -1;
for (const device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (const device_image_interface &image : image_interface_iterator(device().mconfig().root_device()))
{
if (this == image)
if (this == &image)
index = count;
if ((image->image_type() == image_type() && device_type==nullptr) || (device_type==image->device().type()))
if ((image.image_type() == image_type() && device_type == nullptr) || (device_type == image.device().type()))
count++;
}
const char *inst_name = (device_type!=nullptr) ? inst : device_typename(image_type());
@ -1234,12 +1233,11 @@ software_part *device_image_interface::find_software_item(const char *path, bool
interface = image_interface();
// find the software list if explicitly specified
software_list_device_iterator deviter(device().mconfig().root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != nullptr; swlistdev = deviter.next())
for (software_list_device &swlistdev : software_list_device_iterator(device().mconfig().root_device()))
{
if (swlist_name.compare(swlistdev->list_name())==0 || !(swlist_name.length() > 0))
if (swlist_name.compare(swlistdev.list_name())==0 || !(swlist_name.length() > 0))
{
software_info *info = swlistdev->find(swinfo_name.c_str());
software_info *info = swlistdev.find(swinfo_name.c_str());
if (info != nullptr)
{
software_part *part = info->find_part(swpart_name.c_str(), interface);
@ -1248,13 +1246,13 @@ software_part *device_image_interface::find_software_item(const char *path, bool
}
}
if (swinfo_name == swlistdev->list_name())
if (swinfo_name == swlistdev.list_name())
{
// ad hoc handling for the case path = swlist_name:swinfo_name (e.g.
// gameboy:sml) which is not handled properly by software_name_split
// since the function cannot distinguish between this and the case
// path = swinfo_name:swpart_name
software_info *info = swlistdev->find(swpart_name.c_str());
software_info *info = swlistdev.find(swpart_name.c_str());
if (info != nullptr)
{
software_part *part = info->find_part(nullptr, interface);
@ -1309,20 +1307,19 @@ bool device_image_interface::load_software_part(const char *path, software_part
software_part *req_swpart = find_software_item(requirement, false);
if (req_swpart != nullptr)
{
image_interface_iterator imgiter(device().machine().root_device());
for (device_image_interface *req_image = imgiter.first(); req_image != nullptr; req_image = imgiter.next())
for (device_image_interface &req_image : image_interface_iterator(device().machine().root_device()))
{
const char *interface = req_image->image_interface();
const char *interface = req_image.image_interface();
if (interface != nullptr)
{
if (req_swpart->matches_interface(interface))
{
const char *option = device().mconfig().options().value(req_image->brief_instance_name());
const char *option = device().mconfig().options().value(req_image.brief_instance_name());
// mount only if not already mounted
if (*option == '\0' && !req_image->filename())
if (*option == '\0' && !req_image.filename())
{
req_image->set_init_phase();
req_image->load(requirement);
req_image.set_init_phase();
req_image.load(requirement);
}
break;
}

View File

@ -259,31 +259,31 @@ void device_sound_interface::interface_pre_start()
{
// scan all the sound devices
sound_interface_iterator iter(m_device.machine().root_device());
for (device_sound_interface *sound = iter.first(); sound != nullptr; sound = iter.next())
for (device_sound_interface &sound : iter)
{
// scan each route on the device
for (const sound_route &route : sound->routes())
for (const sound_route &route : sound.routes())
{
// see if we are the target of this route; if we are, make sure the source device is started
device_t *target_device = sound->device().siblingdevice(route.m_target.c_str());
if (target_device == &m_device && !sound->device().started())
device_t *target_device = sound.device().siblingdevice(route.m_target.c_str());
if (target_device == &m_device && !sound.device().started())
throw device_missing_dependencies();
}
}
// now iterate through devices again and assign any auto-allocated inputs
m_auto_allocated_inputs = 0;
for (device_sound_interface *sound = iter.first(); sound != nullptr; sound = iter.next())
for (device_sound_interface &sound : iter)
{
// scan each route on the device
for (sound_route &route : sound->routes())
for (sound_route &route : sound.routes())
{
// see if we are the target of this route
device_t *target_device = sound->device().siblingdevice(route.m_target.c_str());
device_t *target_device = sound.device().siblingdevice(route.m_target.c_str());
if (target_device == &m_device && route.m_input == AUTO_ALLOC_INPUT)
{
route.m_input = m_auto_allocated_inputs;
m_auto_allocated_inputs += (route.m_output == ALL_OUTPUTS) ? sound->outputs() : 1;
m_auto_allocated_inputs += (route.m_output == ALL_OUTPUTS) ? sound.outputs() : 1;
}
}
}
@ -298,25 +298,24 @@ void device_sound_interface::interface_pre_start()
void device_sound_interface::interface_post_start()
{
// iterate over all the sound devices
sound_interface_iterator iter(m_device.machine().root_device());
for (device_sound_interface *sound = iter.first(); sound != nullptr; sound = iter.next())
for (device_sound_interface &sound : sound_interface_iterator(m_device.machine().root_device()))
{
// scan each route on the device
for (const sound_route &route : sound->routes())
for (const sound_route &route : sound.routes())
{
// if we are the target of this route, hook it up
device_t *target_device = sound->device().siblingdevice(route.m_target.c_str());
device_t *target_device = sound.device().siblingdevice(route.m_target.c_str());
if (target_device == &m_device)
{
// iterate over all outputs, matching any that apply
int inputnum = route.m_input;
int numoutputs = sound->outputs();
int numoutputs = sound.outputs();
for (int outputnum = 0; outputnum < numoutputs; outputnum++)
if (route.m_output == outputnum || route.m_output == ALL_OUTPUTS)
{
// find the output stream to connect from
int streamoutputnum;
sound_stream *outputstream = sound->output_to_stream_output(outputnum, streamoutputnum);
sound_stream *outputstream = sound.output_to_stream_output(outputnum, streamoutputnum);
if (outputstream == nullptr)
fatalerror("Sound device '%s' specifies route for non-existant output #%d\n", route.m_target.c_str(), outputnum);
@ -416,15 +415,14 @@ void device_mixer_interface::interface_pre_start()
m_outputmap.resize(m_auto_allocated_inputs);
// iterate through all routes that point to us and note their mixer output
sound_interface_iterator iter(m_device.machine().root_device());
for (device_sound_interface *sound = iter.first(); sound != nullptr; sound = iter.next())
for (const sound_route &route : sound->routes())
for (device_sound_interface &sound : sound_interface_iterator(m_device.machine().root_device()))
for (const sound_route &route : sound.routes())
{
// see if we are the target of this route
device_t *target_device = sound->device().siblingdevice(route.m_target.c_str());
device_t *target_device = sound.device().siblingdevice(route.m_target.c_str());
if (target_device == &device() && route.m_input < m_auto_allocated_inputs)
{
int count = (route.m_output == ALL_OUTPUTS) ? sound->outputs() : 1;
int count = (route.m_output == ALL_OUTPUTS) ? sound.outputs() : 1;
for (int output = 0; output < count; output++)
m_outputmap[route.m_input + output] = route.m_mixoutput;
}

View File

@ -81,7 +81,7 @@ void device_video_interface::interface_validity_check(validity_checker &valid) c
{
screen_device_iterator iter(device().mconfig().root_device());
screen = iter.first();
if (iter.next() != nullptr)
if (iter.count() > 1)
osd_printf_error("No screen specified for device '%s', but multiple screens found\n", device().tag());
}
}
@ -115,7 +115,7 @@ void device_video_interface::interface_pre_start()
{
screen_device_iterator iter(device().machine().root_device());
m_screen = iter.first();
if (iter.next() != nullptr)
if (iter.count() > 1)
throw emu_fatalerror("No screen specified for device '%s', but multiple screens found", device().tag());
}
}

View File

@ -404,7 +404,6 @@ void driver_enumerator::release_current() const
return;
// iterate over software lists in this entry and reset
software_list_device_iterator deviter(m_config[m_current]->root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != nullptr; swlistdev = deviter.next())
swlistdev->release();
for (software_list_device &swlistdev : software_list_device_iterator(m_config[m_current]->root_device()))
swlistdev.release();
}

View File

@ -201,9 +201,8 @@ ioport_constructor driver_device::device_input_ports() const
void driver_device::device_start()
{
// reschedule ourselves to be last
device_iterator iter(*this);
for (device_t *test = iter.first(); test != nullptr; test = iter.next())
if (test != this && !test->started())
for (device_t &test : device_iterator(*this))
if (&test != this && !test.started())
throw device_missing_dependencies();
// call the game-specific init

View File

@ -1549,13 +1549,13 @@ void memory_manager::initialize()
{
// loop over devices and spaces within each device
memory_interface_iterator iter(machine().root_device());
for (device_memory_interface *memory = iter.first(); memory != nullptr; memory = iter.next())
for (device_memory_interface &memory : iter)
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; ++spacenum)
{
// if there is a configuration for this space, we need an address space
const address_space_config *spaceconfig = memory->space_config(spacenum);
const address_space_config *spaceconfig = memory.space_config(spacenum);
if (spaceconfig != nullptr)
m_spacelist.append(address_space::allocate(*this, *spaceconfig, *memory, spacenum));
m_spacelist.append(address_space::allocate(*this, *spaceconfig, memory, spacenum));
}
// construct and preprocess the address_map for each space

View File

@ -249,15 +249,14 @@ bool emu_options::add_slot_options(const software_part *swpart)
// iterate through all slot devices
int starting_count = options_count();
slot_interface_iterator iter(config.root_device());
for (const device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
for (const device_slot_interface &slot : slot_interface_iterator(config.root_device()))
{
// skip fixed slots
if (slot->fixed())
if (slot.fixed())
continue;
// retrieve info about the device instance
const char *name = slot->device().tag() + 1;
const char *name = slot.device().tag() + 1;
if (!exists(name))
{
// first device? add the header as to be pretty
@ -265,7 +264,7 @@ bool emu_options::add_slot_options(const software_part *swpart)
add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE);
// add the option
add_entry(name, nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, slot->default_option(), true);
add_entry(name, nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, slot.default_option(), true);
}
// allow software lists to supply their own defaults
@ -273,7 +272,7 @@ bool emu_options::add_slot_options(const software_part *swpart)
{
std::string featurename = std::string(name).append("_default");
const char *value = swpart->feature(featurename.c_str());
if (value != nullptr && (*value == '\0' || slot->option(value) != nullptr))
if (value != nullptr && (*value == '\0' || slot.option(value) != nullptr))
{
// set priority above INIs but below actual command line
std::string error;
@ -299,14 +298,13 @@ void emu_options::update_slot_options(const software_part *swpart)
machine_config config(*cursystem, *this);
// iterate through all slot devices
slot_interface_iterator iter(config.root_device());
for (device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
for (device_slot_interface &slot : slot_interface_iterator(config.root_device()))
{
// retrieve info about the device instance
const char *name = slot->device().tag() + 1;
if (exists(name) && !slot->option_list().empty())
const char *name = slot.device().tag() + 1;
if (exists(name) && !slot.option_list().empty())
{
std::string defvalue = slot->get_default_card_software();
std::string defvalue = slot.get_default_card_software();
if (defvalue.empty())
{
// keep any non-default setting
@ -314,13 +312,13 @@ void emu_options::update_slot_options(const software_part *swpart)
continue;
// reinstate the actual default value as configured
if (slot->default_option() != nullptr)
defvalue.assign(slot->default_option());
if (slot.default_option() != nullptr)
defvalue.assign(slot.default_option());
}
// set the value and hide the option if not selectable
set_default_value(name, defvalue.c_str());
const device_slot_option *option = slot->option(defvalue.c_str());
const device_slot_option *option = slot.option(defvalue.c_str());
set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0);
}
}
@ -343,20 +341,19 @@ void emu_options::add_device_options()
machine_config config(*cursystem, *this);
// iterate through all image devices
image_interface_iterator iter(config.root_device());
for (const device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (const device_image_interface &image : image_interface_iterator(config.root_device()))
{
if (!image->user_loadable())
continue;
if (!image.user_loadable())
continue;
// retrieve info about the device instance
std::ostringstream option_name;
util::stream_format(option_name, "%s;%s", image->instance_name(), image->brief_instance_name());
if (strcmp(image->device_typename(image->image_type()), image->instance_name()) == 0)
util::stream_format(option_name, ";%s1;%s1", image->instance_name(), image->brief_instance_name());
util::stream_format(option_name, "%s;%s", image.instance_name(), image.brief_instance_name());
if (strcmp(image.device_typename(image.image_type()), image.instance_name()) == 0)
util::stream_format(option_name, ";%s1;%s1", image.instance_name(), image.brief_instance_name());
// add the option
if (!exists(image->instance_name()))
if (!exists(image.instance_name()))
{
// first device? add the header as to be pretty
if (m_device_options++ == 0)
@ -486,23 +483,22 @@ void emu_options::parse_standard_inis(std::string &error_string, const game_driv
parse_one_ini("othersys", OPTION_PRIORITY_SYSTYPE_INI, &error_string);
machine_config config(*cursystem, *this);
screen_device_iterator iter(config.root_device());
for (const screen_device *device = iter.first(); device != nullptr; device = iter.next())
for (const screen_device &device : screen_device_iterator(config.root_device()))
{
// parse "raster.ini" for raster games
if (device->screen_type() == SCREEN_TYPE_RASTER)
if (device.screen_type() == SCREEN_TYPE_RASTER)
{
parse_one_ini("raster", OPTION_PRIORITY_SCREEN_INI, &error_string);
break;
}
// parse "vector.ini" for vector games
if (device->screen_type() == SCREEN_TYPE_VECTOR)
if (device.screen_type() == SCREEN_TYPE_VECTOR)
{
parse_one_ini("vector", OPTION_PRIORITY_SCREEN_INI, &error_string);
break;
}
// parse "lcd.ini" for lcd games
if (device->screen_type() == SCREEN_TYPE_LCD)
if (device.screen_type() == SCREEN_TYPE_LCD)
{
parse_one_ini("lcd", OPTION_PRIORITY_SCREEN_INI, &error_string);
break;
@ -580,7 +576,7 @@ void emu_options::set_system_name(const char *name)
if (*software_name() != 0)
{
std::string sw_load(software_name());
std::string sw_list, sw_name, sw_part, sw_instance, option_errors, error_string;
std::string sw_list, sw_name, sw_part, sw_instance, error_string;
int left = sw_load.find_first_of(':');
int middle = sw_load.find_first_of(':', left + 1);
int right = sw_load.find_last_of(':');

View File

@ -27,38 +27,34 @@
image_manager::image_manager(running_machine &machine)
: m_machine(machine)
{
const char *image_name;
/* make sure that any required devices have been allocated */
image_interface_iterator iter(machine.root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine.root_device()))
{
/* is an image specified for this image */
image_name = machine.options().value(image->instance_name());
if (!image->user_loadable())
continue;
const char *image_name = machine.options().value(image.instance_name());
if (!image.user_loadable())
continue;
if ((image_name != nullptr) && (image_name[0] != '\0'))
{
/* mark init state */
image->set_init_phase();
image.set_init_phase();
/* try to load this image */
bool result = image->load(image_name);
bool result = image.load(image_name);
/* did the image load fail? */
if (result)
{
/* retrieve image error message */
std::string image_err = std::string(image->error());
std::string image_err = std::string(image.error());
std::string image_basename(image_name);
/* unload all images */
unload_all();
fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s",
image->device().name(),
image.device().name(),
image_basename.c_str(),
image_err.c_str());
}
@ -77,11 +73,10 @@ void image_manager::unload_all()
// extract the options
options_extract();
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
// unload this image
image->unload();
image.unload();
}
}
@ -99,13 +94,12 @@ void image_manager::config_load(config_type cfg_type, xml_data_node *parentnode)
if ((dev_instance != nullptr) && (dev_instance[0] != '\0'))
{
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
if (!strcmp(dev_instance, image->instance_name())) {
if (!strcmp(dev_instance, image.instance_name())) {
working_directory = xml_get_attribute_string(node, "directory", nullptr);
if (working_directory != nullptr)
image->set_working_directory(working_directory);
image.set_working_directory(working_directory);
}
}
}
@ -126,16 +120,15 @@ void image_manager::config_save(config_type cfg_type, xml_data_node *parentnode)
/* only care about game-specific data */
if (cfg_type == config_type::CONFIG_TYPE_GAME)
{
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
dev_instance = image->instance_name();
dev_instance = image.instance_name();
node = xml_add_child(parentnode, "device", nullptr);
if (node != nullptr)
{
xml_set_attribute(node, "instance", dev_instance);
xml_set_attribute(node, "directory", image->working_directory());
xml_set_attribute(node, "directory", image.working_directory());
}
}
}
@ -180,14 +173,13 @@ void image_manager::options_extract()
{
int index = 0;
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
const char *filename = image->filename();
const char *filename = image.filename();
/* and set the option */
std::string error;
machine().options().set_value(image->instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error);
machine().options().set_value(image.instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error);
index++;
}
@ -208,11 +200,10 @@ std::string &image_manager::mandatory_scan(std::string &mandatory)
{
mandatory.clear();
// make sure that any required image has a mounted file
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
if (image->filename() == nullptr && image->must_be_loaded())
mandatory.append("\"").append(image->instance_name()).append("\", ");
if (image.filename() == nullptr && image.must_be_loaded())
mandatory.append("\"").append(image.instance_name()).append("\", ");
}
return mandatory;
}
@ -225,24 +216,23 @@ std::string &image_manager::mandatory_scan(std::string &mandatory)
void image_manager::postdevice_init()
{
/* make sure that any required devices have been allocated */
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
int result = image->finish_load();
int result = image.finish_load();
/* did the image load fail? */
if (result)
{
/* retrieve image error message */
std::string image_err = std::string(image->error());
/* did the image load fail? */
if (result)
{
/* retrieve image error message */
std::string image_err = std::string(image.error());
/* unload all images */
unload_all();
/* unload all images */
unload_all();
fatalerror_exitcode(machine(), MAMERR_DEVICE, "Device %s load failed: %s",
image->device().name(),
image_err.c_str());
}
fatalerror_exitcode(machine(), MAMERR_DEVICE, "Device %s load failed: %s",
image.device().name(),
image_err.c_str());
}
}
/* add a callback for when we shut down */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_manager::unload_all), this));

View File

@ -248,35 +248,36 @@ void info_xml_creator::output_one()
ioport_list portlist;
std::string errors;
device_iterator iter(config.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
portlist.append(*device, errors);
// renumber player numbers for controller ports
int player_offset = 0;
// but treat keyboard count separately from players' number
int kbd_offset = 0;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
{
int nplayers = 0;
bool new_kbd = FALSE;
for (ioport_port &port : portlist)
if (&port.device() == device)
for (ioport_field &field : port.fields())
if (field.type() >= IPT_START && field.type() < IPT_ANALOG_LAST)
{
if (field.type() == IPT_KEYBOARD)
{
if (!new_kbd) new_kbd = TRUE;
field.set_player(field.player() + kbd_offset);
}
else
{
nplayers = MAX(nplayers, field.player() + 1);
field.set_player(field.player() + player_offset);
}
}
player_offset += nplayers;
if (new_kbd) kbd_offset++;
}
for (device_t &device : iter)
portlist.append(device, errors);
// renumber player numbers for controller ports
int player_offset = 0;
// but treat keyboard count separately from players' number
int kbd_offset = 0;
for (device_t &device : iter)
{
int nplayers = 0;
bool new_kbd = false;
for (ioport_port &port : portlist)
if (&port.device() == &device)
for (ioport_field &field : port.fields())
if (field.type() >= IPT_START && field.type() < IPT_ANALOG_LAST)
{
if (field.type() == IPT_KEYBOARD)
{
if (!new_kbd) new_kbd = TRUE;
field.set_player(field.player() + kbd_offset);
}
else
{
nplayers = MAX(nplayers, field.player() + 1);
field.set_player(field.player() + player_offset);
}
}
player_offset += nplayers;
if (new_kbd) kbd_offset++;
}
// print the header and the game name
fprintf(m_output, "\t<%s",XML_TOP);
@ -360,9 +361,8 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag)
// generate input list
ioport_list portlist;
std::string errors;
device_iterator iptiter(device);
for (device_t *dev = iptiter.first(); dev != nullptr; dev = iptiter.next())
portlist.append(*dev, errors);
for (device_t &dev : device_iterator(device))
portlist.append(dev, errors);
// check if the device adds player inputs (other than dsw and configs) to the system
for (ioport_port &port : portlist)
for (ioport_field &field : port.fields())
@ -424,43 +424,39 @@ void info_xml_creator::output_devices()
while (m_drivlist.next())
{
// first, run through devices with roms which belongs to the default configuration
device_iterator deviter(m_drivlist.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (device_t &device : device_iterator(m_drivlist.config().root_device()))
{
if (device->owner() != nullptr && device->shortname()!= nullptr && device->shortname()[0]!='\0')
if (device.owner() != nullptr && device.shortname() != nullptr && device.shortname()[0]!='\0')
{
if (shortnames.insert(device->shortname()).second)
output_one_device(*device, device->tag());
if (shortnames.insert(device.shortname()).second)
output_one_device(device, device.tag());
}
}
// then, run through slot devices
slot_interface_iterator iter(m_drivlist.config().root_device());
for (const device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
for (const device_slot_interface &slot : slot_interface_iterator(m_drivlist.config().root_device()))
{
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
std::string temptag("_");
temptag.append(option.name());
device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.c_str(), option.devtype(), 0);
// notify this device and all its subdevices that they are now configured
device_iterator subiter(*dev);
for (device_t *device = subiter.first(); device != nullptr; device = subiter.next())
if (!device->configured())
device->config_complete();
for (device_t &device : device_iterator(*dev))
if (!device.configured())
device.config_complete();
if (shortnames.insert(dev->shortname()).second)
output_one_device(*dev, temptag.c_str());
// also, check for subdevices with ROMs (a few devices are missed otherwise, e.g. MPU401)
device_iterator deviter2(*dev);
for (device_t *device = deviter2.first(); device != nullptr; device = deviter2.next())
for (device_t &device : device_iterator(*dev))
{
if (device->owner() == dev && device->shortname()!= nullptr && device->shortname()[0]!='\0')
if (device.owner() == dev && device.shortname() != nullptr && device.shortname()[0]!='\0')
{
if (shortnames.insert(device->shortname()).second)
output_one_device(*device, device->tag());
if (shortnames.insert(device.shortname()).second)
output_one_device(device, device.tag());
}
}
@ -478,10 +474,9 @@ void info_xml_creator::output_devices()
void info_xml_creator::output_device_roms()
{
device_iterator deviter(m_drivlist.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
if (device->owner() != nullptr && device->shortname()!= nullptr && device->shortname()[0]!='\0')
fprintf(m_output, "\t\t<device_ref name=\"%s\"/>\n", xml_normalize_string(device->shortname()));
for (device_t &device : device_iterator(m_drivlist.config().root_device()))
if (device.owner() != nullptr && device.shortname() != nullptr && device.shortname()[0] != '\0')
fprintf(m_output, "\t\t<device_ref name=\"%s\"/>\n", xml_normalize_string(device.shortname()));
}
@ -493,10 +488,9 @@ void info_xml_creator::output_device_roms()
void info_xml_creator::output_sampleof()
{
// iterate over sample devices
samples_device_iterator iter(m_drivlist.config().root_device());
for (samples_device *device = iter.first(); device != nullptr; device = iter.next())
for (samples_device &device : samples_device_iterator(m_drivlist.config().root_device()))
{
samples_iterator sampiter(*device);
samples_iterator sampiter(device);
if (sampiter.altbasename() != nullptr)
{
fprintf(m_output, " sampleof=\"%s\"", xml_normalize_string(sampiter.altbasename()));
@ -650,10 +644,9 @@ void info_xml_creator::output_rom(device_t &device)
void info_xml_creator::output_sample(device_t &device)
{
// iterate over sample devices
samples_device_iterator sampiter(device);
for (samples_device *samples = sampiter.first(); samples != nullptr; samples = sampiter.next())
for (samples_device &samples : samples_device_iterator(device))
{
samples_iterator iter(*samples);
samples_iterator iter(samples);
std::unordered_set<std::string> already_printed;
for (const char *samplename = iter.first(); samplename != nullptr; samplename = iter.next())
{
@ -676,38 +669,36 @@ void info_xml_creator::output_sample(device_t &device)
void info_xml_creator::output_chips(device_t &device, const char *root_tag)
{
// iterate over executable devices
execute_interface_iterator execiter(device);
for (device_execute_interface *exec = execiter.first(); exec != nullptr; exec = execiter.next())
for (device_execute_interface &exec : execute_interface_iterator(device))
{
if (strcmp(exec->device().tag(), device.tag()))
if (strcmp(exec.device().tag(), device.tag()))
{
std::string newtag(exec->device().tag()), oldtag(":");
std::string newtag(exec.device().tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
fprintf(m_output, "\t\t<chip");
fprintf(m_output, " type=\"cpu\"");
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
fprintf(m_output, " name=\"%s\"", xml_normalize_string(exec->device().name()));
fprintf(m_output, " clock=\"%d\"", exec->device().clock());
fprintf(m_output, " name=\"%s\"", xml_normalize_string(exec.device().name()));
fprintf(m_output, " clock=\"%d\"", exec.device().clock());
fprintf(m_output, "/>\n");
}
}
// iterate over sound devices
sound_interface_iterator sounditer(device);
for (device_sound_interface *sound = sounditer.first(); sound != nullptr; sound = sounditer.next())
for (device_sound_interface &sound : sound_interface_iterator(device))
{
if (strcmp(sound->device().tag(), device.tag()))
if (strcmp(sound.device().tag(), device.tag()))
{
std::string newtag(sound->device().tag()), oldtag(":");
std::string newtag(sound.device().tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
fprintf(m_output, "\t\t<chip");
fprintf(m_output, " type=\"audio\"");
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
fprintf(m_output, " name=\"%s\"", xml_normalize_string(sound->device().name()));
if (sound->device().clock() != 0)
fprintf(m_output, " clock=\"%d\"", sound->device().clock());
fprintf(m_output, " name=\"%s\"", xml_normalize_string(sound.device().name()));
if (sound.device().clock() != 0)
fprintf(m_output, " clock=\"%d\"", sound.device().clock());
fprintf(m_output, "/>\n");
}
}
@ -722,18 +713,17 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag)
void info_xml_creator::output_display(device_t &device, const char *root_tag)
{
// iterate over screens
screen_device_iterator iter(device);
for (const screen_device *screendev = iter.first(); screendev != nullptr; screendev = iter.next())
for (const screen_device &screendev : screen_device_iterator(device))
{
if (strcmp(screendev->tag(), device.tag()))
if (strcmp(screendev.tag(), device.tag()))
{
std::string newtag(screendev->tag()), oldtag(":");
std::string newtag(screendev.tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
fprintf(m_output, "\t\t<display");
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
switch (screendev->screen_type())
switch (screendev.screen_type())
{
case SCREEN_TYPE_RASTER: fprintf(m_output, " type=\"raster\""); break;
case SCREEN_TYPE_VECTOR: fprintf(m_output, " type=\"vector\""); break;
@ -771,29 +761,29 @@ void info_xml_creator::output_display(device_t &device, const char *root_tag)
}
// output width and height only for games that are not vector
if (screendev->screen_type() != SCREEN_TYPE_VECTOR)
if (screendev.screen_type() != SCREEN_TYPE_VECTOR)
{
const rectangle &visarea = screendev->visible_area();
const rectangle &visarea = screendev.visible_area();
fprintf(m_output, " width=\"%d\"", visarea.width());
fprintf(m_output, " height=\"%d\"", visarea.height());
}
// output refresh rate
fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds()));
fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev.refresh_attoseconds()));
// output raw video parameters only for games that are not vector
// and had raw parameters specified
if (screendev->screen_type() != SCREEN_TYPE_VECTOR && !screendev->oldstyle_vblank_supplied())
if (screendev.screen_type() != SCREEN_TYPE_VECTOR && !screendev.oldstyle_vblank_supplied())
{
int pixclock = screendev->width() * screendev->height() * ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds());
int pixclock = screendev.width() * screendev.height() * ATTOSECONDS_TO_HZ(screendev.refresh_attoseconds());
fprintf(m_output, " pixclock=\"%d\"", pixclock);
fprintf(m_output, " htotal=\"%d\"", screendev->width());
fprintf(m_output, " hbend=\"%d\"", screendev->visible_area().min_x);
fprintf(m_output, " hbstart=\"%d\"", screendev->visible_area().max_x+1);
fprintf(m_output, " vtotal=\"%d\"", screendev->height());
fprintf(m_output, " vbend=\"%d\"", screendev->visible_area().min_y);
fprintf(m_output, " vbstart=\"%d\"", screendev->visible_area().max_y+1);
fprintf(m_output, " htotal=\"%d\"", screendev.width());
fprintf(m_output, " hbend=\"%d\"", screendev.visible_area().min_x);
fprintf(m_output, " hbstart=\"%d\"", screendev.visible_area().max_x+1);
fprintf(m_output, " vtotal=\"%d\"", screendev.height());
fprintf(m_output, " vbend=\"%d\"", screendev.visible_area().min_y);
fprintf(m_output, " vbstart=\"%d\"", screendev.visible_area().max_y+1);
}
fprintf(m_output, " />\n");
}
@ -1430,20 +1420,19 @@ void info_xml_creator::output_driver()
void info_xml_creator::output_images(device_t &device, const char *root_tag)
{
image_interface_iterator iter(device);
for (const device_image_interface *imagedev = iter.first(); imagedev != nullptr; imagedev = iter.next())
for (const device_image_interface &imagedev : image_interface_iterator(device))
{
if (strcmp(imagedev->device().tag(), device.tag()))
if (strcmp(imagedev.device().tag(), device.tag()))
{
bool loadable = imagedev->user_loadable();
std::string newtag(imagedev->device().tag()), oldtag(":");
bool loadable = imagedev.user_loadable();
std::string newtag(imagedev.device().tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
// print m_output device type
fprintf(m_output, "\t\t<device type=\"%s\"", xml_normalize_string(imagedev->image_type_name()));
fprintf(m_output, "\t\t<device type=\"%s\"", xml_normalize_string(imagedev.image_type_name()));
// does this device have a tag?
if (imagedev->device().tag())
if (imagedev.device().tag())
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
// is this device available as media switch?
@ -1451,26 +1440,26 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
fprintf(m_output, " fixed_image=\"1\"");
// is this device mandatory?
if (imagedev->must_be_loaded())
if (imagedev.must_be_loaded())
fprintf(m_output, " mandatory=\"1\"");
if (imagedev->image_interface() && imagedev->image_interface()[0])
fprintf(m_output, " interface=\"%s\"", xml_normalize_string(imagedev->image_interface()));
if (imagedev.image_interface() && imagedev.image_interface()[0])
fprintf(m_output, " interface=\"%s\"", xml_normalize_string(imagedev.image_interface()));
// close the XML tag
fprintf(m_output, ">\n");
if (loadable)
{
const char *name = imagedev->instance_name();
const char *shortname = imagedev->brief_instance_name();
const char *name = imagedev.instance_name();
const char *shortname = imagedev.brief_instance_name();
fprintf(m_output, "\t\t\t<instance");
fprintf(m_output, " name=\"%s\"", xml_normalize_string(name));
fprintf(m_output, " briefname=\"%s\"", xml_normalize_string(shortname));
fprintf(m_output, "/>\n");
std::string extensions(imagedev->file_extensions());
std::string extensions(imagedev.file_extensions());
char *ext = strtok((char *)extensions.c_str(), ",");
while (ext != nullptr)
@ -1493,25 +1482,24 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
void info_xml_creator::output_slots(device_t &device, const char *root_tag)
{
slot_interface_iterator iter(device);
for (const device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
for (const device_slot_interface &slot : slot_interface_iterator(device))
{
if (slot->fixed()) continue; // or shall we list these as non-configurable?
if (slot.fixed()) continue; // or shall we list these as non-configurable?
if (strcmp(slot->device().tag(), device.tag()))
if (strcmp(slot.device().tag(), device.tag()))
{
std::string newtag(slot->device().tag()), oldtag(":");
std::string newtag(slot.device().tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
// print m_output device type
fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag.c_str()));
/*
if (slot->slot_interface()[0])
fprintf(m_output, " interface=\"%s\"", xml_normalize_string(slot->slot_interface()));
if (slot.slot_interface()[0])
fprintf(m_output, " interface=\"%s\"", xml_normalize_string(slot.slot_interface()));
*/
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
if (option.selectable())
{
@ -1522,7 +1510,7 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag)
fprintf(m_output, "\t\t\t<slotoption");
fprintf(m_output, " name=\"%s\"", xml_normalize_string(option.name()));
fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname()));
if (slot->default_option() != nullptr && strcmp(slot->default_option(),option.name())==0)
if (slot.default_option() != nullptr && strcmp(slot.default_option(),option.name())==0)
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), "dummy");
@ -1542,14 +1530,12 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag)
void info_xml_creator::output_software_list()
{
software_list_device_iterator iter(m_drivlist.config().root_device());
for (const software_list_device *swlist = iter.first(); swlist != nullptr; swlist = iter.next())
for (const software_list_device &swlist : software_list_device_iterator(m_drivlist.config().root_device()))
{
fprintf(m_output, "\t\t<softwarelist name=\"%s\" ", swlist->list_name());
fprintf(m_output, "status=\"%s\" ", (swlist->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) ? "original" : "compatible");
if (swlist->filter()) {
fprintf(m_output, "filter=\"%s\" ", swlist->filter());
}
fprintf(m_output, "\t\t<softwarelist name=\"%s\" ", swlist.list_name());
fprintf(m_output, "status=\"%s\" ", (swlist.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) ? "original" : "compatible");
if (swlist.filter())
fprintf(m_output, "filter=\"%s\" ", swlist.filter());
fprintf(m_output, "/>\n");
}
}
@ -1563,14 +1549,13 @@ void info_xml_creator::output_software_list()
void info_xml_creator::output_ramoptions()
{
ram_device_iterator iter(m_drivlist.config().root_device());
for (const ram_device *ram = iter.first(); ram != nullptr; ram = iter.next())
for (const ram_device &ram : ram_device_iterator(m_drivlist.config().root_device()))
{
fprintf(m_output, "\t\t<ramoption default=\"1\">%u</ramoption>\n", ram->default_size());
fprintf(m_output, "\t\t<ramoption default=\"1\">%u</ramoption>\n", ram.default_size());
if (ram->extra_options() != nullptr)
if (ram.extra_options() != nullptr)
{
std::string options(ram->extra_options());
std::string options(ram.extra_options());
for (int start = 0, end = options.find_first_of(',');; start = end + 1, end = options.find_first_of(',', start))
{
std::string option;

View File

@ -2457,22 +2457,22 @@ time_t ioport_manager::initialize()
// if we have a token list, proceed
device_iterator iter(machine().root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
for (device_t &device : iter)
{
std::string errors;
m_portlist.append(*device, errors);
m_portlist.append(device, errors);
if (!errors.empty())
osd_printf_error("Input port errors:\n%s", errors.c_str());
}
// renumber player numbers for controller ports
int player_offset = 0;
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
for (device_t &device : iter)
{
int players = 0;
for (ioport_port &port : m_portlist)
{
if (&port.device() == device)
if (&port.device() == &device)
{
for (ioport_field &field : port.fields())
if (field.type_class()==INPUT_CLASS_CONTROLLER)
@ -2532,10 +2532,9 @@ time_t ioport_manager::initialize()
if (field.is_analog())
m_has_analog = true;
}
device_iterator deviter(machine().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
if (device->rom_region())
for (const rom_entry *rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++)
for (device_t &device : device_iterator(machine().root_device()))
if (device.rom_region())
for (const rom_entry *rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++)
if (ROMENTRY_ISSYSTEM_BIOS(rom)) { m_has_bioses= true; break; }
}

View File

@ -547,10 +547,10 @@ luabridge::LuaRef lua_engine::l_machine_get_images(const running_machine *r)
lua_State *L = luaThis->m_lua_state;
luabridge::LuaRef image_table = luabridge::LuaRef::newTable(L);
image_interface_iterator iter(r->root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) {
image_table[image->brief_instance_name()] = image;
image_table[image->instance_name()] = image;
for (device_image_interface &image : image_interface_iterator(r->root_device()))
{
image_table[image.brief_instance_name()] = &image;
image_table[image.instance_name()] = &image;
}
return image_table;
@ -712,7 +712,7 @@ luabridge::LuaRef lua_engine::l_dev_get_memspaces(const device_t *d)
lua_State *L = luaThis->m_lua_state;
luabridge::LuaRef sp_table = luabridge::LuaRef::newTable(L);
if(!&dev->memory())
if(!dynamic_cast<device_memory_interface *>(dev))
return sp_table;
for (address_spacenum sp = AS_0; sp < ADDRESS_SPACES; ++sp) {
@ -735,7 +735,7 @@ luabridge::LuaRef lua_engine::l_dev_get_states(const device_t *d)
lua_State *L = luaThis->m_lua_state;
luabridge::LuaRef st_table = luabridge::LuaRef::newTable(L);
if(!&dev->state())
if(!dynamic_cast<device_state_interface *>(dev))
return st_table;
for (device_state_entry &s : dev->state().state_entries())
@ -1772,7 +1772,7 @@ Tout lua_engine::run(const char *env, int ref, Tin in)
luabridge::Stack<Tin>::push(m_lua_state, in);
run_internal(env, ref);
if(lua_isnil(m_lua_state, 1))
ret = reinterpret_cast<Tout>(0);
ret = Tout(0);
else
ret = luabridge::Stack<Tout>::get(m_lua_state, 1);
lua_pop(m_lua_state, 1);
@ -1787,7 +1787,7 @@ Tout lua_engine::run(const char *env, int ref)
lua_pushnil(m_lua_state);
run_internal(env, ref);
if(lua_isnil(m_lua_state, 1))
ret = reinterpret_cast<Tout>(0);
ret = Tout(0);
else
ret = luabridge::Stack<Tout>::get(m_lua_state, 1);
lua_pop(m_lua_state, 1);

View File

@ -138,18 +138,17 @@ running_machine::running_machine(const machine_config &_config, machine_manager
// set the machine on all devices
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->set_machine(*this);
for (device_t &device : iter)
device.set_machine(*this);
// find devices
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (dynamic_cast<cpu_device *>(device) != nullptr)
for (device_t &device : iter)
if (dynamic_cast<cpu_device *>(&device) != nullptr)
{
firstcpu = downcast<cpu_device *>(device);
firstcpu = downcast<cpu_device *>(&device);
break;
}
screen_device_iterator screeniter(root_device());
primary_screen = screeniter.first();
primary_screen = screen_device_iterator(root_device()).first();
// fetch core options
if (options().debug())
@ -554,19 +553,18 @@ std::string running_machine::get_statename(const char *option) const
//printf("check template: %s\n", devname_str.c_str());
// verify that there is such a device for this system
image_interface_iterator iter(root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(root_device()))
{
// get the device name
std::string tempdevname(image->brief_instance_name());
std::string tempdevname(image.brief_instance_name());
//printf("check device: %s\n", tempdevname.c_str());
if (devname_str.compare(tempdevname) == 0)
{
// verify that such a device has an image mounted
if (image->basename_noext() != nullptr)
if (image.basename_noext() != nullptr)
{
std::string filename(image->basename_noext());
std::string filename(image.basename_noext());
// setup snapname and remove the %d_
strreplace(statename_str, devname_str.c_str(), filename.c_str());
@ -1032,20 +1030,19 @@ void running_machine::start_all_devices()
{
// iterate over all devices
int failed_starts = 0;
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (!device->started())
for (device_t &device : device_iterator(root_device()))
if (!device.started())
{
// attempt to start the device, catching any expected exceptions
try
{
// if the device doesn't have a machine yet, set it first
if (device->m_machine == nullptr)
device->set_machine(*this);
if (device.m_machine == nullptr)
device.set_machine(*this);
// now start the device
osd_printf_verbose("Starting %s '%s'\n", device->name(), device->tag());
device->start();
osd_printf_verbose("Starting %s '%s'\n", device.name(), device.tag());
device.start();
}
// handle missing dependencies by moving the device to the end
@ -1090,9 +1087,8 @@ void running_machine::stop_all_devices()
debug_comment_save(*this);
// iterate over devices and stop them
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->stop();
for (device_t &device : device_iterator(root_device()))
device.stop();
}
@ -1103,9 +1099,8 @@ void running_machine::stop_all_devices()
void running_machine::presave_all_devices()
{
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->pre_save();
for (device_t &device : device_iterator(root_device()))
device.pre_save();
}
@ -1116,9 +1111,8 @@ void running_machine::presave_all_devices()
void running_machine::postload_all_devices()
{
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
device->post_load();
for (device_t &device : device_iterator(root_device()))
device.post_load();
}
@ -1170,17 +1164,16 @@ std::string running_machine::nvram_filename(device_t &device) const
void running_machine::nvram_load()
{
nvram_interface_iterator iter(root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != nullptr; nvram = iter.next())
for (device_nvram_interface &nvram : nvram_interface_iterator(root_device()))
{
emu_file file(options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(nvram->device()).c_str()) == osd_file::error::NONE)
if (file.open(nvram_filename(nvram.device()).c_str()) == osd_file::error::NONE)
{
nvram->nvram_load(file);
nvram.nvram_load(file);
file.close();
}
else
nvram->nvram_reset();
nvram.nvram_reset();
}
}
@ -1191,13 +1184,12 @@ void running_machine::nvram_load()
void running_machine::nvram_save()
{
nvram_interface_iterator iter(root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != nullptr; nvram = iter.next())
for (device_nvram_interface &nvram : nvram_interface_iterator(root_device()))
{
emu_file file(options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(nvram->device()).c_str()) == osd_file::error::NONE)
if (file.open(nvram_filename(nvram.device()).c_str()) == osd_file::error::NONE)
{
nvram->nvram_save(file);
nvram.nvram_save(file);
file.close();
}
}

View File

@ -34,20 +34,20 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
bool is_selected_driver = core_stricmp(gamedrv.name,options.system_name())==0;
// intialize slot devices - make sure that any required devices have been allocated
slot_interface_iterator slotiter(root_device());
for (device_slot_interface *slot = slotiter.first(); slot != nullptr; slot = slotiter.next())
for (device_slot_interface &slot : slot_interface_iterator(root_device()))
{
device_t &owner = slot->device();
device_t &owner = slot.device();
std::string selval;
bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT);
if (is_selected_driver && options.exists(owner.tag()+1))
selval = options.main_value(owner.tag()+1);
else if (slot->default_option() != nullptr)
selval.assign(slot->default_option());
else if (slot.default_option() != nullptr)
selval.assign(slot.default_option());
if (!selval.empty())
{
const device_slot_option *option = slot->option(selval.c_str());
const device_slot_option *option = slot.option(selval.c_str());
if (option && (isdefault || option->selectable()))
{
@ -74,10 +74,9 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
driver_device::static_set_game(*m_root_device, gamedrv);
// then notify all devices that their configuration is complete
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
if (!device->configured())
device->config_complete();
for (device_t &device : device_iterator(root_device()))
if (!device.configured())
device.config_complete();
}
@ -97,8 +96,7 @@ machine_config::~machine_config()
screen_device *machine_config::first_screen() const
{
screen_device_iterator iter(root_device());
return iter.first();
return screen_device_iterator(root_device()).first();
}
@ -235,9 +233,8 @@ device_t *machine_config::device_find(device_t *owner, const char *tag)
void machine_config::remove_references(ATTR_UNUSED device_t &device)
{
// iterate over all devices and remove any references
device_iterator iter(root_device());
for (device_t *scan = iter.first(); scan != nullptr; scan = iter.next())
scan->subdevices().m_tagmap.clear(); //remove(&device);
for (device_t &scan : device_iterator(root_device()))
scan.subdevices().m_tagmap.clear(); //remove(&device);
}

View File

@ -43,19 +43,18 @@ void network_manager::config_load(config_type cfg_type, xml_data_node *parentnod
if ((tag != nullptr) && (tag[0] != '\0'))
{
network_interface_iterator iter(machine().root_device());
for (device_network_interface *network = iter.first(); network != nullptr; network = iter.next())
for (device_network_interface &network : network_interface_iterator(machine().root_device()))
{
if (!strcmp(tag, network->device().tag())) {
if (!strcmp(tag, network.device().tag())) {
int interface = xml_get_attribute_int(node, "interface", 0);
network->set_interface(interface);
network.set_interface(interface);
const char *mac_addr = xml_get_attribute_string(node, "mac", nullptr);
if (mac_addr != nullptr && strlen(mac_addr) == 17) {
char mac[7];
unsigned int mac_num[6];
sscanf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_num[0], &mac_num[1], &mac_num[2], &mac_num[3], &mac_num[4], &mac_num[5]);
for (int i = 0; i<6; i++) mac[i] = mac_num[i];
network->set_mac(mac);
network.set_mac(mac);
}
}
@ -76,15 +75,14 @@ void network_manager::config_save(config_type cfg_type, xml_data_node *parentnod
/* only care about game-specific data */
if (cfg_type == config_type::CONFIG_TYPE_GAME)
{
network_interface_iterator iter(machine().root_device());
for (device_network_interface *network = iter.first(); network != nullptr; network = iter.next())
for (device_network_interface &network : network_interface_iterator(machine().root_device()))
{
node = xml_add_child(parentnode, "device", nullptr);
if (node != nullptr)
{
xml_set_attribute(node, "tag", network->device().tag());
xml_set_attribute_int(node, "interface", network->get_interface());
const char *mac = network->get_mac();
xml_set_attribute(node, "tag", network.device().tag());
xml_set_attribute_int(node, "interface", network.get_interface());
const char *mac = network.get_mac();
char mac_addr[6 * 3];
sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", (UINT8)mac[0], (UINT8)mac[1], (UINT8)mac[2], (UINT8)mac[3], (UINT8)mac[4], (UINT8)mac[5]);
xml_set_attribute(node, "mac", mac_addr);

View File

@ -1103,11 +1103,14 @@ int render_target::configured_view(const char *viewname, int targetindex, int nu
break;
if (viewscreens.count() >= scrcount)
{
screen_device *screen;
for (screen = iter.first(); screen != nullptr; screen = iter.next())
if (!viewscreens.contains(*screen))
bool has_screen = false;
for (screen_device &screen : iter)
if (!viewscreens.contains(screen))
{
has_screen = true;
break;
if (screen == nullptr)
}
if (!has_screen)
break;
}
}
@ -1695,7 +1698,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename)
fname.insert(0, PATH_SEPARATOR).insert(0, dirname);
// attempt to open the file; bail if we can't
emu_file layoutfile(manager().machine().options().art_path(), OPEN_FLAG_READ);
emu_file layoutfile(m_manager.machine().options().art_path(), OPEN_FLAG_READ);
osd_file::error filerr = layoutfile.open(fname.c_str());
if (filerr != osd_file::error::NONE)
return false;
@ -1902,9 +1905,9 @@ void render_target::add_container_primitives(render_primitive_list &list, const
// 1 1 0 solarq X Y
// 1 1 1 barrier !X !Y
bool flip_x = (manager().machine().system().flags & ORIENTATION_FLIP_X) == ORIENTATION_FLIP_X;
bool flip_y = (manager().machine().system().flags & ORIENTATION_FLIP_Y) == ORIENTATION_FLIP_Y;
bool swap_xy = (manager().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
bool flip_x = (m_manager.machine().system().flags & ORIENTATION_FLIP_X) == ORIENTATION_FLIP_X;
bool flip_y = (m_manager.machine().system().flags & ORIENTATION_FLIP_Y) == ORIENTATION_FLIP_Y;
bool swap_xy = (m_manager.machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
int vectororient = 0;
if (flip_x)
@ -2063,7 +2066,7 @@ bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_co
// convert target coordinates to float
float target_fx = (float)(target_x - root_xform.xoffs) / viswidth;
float target_fy = (float)(target_y - root_xform.yoffs) / visheight;
if (manager().machine().ui().is_menu_active())
if (m_manager.machine().ui().is_menu_active())
{
target_fx = (float)target_x / m_width;
target_fy = (float)target_y / m_height;
@ -2567,9 +2570,8 @@ render_manager::render_manager(running_machine &machine)
machine.configuration().config_register("video", config_saveload_delegate(FUNC(render_manager::config_load), this), config_saveload_delegate(FUNC(render_manager::config_save), this));
// create one container per screen
screen_device_iterator iter(machine.root_device());
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
screen->set_container(*container_alloc(screen));
for (screen_device &screen : screen_device_iterator(machine.root_device()))
screen.set_container(*container_alloc(&screen));
}

View File

@ -472,7 +472,7 @@ float render_font::utf8string_width(float height, float aspect, const char *utf8
bool render_font::load_cached_bdf(const char *filename)
{
// first try to open the BDF itself
emu_file file(manager().machine().options().font_path(), OPEN_FLAG_READ);
emu_file file(m_manager.machine().options().font_path(), OPEN_FLAG_READ);
osd_file::error filerr = file.open(filename);
if (filerr != osd_file::error::NONE)
return false;
@ -495,7 +495,7 @@ bool render_font::load_cached_bdf(const char *filename)
// attempt to open the cached version of the font
{
emu_file cachefile(manager().machine().options().font_path(), OPEN_FLAG_READ);
emu_file cachefile(m_manager.machine().options().font_path(), OPEN_FLAG_READ);
filerr = cachefile.open(cachedname.c_str());
if (filerr == osd_file::error::NONE)
{
@ -732,7 +732,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
osd_printf_warning("Generating cached BDF font...\n");
// attempt to open the file
emu_file file(manager().machine().options().font_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE);
emu_file file(m_manager.machine().options().font_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE);
osd_file::error filerr = file.open(filename);
if (filerr != osd_file::error::NONE)
return false;

View File

@ -164,16 +164,15 @@ static int get_variable_value(running_machine &machine, const char *string, char
char temp[100];
// screen 0 parameters
screen_device_iterator iter(machine.root_device());
int scrnum = 0;
for (const screen_device *device = iter.first(); device != nullptr; device = iter.next(), scrnum++)
for (const screen_device &device : screen_device_iterator(machine.root_device()))
{
// native X aspect factor
sprintf(temp, "~scr%dnativexaspect~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
int num = device->visible_area().width();
int den = device->visible_area().height();
int num = device.visible_area().width();
int den = device.visible_area().height();
reduce_fraction(num, den);
*outputptr += sprintf(*outputptr, "%d", num);
return strlen(temp);
@ -183,8 +182,8 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dnativeyaspect~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
int num = device->visible_area().width();
int den = device->visible_area().height();
int num = device.visible_area().width();
int den = device.visible_area().height();
reduce_fraction(num, den);
*outputptr += sprintf(*outputptr, "%d", den);
return strlen(temp);
@ -194,7 +193,7 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dwidth~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
*outputptr += sprintf(*outputptr, "%d", device->visible_area().width());
*outputptr += sprintf(*outputptr, "%d", device.visible_area().width());
return strlen(temp);
}
@ -202,9 +201,12 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dheight~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
*outputptr += sprintf(*outputptr, "%d", device->visible_area().height());
*outputptr += sprintf(*outputptr, "%d", device.visible_area().height());
return strlen(temp);
}
// keep count
scrnum++;
}
// default: copy the first character and continue
@ -2401,10 +2403,7 @@ layout_view::item::item(running_machine &machine, xml_data_node &itemnode, simpl
// fetch common data
int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1);
if (index != -1)
{
screen_device_iterator iter(machine.root_device());
m_screen = iter.byindex(index);
}
m_screen = screen_device_iterator(machine.root_device()).byindex(index);
m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0);
if (m_output_name[0] != 0 && m_element != nullptr)
machine.output().set_value(m_output_name.c_str(), m_element->default_state());

View File

@ -265,22 +265,22 @@ int rom_load_manager::set_disk_handle(const char *region, const char *fullpath)
from SystemBios structure and OPTION_BIOS
-------------------------------------------------*/
void rom_load_manager::determine_bios_rom(device_t *device, const char *specbios)
void rom_load_manager::determine_bios_rom(device_t &device, const char *specbios)
{
const char *defaultname = nullptr;
const rom_entry *rom;
int default_no = 1;
int bios_count = 0;
device->set_system_bios(0);
device.set_system_bios(0);
/* first determine the default BIOS name */
for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++)
for (rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++)
if (ROMENTRY_ISDEFAULT_BIOS(rom))
defaultname = ROM_GETNAME(rom);
/* look for a BIOS with a matching name */
for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++)
for (rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++)
if (ROMENTRY_ISSYSTEM_BIOS(rom))
{
const char *biosname = ROM_GETNAME(rom);
@ -290,14 +290,14 @@ void rom_load_manager::determine_bios_rom(device_t *device, const char *specbios
/* Allow '-bios n' to still be used */
sprintf(bios_number, "%d", bios_flags - 1);
if (core_stricmp(bios_number, specbios) == 0 || core_stricmp(biosname, specbios) == 0)
device->set_system_bios(bios_flags);
device.set_system_bios(bios_flags);
if (defaultname != nullptr && core_stricmp(biosname, defaultname) == 0)
default_no = bios_flags;
bios_count++;
}
/* if none found, use the default */
if (device->system_bios() == 0 && bios_count > 0)
if (device.system_bios() == 0 && bios_count > 0)
{
/* if we got neither an empty string nor 'default' then warn the user */
if (specbios[0] != 0 && strcmp(specbios, "default") != 0)
@ -307,10 +307,10 @@ void rom_load_manager::determine_bios_rom(device_t *device, const char *specbios
}
/* set to default */
device->set_system_bios(default_no);
device.set_system_bios(default_no);
}
device->set_default_bios(default_no);
LOG(("For \"%s\" using System BIOS: %d\n", device->tag(), device->system_bios()));
device.set_default_bios(default_no);
LOG(("For \"%s\" using System BIOS: %d\n", device.tag(), device.system_bios()));
}
@ -328,11 +328,10 @@ void rom_load_manager::count_roms()
m_romstotalsize = 0;
/* loop over regions, then over files */
device_iterator deviter(machine().config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (device_t &device : device_iterator(machine().config().root_device()))
for (region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
for (rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom))
if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device->system_bios())
if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device.system_bios())
{
m_romstotal++;
m_romstotalsize += rom_file_size(rom);
@ -1062,9 +1061,8 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_
for (int drv = driver_list::find(*gamedrv); drv != -1; drv = driver_list::clone(drv))
{
machine_config config(driver_list::driver(drv), options);
device_iterator deviter(config.root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (device_t &device : device_iterator(config.root_device()))
for (region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
if (ROMREGION_ISDISKDATA(region))
for (rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom))
@ -1380,12 +1378,12 @@ void rom_load_manager::process_region_list()
/* loop until we hit the end */
device_iterator deviter(machine().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (device_t &device : deviter)
for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
{
UINT32 regionlength = ROMREGION_GETLENGTH(region);
regiontag = rom_region_name(*device, region);
regiontag = rom_region_name(device, region);
LOG(("Processing region \"%s\" (length=%X)\n", regiontag.c_str(), regionlength));
/* the first entry must be a region */
@ -1418,25 +1416,25 @@ void rom_load_manager::process_region_list()
#endif
/* now process the entries in the region */
process_rom_entries(device->shortname(), region, region + 1, device, FALSE);
process_rom_entries(device.shortname(), region, region + 1, &device, FALSE);
}
else if (ROMREGION_ISDISKDATA(region))
process_disk_entries(regiontag.c_str(), region, region + 1, nullptr);
}
/* now go back and post-process all the regions */
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
for (device_t &device : deviter)
for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
{
regiontag = rom_region_name(*device, region);
regiontag = rom_region_name(device, region);
region_post_process(regiontag.c_str(), ROMREGION_ISINVERTED(region));
}
/* and finally register all per-game parameters */
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (const rom_entry *param = rom_first_parameter(*device); param != nullptr; param = rom_next_parameter(param))
for (device_t &device : deviter)
for (const rom_entry *param = rom_first_parameter(device); param != nullptr; param = rom_next_parameter(param))
{
regiontag = rom_parameter_name(*device, param);
regiontag = rom_parameter_name(device, param);
machine().parameters().add(regiontag, rom_parameter_value(param));
}
}
@ -1451,17 +1449,19 @@ rom_load_manager::rom_load_manager(running_machine &machine)
: m_machine(machine)
{
/* figure out which BIOS we are using */
device_iterator deviter(machine.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next()) {
if (device->rom_region()) {
for (device_t &device : device_iterator(machine.config().root_device()))
{
if (device.rom_region())
{
std::string specbios;
if (device->owner() == nullptr) {
if (device.owner() == nullptr)
specbios.assign(machine.options().bios());
} else {
specbios = machine.options().sub_value(device->owner()->tag()+1,"bios");
if (specbios.empty()) {
specbios = device->default_bios_tag();
}
else
{
specbios = machine.options().sub_value(device.owner()->tag()+1,"bios");
if (specbios.empty())
specbios = device.default_bios_tag();
}
determine_bios_rom(device, specbios.c_str());
}

View File

@ -305,7 +305,7 @@ public:
void load_software_part_region(device_t &device, software_list_device &swlist, const char *swname, const rom_entry *start_region);
private:
void determine_bios_rom(device_t *device, const char *specbios);
void determine_bios_rom(device_t &device, const char *specbios);
void count_roms();
void fill_random(UINT8 *base, UINT32 length);
void handle_missing_file(const rom_entry *romp, std::string tried_file_names, chd_error chderr);

View File

@ -781,20 +781,19 @@ void device_scheduler::rebuild_execute_list()
device_execute_interface **suspend_tailptr = &suspend_list;
// iterate over all devices
execute_interface_iterator iter(machine().root_device());
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
for (device_execute_interface &exec : execute_interface_iterator(machine().root_device()))
{
// append to the appropriate list
exec->m_nextexec = nullptr;
if (exec->m_suspend == 0)
exec.m_nextexec = nullptr;
if (exec.m_suspend == 0)
{
*active_tailptr = exec;
active_tailptr = &exec->m_nextexec;
*active_tailptr = &exec;
active_tailptr = &exec.m_nextexec;
}
else
{
*suspend_tailptr = exec;
suspend_tailptr = &exec->m_nextexec;
*suspend_tailptr = &exec;
suspend_tailptr = &exec.m_nextexec;
}
}

View File

@ -391,10 +391,9 @@ void software_list_device::release()
software_list_device *software_list_device::find_by_name(const machine_config &config, const char *name)
{
// iterate over each device in the system and find a match
software_list_device_iterator deviter(config.root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != nullptr; swlistdev = deviter.next())
if (strcmp(swlistdev->list_name(), name) == 0)
return swlistdev;
for (software_list_device &swlistdev : software_list_device_iterator(config.root_device()))
if (strcmp(swlistdev.list_name(), name) == 0)
return &swlistdev;
return nullptr;
}
@ -409,25 +408,25 @@ void software_list_device::display_matches(const machine_config &config, const c
{
// check if there is at least one software list
software_list_device_iterator deviter(config.root_device());
if (deviter.first())
if (deviter.first() != nullptr)
osd_printf_error("\n\"%s\" approximately matches the following\n"
"supported software items (best match first):\n\n", name);
// iterate through lists
for (software_list_device *swlistdev = deviter.first(); swlistdev != nullptr; swlistdev = deviter.next())
for (software_list_device &swlistdev : deviter)
{
// get the top 16 approximate matches for the selected device interface (i.e. only carts for cartslot, etc.)
software_info *matches[16] = { nullptr };
swlistdev->find_approx_matches(name, ARRAY_LENGTH(matches), matches, interface);
swlistdev.find_approx_matches(name, ARRAY_LENGTH(matches), matches, interface);
// if we found some, print them
if (matches[0] != nullptr)
{
// different output depending on original system or compatible
if (swlistdev->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev->list_name(), swlistdev->description());
if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev.list_name(), swlistdev.description());
else
osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev->list_name(), swlistdev->description());
osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev.list_name(), swlistdev.description());
// print them out
for (auto & matche : matches)

View File

@ -899,19 +899,20 @@ void sound_manager::set_attenuation(int attenuation)
bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const
{
// scan through the mixers until we find the indexed input
mixer_interface_iterator iter(machine().root_device());
for (info.mixer = iter.first(); info.mixer != nullptr; info.mixer = iter.next())
for (device_mixer_interface &mixer : mixer_interface_iterator(machine().root_device()))
{
if (index < info.mixer->inputs())
if (index < mixer.inputs())
{
info.stream = info.mixer->input_to_stream_input(index, info.inputnum);
info.mixer = &mixer;
info.stream = mixer.input_to_stream_input(index, info.inputnum);
assert(info.stream != nullptr);
return true;
}
index -= info.mixer->inputs();
index -= mixer.inputs();
}
// didn't locate
info.mixer = nullptr;
return false;
}
@ -937,9 +938,8 @@ void sound_manager::mute(bool mute, UINT8 reason)
void sound_manager::reset()
{
// reset all the sound chips
sound_interface_iterator iter(machine().root_device());
for (device_sound_interface *sound = iter.first(); sound != nullptr; sound = iter.next())
sound->device().reset();
for (device_sound_interface &sound : sound_interface_iterator(machine().root_device()))
sound.device().reset();
}
@ -1039,9 +1039,8 @@ void sound_manager::update(void *ptr, int param)
// force all the speaker streams to generate the proper number of samples
int samples_this_update = 0;
speaker_device_iterator iter(machine().root_device());
for (speaker_device *speaker = iter.first(); speaker != nullptr; speaker = iter.next())
speaker->mix(&m_leftmix[0], &m_rightmix[0], samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
speaker.mix(&m_leftmix[0], &m_rightmix[0], samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
// now downmix the final result
UINT32 finalmix_step = machine().video().speed_factor();

View File

@ -158,8 +158,7 @@ ui_menu_cheat::~ui_menu_cheat()
ui_menu_autofire::ui_menu_autofire(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
screen_device_iterator iter(machine.root_device());
const screen_device *screen = iter.first();
const screen_device *screen = machine.first_screen();
if (screen == nullptr)
{

View File

@ -9,6 +9,7 @@
*********************************************************************/
#include "emu.h"
#include "emuopts.h"
#include "ui/custui.h"
#include "ui/ui.h"

View File

@ -29,15 +29,14 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container
, m_issoft(false)
{
image_interface_iterator iter(machine.root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine.root_device()))
{
if (image->filename())
if (image.filename())
{
m_list = strensure(image->software_list_name());
m_short = strensure(image->software_entry()->shortname());
m_long = strensure(image->software_entry()->longname());
m_parent = strensure(image->software_entry()->parentname());
m_list = strensure(image.software_list_name());
m_short = strensure(image.software_entry()->shortname());
m_long = strensure(image.software_entry()->longname());
m_parent = strensure(image.software_entry()->parentname());
}
}

View File

@ -20,21 +20,9 @@
ui_menu_device_config::ui_menu_device_config(running_machine &machine, render_container *container, device_slot_interface *slot, device_slot_option *option) : ui_menu(machine, container)
{
std::string tmp_tag;
tmp_tag.assign(slot->device().tag()).append(":").append(option->name());
m_option = option;
m_owner = slot;
m_mounted = false;
device_iterator deviter(machine.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
{
if (strcmp(device->tag(), tmp_tag.c_str()) == 0)
{
m_mounted = true;
break;
}
}
m_mounted = slot->device().subdevice(option->name()) != nullptr;
}
void ui_menu_device_config::populate()
@ -59,22 +47,21 @@ void ui_menu_device_config::populate()
{
str << "* CPU:\n";
std::unordered_set<std::string> exectags;
for (device_execute_interface *exec = execiter.first(); exec != nullptr; exec = execiter.next())
for (device_execute_interface &exec : execiter)
{
if (!exectags.insert(exec->device().tag()).second)
if (!exectags.insert(exec.device().tag()).second)
continue;
// get cpu specific clock that takes internal multiplier/dividers into account
int clock = exec->device().clock();
int clock = exec.device().clock();
// count how many identical CPUs we have
int count = 1;
const char *name = exec->device().name();
execute_interface_iterator execinneriter(*dev);
for (device_execute_interface *scan = execinneriter.first(); scan != nullptr; scan = execinneriter.next())
const char *name = exec.device().name();
for (device_execute_interface &scan : execiter)
{
if (exec->device().type() == scan->device().type() && strcmp(name, scan->device().name()) == 0 && exec->device().clock() == scan->device().clock())
if (exectags.insert(scan->device().tag()).second)
if (exec.device().type() == scan.device().type() && strcmp(name, scan.device().name()) == 0 && exec.device().clock() == scan.device().clock())
if (exectags.insert(scan.device().tag()).second)
count++;
}
@ -98,20 +85,20 @@ void ui_menu_device_config::populate()
if (scriter.count() > 0)
{
str << "* Video:\n";
for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next())
for (screen_device &screen : scriter)
{
util::stream_format(str, " Screen '%s': ", screen->tag());
util::stream_format(str, " Screen '%s': ", screen.tag());
if (screen->screen_type() == SCREEN_TYPE_VECTOR)
if (screen.screen_type() == SCREEN_TYPE_VECTOR)
str << "Vector\n";
else
{
const rectangle &visarea = screen->visible_area();
const rectangle &visarea = screen.visible_area();
util::stream_format(str, "%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
visarea.width(), visarea.height(),
(machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds()));
ATTOSECONDS_TO_HZ(screen.frame_period().attoseconds()));
}
}
}
@ -122,18 +109,17 @@ void ui_menu_device_config::populate()
{
str << "* Sound:\n";
std::unordered_set<std::string> soundtags;
for (device_sound_interface *sound = snditer.first(); sound != nullptr; sound = snditer.next())
for (device_sound_interface &sound : snditer)
{
if (!soundtags.insert(sound->device().tag()).second)
if (!soundtags.insert(sound.device().tag()).second)
continue;
// count how many identical sound chips we have
int count = 1;
sound_interface_iterator sndinneriter(*dev);
for (device_sound_interface *scan = sndinneriter.first(); scan != nullptr; scan = sndinneriter.next())
for (device_sound_interface &scan : snditer)
{
if (sound->device().type() == scan->device().type() && sound->device().clock() == scan->device().clock())
if (soundtags.insert(scan->device().tag()).second)
if (sound.device().type() == scan.device().type() && sound.device().clock() == scan.device().clock())
if (soundtags.insert(scan.device().tag()).second)
count++;
}
// if more than one, prepend a #x in front of the CPU name
@ -141,10 +127,10 @@ void ui_menu_device_config::populate()
util::stream_format(str," %d" UTF8_MULTIPLY, count);
else
str << " ";
str << sound->device().name();
str << sound.device().name();
// display clock in kHz or MHz
int clock = sound->device().clock();
int clock = sound.device().clock();
if (clock >= 1000000)
util::stream_format(str," %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
else if (clock != 0)
@ -184,9 +170,8 @@ void ui_menu_device_config::populate()
std::string errors;
std::ostringstream dips_opt, confs_opt;
ioport_list portlist;
device_iterator iptiter(*dev);
for (device_t *iptdev = iptiter.first(); iptdev != nullptr; iptdev = iptiter.next())
portlist.append(*iptdev, errors);
for (device_t &iptdev : device_iterator(*dev))
portlist.append(iptdev, errors);
// check if the device adds inputs to the system
for (ioport_port &port : portlist)
@ -263,16 +248,16 @@ void ui_menu_device_config::populate()
if (imgiter.count() > 0)
{
str << "* Media Options:\n";
for (const device_image_interface *imagedev = imgiter.first(); imagedev != nullptr; imagedev = imgiter.next())
util::stream_format(str, " %s [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag());
for (const device_image_interface &imagedev : imgiter)
util::stream_format(str, " %s [tag: %s]\n", imagedev.image_type_name(), imagedev.device().tag());
}
slot_interface_iterator slotiter(*dev);
if (slotiter.count() > 0)
{
str << "* Slot Options:\n";
for (const device_slot_interface *slot = slotiter.first(); slot != nullptr; slot = slotiter.next())
util::stream_format(str, " %s [default: %s]\n", slot->device().tag(), slot->default_option() ? slot->default_option() : "----");
for (const device_slot_interface &slot : slotiter)
util::stream_format(str, " %s [default: %s]\n", slot.device().tag(), slot.default_option() ? slot.default_option() : "----");
}
if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + bios + dips + confs

View File

@ -9,6 +9,7 @@
*********************************************************************/
#include "emu.h"
#include "emuopts.h"
#include "ui/ui.h"
#include "ui/menu.h"
#include "ui/dirmenu.h"

View File

@ -113,28 +113,26 @@ void ui_menu_file_manager::populate()
}
// cycle through all devices for this system
device_iterator iter(machine().root_device());
std::unordered_set<std::string> devtags;
for (device_t *dev = iter.first(); dev != nullptr; dev = iter.next())
for (device_t &dev : device_iterator(machine().root_device()))
{
bool tag_appended = false;
if (!devtags.insert(dev->tag()).second)
if (!devtags.insert(dev.tag()).second)
continue;
// check whether it owns an image interface
image_interface_iterator subiter(*dev);
if (subiter.count() > 0)
image_interface_iterator subiter(dev);
if (subiter.first() != nullptr)
{
// if so, cycle through all its image interfaces
image_interface_iterator subiterator(*dev);
for (device_image_interface *scan = subiterator.first(); scan != nullptr; scan = subiterator.next())
for (device_image_interface &scan : subiter)
{
if (!scan->user_loadable())
continue;
if (!scan.user_loadable())
continue;
// if it is a children device, and not something further down the device tree, we want it in the menu!
if (strcmp(scan->device().owner()->tag(), dev->tag()) == 0)
if (devtags.insert(scan->device().tag()).second)
if (strcmp(scan.device().owner()->tag(), dev.tag()) == 0)
if (devtags.insert(scan.device().tag()).second)
{
// check whether we already had some devices with the same owner: if not, output the owner tag!
if (!tag_appended)
@ -143,12 +141,12 @@ void ui_menu_file_manager::populate()
first_entry = false;
else
item_append(ui_menu_item_type::SEPARATOR);
item_append(string_format("[root%s]", dev->tag()).c_str(), nullptr, 0, nullptr);
item_append(string_format("[root%s]", dev.tag()).c_str(), nullptr, 0, nullptr);
tag_appended = true;
}
// finally, append the image interface to the menu
fill_image_line(scan, tmp_inst, tmp_name);
item_append(tmp_inst.c_str(), tmp_name.c_str(), 0, (void *)scan);
fill_image_line(&scan, tmp_inst, tmp_name);
item_append(tmp_inst.c_str(), tmp_name.c_str(), 0, (void *)&scan);
}
}
}

View File

@ -36,14 +36,10 @@ ui_menu_control_device_image::ui_menu_control_device_image(running_machine &mach
{
image = _image;
sld = nullptr;
if (image->software_list_name()) {
software_list_device_iterator iter(machine.config().root_device());
for (software_list_device *swlist = iter.first(); swlist != nullptr; swlist = iter.next())
{
if (strcmp(swlist->list_name(),image->software_list_name())==0) sld = swlist;
}
}
if (image->software_list_name())
sld = software_list_device::find_by_name(machine.config(), image->software_list_name());
else
sld = nullptr;
swi = image->software_entry();
swp = image->part_entry();

View File

@ -58,9 +58,8 @@ void ui_menu_image_info::populate()
item_append(machine().system().description, nullptr, MENU_FLAG_DISABLE, nullptr);
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
image_info(image);
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
image_info(&image);
}
void ui_menu_image_info::handle()

View File

@ -26,14 +26,13 @@ void ui_menu_pty_info::populate()
item_append(_("Pseudo terminals"), nullptr, MENU_FLAG_DISABLE, nullptr);
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
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() + 1;
if (pty->is_open()) {
item_append(port_name , pty->slave_name() , MENU_FLAG_DISABLE , nullptr);
} else {
item_append(port_name , _("[failed]") , MENU_FLAG_DISABLE , nullptr);
}
for (device_pty_interface &pty : pty_interface_iterator(machine().root_device()))
{
const char *port_name = pty.device().owner()->tag() + 1;
if (pty.is_open())
item_append(port_name, pty.slave_name(), MENU_FLAG_DISABLE, nullptr);
else
item_append(port_name, _("[failed]"), MENU_FLAG_DISABLE, nullptr);
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
}
}

View File

@ -60,6 +60,9 @@ void inifile_manager::directory_scan()
}
}
}
// sort
std::stable_sort(ini_index.begin(), ini_index.end());
}
//-------------------------------------------------
@ -85,6 +88,9 @@ void inifile_manager::init_category(std::string &filename)
}
}
// sort
std::stable_sort(index.begin(), index.end());
if (!index.empty())
ini_index.emplace_back(filename, index);
}
@ -207,30 +213,29 @@ void favorite_manager::add_favorite_game()
}
bool software_avail = false;
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
if (image->exists() && image->software_entry())
if (image.exists() && image.software_entry())
{
const software_info *swinfo = image->software_entry();
const software_part *part = image->part_entry();
const software_info *swinfo = image.software_entry();
const software_part *part = image.part_entry();
ui_software_info tmpmatches;
tmpmatches.shortname = strensure(swinfo->shortname());
tmpmatches.longname = strensure(image->longname());
tmpmatches.longname = strensure(image.longname());
tmpmatches.parentname = strensure(swinfo->parentname());
tmpmatches.year = strensure(image->year());
tmpmatches.publisher = strensure(image->manufacturer());
tmpmatches.supported = image->supported();
tmpmatches.year = strensure(image.year());
tmpmatches.publisher = strensure(image.manufacturer());
tmpmatches.supported = image.supported();
tmpmatches.part = strensure(part->name());
tmpmatches.driver = &machine().system();
tmpmatches.listname = strensure(image->software_list_name());
tmpmatches.listname = strensure(image.software_list_name());
tmpmatches.interface = strensure(part->interface());
tmpmatches.instance = strensure(image->instance_name());
tmpmatches.instance = strensure(image.instance_name());
tmpmatches.startempty = 0;
tmpmatches.parentlongname.clear();
if (swinfo->parentname())
{
software_list_device *swlist = software_list_device::find_by_name(machine().config(), image->software_list_name());
software_list_device *swlist = software_list_device::find_by_name(machine().config(), image.software_list_name());
for (software_info &c_swinfo : swlist->get_info())
{
std::string c_parent(c_swinfo.parentname());
@ -247,7 +252,7 @@ void favorite_manager::add_favorite_game()
if (!strcmp(flist.name(), "usage"))
tmpmatches.usage = flist.value();
tmpmatches.devicetype = strensure(image->image_type_name());
tmpmatches.devicetype = strensure(image.image_type_name());
tmpmatches.available = true;
software_avail = true;
m_list.push_back(tmpmatches);
@ -288,18 +293,17 @@ bool favorite_manager::isgame_favorite()
if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0)
return isgame_favorite(&machine().system());
image_interface_iterator iter(machine().root_device());
bool image_loaded = false;
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
const software_info *swinfo = image->software_entry();
if (image->exists() && swinfo != nullptr)
const software_info *swinfo = image.software_entry();
if (image.exists() && swinfo != nullptr)
{
image_loaded = true;
for (size_t current = 0; current < m_list.size(); current++)
if (m_list[current].shortname == swinfo->shortname() &&
m_list[current].listname == image->software_list_name())
m_list[current].listname == image.software_list_name())
{
m_current = current;
return true;

View File

@ -30,7 +30,7 @@ public:
std::string get_file(int file = -1) { return ((file == -1) ? ini_index[c_file].first : ini_index[file].first); }
std::string get_category(int cat = -1) { return ((cat == -1) ? ini_index[c_file].second[c_cat].first : ini_index[c_file].second[cat].first); }
size_t total() { return ini_index.size(); }
size_t cat_total() { return ini_index[c_file].second.size(); }
size_t cat_total(int cat = -1) { return ((cat == -1) ? ini_index[c_file].second.size() : ini_index[cat].second.size()); }
UINT16 &cur_file() { return c_file; }
UINT16 &cur_cat() { return c_cat; }

View File

@ -71,46 +71,40 @@ void ui_menu_main::populate()
/* add game info menu */
item_append(_("Machine Information"), nullptr, 0, (void *)GAME_INFO);
image_interface_iterator imgiter(machine().root_device());
for (device_image_interface *image = imgiter.first(); image != nullptr; image = imgiter.next())
{
if (image->user_loadable())
{
/* add image info menu */
item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
/* add file manager menu */
item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
break;
}
}
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
if (image.user_loadable())
{
/* add image info menu */
item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
/* add tape control menu */
cassette_device_iterator cassiter(machine().root_device());
if (cassiter.first() != nullptr)
item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL);
/* add file manager menu */
item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
pty_interface_iterator ptyiter(machine().root_device());
if (ptyiter.first() != nullptr)
item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO);
break;
}
}
if (machine().ioport().has_bioses())
/* add tape control menu */
if (cassette_device_iterator(machine().root_device()).first() != nullptr)
item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL);
if (pty_interface_iterator(machine().root_device()).first() != nullptr)
item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO);
if (machine().ioport().has_bioses())
item_append(_("Bios Selection"), nullptr, 0, (void *)BIOS_SELECTION);
/* add slot info menu */
slot_interface_iterator slotiter(machine().root_device());
if (slotiter.first() != nullptr)
/* add slot info menu */
if (slot_interface_iterator(machine().root_device()).first() != nullptr)
item_append(_("Slot Devices"), nullptr, 0, (void *)SLOT_DEVICES);
/* add Barcode reader menu */
barcode_reader_device_iterator bcriter(machine().root_device());
if (bcriter.first() != nullptr)
/* add Barcode reader menu */
if (barcode_reader_device_iterator(machine().root_device()).first() != nullptr)
item_append(_("Barcode Reader"), nullptr, 0, (void *)BARCODE_READ);
/* add network info menu */
network_interface_iterator netiter(machine().root_device());
if (netiter.first() != nullptr)
/* add network info menu */
if (network_interface_iterator(machine().root_device()).first() != nullptr)
item_append(_("Network Devices"), nullptr, 0, (void*)NETWORK_DEVICES);
/* add keyboard mode menu */

View File

@ -72,19 +72,19 @@ ui_menu_bios_selection::ui_menu_bios_selection(running_machine &machine, render_
void ui_menu_bios_selection::populate()
{
/* cycle through all devices for this system */
device_iterator deviter(machine().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (device_t &device : device_iterator(machine().root_device()))
{
if (device->rom_region()) {
if (device.rom_region())
{
const char *val = "default";
for (const rom_entry *rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++)
for (const rom_entry *rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++)
{
if (ROMENTRY_ISSYSTEM_BIOS(rom) && ROM_GETBIOSFLAGS(rom)==device->system_bios())
if (ROMENTRY_ISSYSTEM_BIOS(rom) && ROM_GETBIOSFLAGS(rom) == device.system_bios())
{
val = ROM_GETHASHDATA(rom);
}
}
item_append(strcmp(device->tag(),":")==0 ? "driver" : device->tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
item_append(device.owner() == nullptr ? "driver" : device.tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)&device);
}
}
@ -154,10 +154,9 @@ ui_menu_network_devices::~ui_menu_network_devices()
void ui_menu_network_devices::populate()
{
/* cycle through all devices for this system */
network_interface_iterator iter(machine().root_device());
for (device_network_interface *network = iter.first(); network != nullptr; network = iter.next())
for (device_network_interface &network : network_interface_iterator(machine().root_device()))
{
int curr = network->get_interface();
int curr = network.get_interface();
const char *title = nullptr;
const osd_netdev::entry_t *entry = netdev_first();
while(entry) {
@ -168,7 +167,7 @@ void ui_menu_network_devices::populate()
entry = entry->m_next;
}
item_append(network->device().tag(), (title) ? title : "------", MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)network);
item_append(network.device().tag(), (title) ? title : "------", MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)network);
}
}
@ -773,12 +772,14 @@ void ui_menu_machine_configure::handle()
void ui_menu_machine_configure::populate()
{
// add options items
item_append(_("Bios"), nullptr, MENU_FLAG_DISABLE | MENU_FLAG_UI_HEADING, nullptr);
if (!m_bios.empty())
{
item_append(_("Bios"), nullptr, MENU_FLAG_DISABLE | MENU_FLAG_UI_HEADING, nullptr);
UINT32 arrows = get_arrow_flags(0, m_bios.size() - 1, m_curbios);
item_append(_("Driver"), m_bios[m_curbios].first.c_str(), arrows, (void *)(FPTR)BIOS);
}
else
item_append(_("This machine has no bios."), nullptr, MENU_FLAG_DISABLE, nullptr);
item_append(ui_menu_item_type::SEPARATOR);
item_append(_(advanced_submenu_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED);

View File

@ -161,15 +161,24 @@ void ui_menu_game_options::handle()
break;
case MISC_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
{
ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, misc_submenu_options));
ui_globals::reset = true;
}
break;
case SOUND_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
{
ui_menu::stack_push(global_alloc_clear<ui_menu_sound_options>(machine(), container));
ui_globals::reset = true;
}
break;
case DISPLAY_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
{
ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, video_submenu_options));
ui_globals::reset = true;
}
break;
case CUSTOM_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
@ -189,7 +198,10 @@ void ui_menu_game_options::handle()
break;
case ADVANCED_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
{
ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, advanced_submenu_options));
ui_globals::reset = true;
}
break;
case SAVE_CONFIG:
if (m_event->iptkey == IPT_UI_SELECT)

View File

@ -1048,9 +1048,8 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
{
if ((driver->flags & MACHINE_TYPE_ARCADE) == 0)
{
software_list_device_iterator iter(enumerator.config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (!swlistdev->get_info().empty())
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config().root_device()))
if (!swlistdev.get_info().empty())
{
ui_menu::stack_push(global_alloc_clear<ui_menu_select_software>(machine(), container, driver));
return;

View File

@ -430,9 +430,8 @@ void ui_menu_select_software::populate()
int old_software = -1;
machine_config config(*m_driver, machine().options());
image_interface_iterator iter(config.root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
if (image->filename() == nullptr && image->must_be_loaded())
for (device_image_interface &image : image_interface_iterator(config.root_device()))
if (image.filename() == nullptr && image.must_be_loaded())
{
m_has_empty_start = false;
break;
@ -528,32 +527,30 @@ void ui_menu_select_software::build_software_list()
m_swinfo.emplace_back(m_driver->name, m_driver->description, "", "", "", 0, "", m_driver, "", "", "", 1, "", "", "", true);
machine_config config(*m_driver, machine().options());
software_list_device_iterator deviter(config.root_device());
// iterate thru all software lists
for (software_list_device *swlist = deviter.first(); swlist != nullptr; swlist = deviter.next())
for (software_list_device &swlist : software_list_device_iterator(config.root_device()))
{
m_filter.swlist.name.push_back(swlist->list_name());
m_filter.swlist.description.push_back(swlist->description());
for (software_info &swinfo : swlist->get_info())
m_filter.swlist.name.push_back(swlist.list_name());
m_filter.swlist.description.push_back(swlist.description());
for (software_info &swinfo : swlist.get_info())
{
software_part *part = swinfo.first_part();
if (part->is_compatible(*swlist))
if (part->is_compatible(swlist))
{
const char *instance_name = nullptr;
const char *type_name = nullptr;
ui_software_info tmpmatches;
image_interface_iterator imgiter(config.root_device());
for (device_image_interface *image = imgiter.first(); image != nullptr; image = imgiter.next())
for (device_image_interface &image : image_interface_iterator(config.root_device()))
{
const char *interface = image->image_interface();
const char *interface = image.image_interface();
if (interface != nullptr && part->matches_interface(interface))
{
instance_name = image->instance_name();
instance_name = image.instance_name();
if (instance_name != nullptr)
tmpmatches.instance = image->instance_name();
tmpmatches.instance = image.instance_name();
type_name = image->image_type_name();
type_name = image.image_type_name();
if (type_name != nullptr)
tmpmatches.devicetype = type_name;
break;
@ -571,7 +568,7 @@ void ui_menu_select_software::build_software_list()
tmpmatches.supported = swinfo.supported();
tmpmatches.part = strensure(part->name());
tmpmatches.driver = m_driver;
tmpmatches.listname = strensure(swlist->list_name());
tmpmatches.listname = strensure(swlist.list_name());
tmpmatches.interface = strensure(part->interface());
tmpmatches.startempty = 0;
tmpmatches.parentlongname.clear();

View File

@ -19,33 +19,33 @@
/*-------------------------------------------------
ui_slot_get_current_option - returns
-------------------------------------------------*/
device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_interface *slot)
device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_interface &slot)
{
std::string current;
if (slot->fixed())
if (slot.fixed())
{
if (slot->default_option() == nullptr) return nullptr;
current.assign(slot->default_option());
if (slot.default_option() == nullptr) return nullptr;
current.assign(slot.default_option());
}
else
{
current = machine().options().main_value(slot->device().tag() + 1);
current = machine().options().main_value(slot.device().tag() + 1);
}
return slot->option(current.c_str());
return slot.option(current.c_str());
}
/*-------------------------------------------------
ui_slot_get_current_index - returns
-------------------------------------------------*/
int ui_menu_slot_devices::slot_get_current_index(device_slot_interface *slot)
int ui_menu_slot_devices::slot_get_current_index(device_slot_interface &slot)
{
const device_slot_option *current = slot_get_current_option(slot);
if (current != nullptr)
{
int val = 0;
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
if (&option == current)
return val;
@ -61,10 +61,10 @@ int ui_menu_slot_devices::slot_get_current_index(device_slot_interface *slot)
/*-------------------------------------------------
ui_slot_get_length - returns
-------------------------------------------------*/
int ui_menu_slot_devices::slot_get_length(device_slot_interface *slot)
int ui_menu_slot_devices::slot_get_length(device_slot_interface &slot)
{
int val = 0;
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
if (option.selectable())
val++;
@ -74,7 +74,7 @@ int ui_menu_slot_devices::slot_get_length(device_slot_interface *slot)
/*-------------------------------------------------
ui_slot_get_next - returns
-------------------------------------------------*/
const char *ui_menu_slot_devices::slot_get_next(device_slot_interface *slot)
const char *ui_menu_slot_devices::slot_get_next(device_slot_interface &slot)
{
int idx = slot_get_current_index(slot);
if (idx < 0)
@ -91,7 +91,7 @@ const char *ui_menu_slot_devices::slot_get_next(device_slot_interface *slot)
/*-------------------------------------------------
ui_slot_get_prev - returns
-------------------------------------------------*/
const char *ui_menu_slot_devices::slot_get_prev(device_slot_interface *slot)
const char *ui_menu_slot_devices::slot_get_prev(device_slot_interface &slot)
{
int idx = slot_get_current_index(slot);
if (idx < 0)
@ -108,12 +108,12 @@ const char *ui_menu_slot_devices::slot_get_prev(device_slot_interface *slot)
/*-------------------------------------------------
ui_slot_get_option - returns
-------------------------------------------------*/
const char *ui_menu_slot_devices::slot_get_option(device_slot_interface *slot, int index)
const char *ui_menu_slot_devices::slot_get_option(device_slot_interface &slot, int index)
{
if (index >= 0)
{
int val = 0;
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
if (val == index)
return option.name();
@ -132,10 +132,10 @@ const char *ui_menu_slot_devices::slot_get_option(device_slot_interface *slot, i
whether the natural keyboard is active
-------------------------------------------------*/
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;
machine().options().set_value(slot->device().tag()+1, val, OPTION_PRIORITY_CMDLINE, error);
machine().options().set_value(slot.device().tag()+1, val, OPTION_PRIORITY_CMDLINE, error);
assert(error.empty());
}
@ -151,8 +151,7 @@ ui_menu_slot_devices::ui_menu_slot_devices(running_machine &machine, render_cont
void ui_menu_slot_devices::populate()
{
/* cycle through all devices for this system */
slot_interface_iterator iter(machine().root_device());
for (device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next())
for (device_slot_interface &slot : slot_interface_iterator(machine().root_device()))
{
/* record the menu item */
const device_slot_option *option = slot_get_current_option(slot);
@ -162,11 +161,11 @@ void ui_menu_slot_devices::populate()
else
{
opt_name.assign(option->name());
if (slot->fixed() || slot_get_length(slot) == 0)
if (slot.fixed() || slot_get_length(slot) == 0)
opt_name.append(_(" [internal]"));
}
item_append(slot->device().tag() + 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() + 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(ui_menu_item_type::SEPARATOR);
item_append(_("Reset"), nullptr, 0, (void *)1);
@ -195,14 +194,14 @@ void ui_menu_slot_devices::handle()
else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
{
device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
const char *val = (menu_event->iptkey == IPT_UI_LEFT) ? slot_get_prev(slot) : slot_get_next(slot);
set_slot_device(slot, val);
const char *val = (menu_event->iptkey == IPT_UI_LEFT) ? slot_get_prev(*slot) : slot_get_next(*slot);
set_slot_device(*slot, val);
reset(UI_MENU_RESET_REMEMBER_REF);
}
else if (menu_event->iptkey == IPT_UI_SELECT)
{
device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
device_slot_option *option = slot_get_current_option(slot);
device_slot_option *option = slot_get_current_option(*slot);
if (option)
ui_menu::stack_push(global_alloc_clear<ui_menu_device_config>(machine(), container, slot, option));
}

View File

@ -23,13 +23,13 @@ public:
virtual void handle() override;
private:
device_slot_option *slot_get_current_option(device_slot_interface *slot);
int slot_get_current_index(device_slot_interface *slot);
int slot_get_length(device_slot_interface *slot);
const char *slot_get_next(device_slot_interface *slot);
const char *slot_get_prev(device_slot_interface *slot);
const char *slot_get_option(device_slot_interface *slot, int index);
void set_slot_device(device_slot_interface *slot, const char *val);
device_slot_option *slot_get_current_option(device_slot_interface &slot);
int slot_get_current_index(device_slot_interface &slot);
int slot_get_length(device_slot_interface &slot);
const char *slot_get_next(device_slot_interface &slot);
const char *slot_get_prev(device_slot_interface &slot);
const char *slot_get_option(device_slot_interface &slot, int index);
void set_slot_device(device_slot_interface &slot, const char *val);
};
#endif /* __UI_SLOTOPT_H__ */

View File

@ -409,32 +409,32 @@ void ui_menu_software::populate()
// Add original software lists for this system
software_list_device_iterator iter(machine().config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (swlistdev->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
if (!swlistdev->get_info().empty() && m_interface != nullptr)
for (software_list_device &swlistdev : iter)
if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
if (!swlistdev.get_info().empty() && m_interface != nullptr)
{
bool found = false;
for (const software_info &swinfo : swlistdev->get_info())
for (const software_info &swinfo : swlistdev.get_info())
if (swinfo.first_part()->matches_interface(m_interface))
found = true;
if (found)
item_append(swlistdev->description(), nullptr, 0, (void *)swlistdev);
item_append(swlistdev.description(), nullptr, 0, (void *)&swlistdev);
}
// add compatible software lists for this system
for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next())
if (swlistdev->list_type() == SOFTWARE_LIST_COMPATIBLE_SYSTEM)
if (!swlistdev->get_info().empty() && m_interface != nullptr)
for (software_list_device &swlistdev : iter)
if (swlistdev.list_type() == SOFTWARE_LIST_COMPATIBLE_SYSTEM)
if (!swlistdev.get_info().empty() && m_interface != nullptr)
{
bool found = false;
for (const software_info &swinfo : swlistdev->get_info())
for (const software_info &swinfo : swlistdev.get_info())
if (swinfo.first_part()->matches_interface(m_interface))
found = true;
if (found)
{
if (!have_compatible)
item_append(_("[compatible lists]"), nullptr, MENU_FLAG_DISABLE, nullptr);
item_append(swlistdev->description(), nullptr, 0, (void *)swlistdev);
item_append(swlistdev.description(), nullptr, 0, (void *)&swlistdev);
}
have_compatible = true;
}

View File

@ -1188,21 +1188,20 @@ std::string &ui_manager::game_info_astring(std::string &str)
// loop over all CPUs
execute_interface_iterator execiter(machine().root_device());
std::unordered_set<std::string> exectags;
for (device_execute_interface *exec = execiter.first(); exec != nullptr; exec = execiter.next())
for (device_execute_interface &exec : execiter)
{
if (!exectags.insert(exec->device().tag()).second)
if (!exectags.insert(exec.device().tag()).second)
continue;
// get cpu specific clock that takes internal multiplier/dividers into account
int clock = exec->device().clock();
int clock = exec.device().clock();
// count how many identical CPUs we have
int count = 1;
const char *name = exec->device().name();
execute_interface_iterator execinneriter(machine().root_device());
for (device_execute_interface *scan = execinneriter.first(); scan != nullptr; scan = execinneriter.next())
const char *name = exec.device().name();
for (device_execute_interface &scan : execiter)
{
if (exec->device().type() == scan->device().type() && strcmp(name, scan->device().name()) == 0 && exec->device().clock() == scan->device().clock())
if (exectags.insert(scan->device().tag()).second)
if (exec.device().type() == scan.device().type() && strcmp(name, scan.device().name()) == 0 && exec.device().clock() == scan.device().clock())
if (exectags.insert(scan.device().tag()).second)
count++;
}
@ -1222,9 +1221,9 @@ std::string &ui_manager::game_info_astring(std::string &str)
sound_interface_iterator snditer(machine().root_device());
std::unordered_set<std::string> soundtags;
bool found_sound = false;
for (device_sound_interface *sound = snditer.first(); sound != nullptr; sound = snditer.next())
for (device_sound_interface &sound : snditer)
{
if (!soundtags.insert(sound->device().tag()).second)
if (!soundtags.insert(sound.device().tag()).second)
continue;
// append the Sound: string
@ -1234,23 +1233,22 @@ std::string &ui_manager::game_info_astring(std::string &str)
// count how many identical sound chips we have
int count = 1;
sound_interface_iterator sndinneriter(machine().root_device());
for (device_sound_interface *scan = sndinneriter.first(); scan != nullptr; scan = sndinneriter.next())
for (device_sound_interface &scan : snditer)
{
if (sound->device().type() == scan->device().type() && sound->device().clock() == scan->device().clock())
if (soundtags.insert(scan->device().tag()).second)
if (sound.device().type() == scan.device().type() && sound.device().clock() == scan.device().clock())
if (soundtags.insert(scan.device().tag()).second)
count++;
}
// if more than one, prepend a #x in front of the CPU name
// display clock in kHz or MHz
int clock = sound->device().clock();
int clock = sound.device().clock();
util::stream_format(buf,
(count > 1)
? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$d.%4$0*5$d%6$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
: ((clock != 0) ? "%2$s %3$d.%4$0*5$d%6$s\n" : "%2$s\n"),
count,
sound->device().name(),
sound.device().name(),
(clock >= 1000000) ? (clock / 1000000) : (clock / 1000),
(clock >= 1000000) ? (clock % 1000000) : (clock % 1000),
(clock >= 1000000) ? 6 : 3,
@ -1265,23 +1263,23 @@ std::string &ui_manager::game_info_astring(std::string &str)
buf << _("None\n");
else
{
for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next())
for (screen_device &screen : scriter)
{
std::string detail;
if (screen->screen_type() == SCREEN_TYPE_VECTOR)
if (screen.screen_type() == SCREEN_TYPE_VECTOR)
detail = _("Vector");
else
{
const rectangle &visarea = screen->visible_area();
const rectangle &visarea = screen.visible_area();
detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz",
visarea.width(), visarea.height(),
(machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds()));
ATTOSECONDS_TO_HZ(screen.frame_period().attoseconds()));
}
util::stream_format(buf,
(scrcount > 1) ? _("%1$s: %2$s\n") : _("%2$s\n"),
slider_get_screen_desc(*screen), detail);
slider_get_screen_desc(screen), detail);
}
}
@ -1467,11 +1465,8 @@ void ui_manager::image_handler_ingame()
{
// run display routine for devices
if (machine().phase() == MACHINE_PHASE_RUNNING)
{
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
image->call_display();
}
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
image.call_display();
}
@ -1605,19 +1600,17 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co
// handle a tape control key
if (machine.ui_input().pressed(IPT_UI_TAPE_START))
{
cassette_device_iterator cassiter(machine.root_device());
for (cassette_image_device *cass = cassiter.first(); cass != nullptr; cass = cassiter.next())
for (cassette_image_device &cass : cassette_device_iterator(machine.root_device()))
{
cass->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
cass.change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
return 0;
}
}
if (machine.ui_input().pressed(IPT_UI_TAPE_STOP))
{
cassette_device_iterator cassiter(machine.root_device());
for (cassette_image_device *cass = cassiter.first(); cass != nullptr; cass = cassiter.next())
for (cassette_image_device &cass : cassette_device_iterator(machine.root_device()))
{
cass->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
cass.change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
return 0;
}
}
@ -1939,25 +1932,24 @@ std::vector<ui_menu_item> ui_manager::slider_init(running_machine &machine)
// add CPU overclocking (cheat only)
if (machine.options().cheat())
{
execute_interface_iterator iter(machine.root_device());
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
{
void *param = (void *)&exec->device();
std::string str = string_format(_("Overclock CPU %1$s"), exec->device().tag());
void *param = (void *)&exec.device();
std::string str = string_format(_("Overclock CPU %1$s"), exec.device().tag());
sliders.push_back(slider_alloc(machine, str.c_str(), 10, 1000, 2000, 1, slider_overclock, param));
}
}
// add screen parameters
screen_device_iterator scriter(machine.root_device());
for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next())
for (screen_device &screen : scriter)
{
int defxscale = floor(screen->xscale() * 1000.0f + 0.5f);
int defyscale = floor(screen->yscale() * 1000.0f + 0.5f);
int defxoffset = floor(screen->xoffset() * 1000.0f + 0.5f);
int defyoffset = floor(screen->yoffset() * 1000.0f + 0.5f);
void *param = (void *)screen;
std::string screen_desc = slider_get_screen_desc(*screen);
int defxscale = floor(screen.xscale() * 1000.0f + 0.5f);
int defyscale = floor(screen.yscale() * 1000.0f + 0.5f);
int defxoffset = floor(screen.xoffset() * 1000.0f + 0.5f);
int defyoffset = floor(screen.yoffset() * 1000.0f + 0.5f);
void *param = (void *)&screen;
std::string screen_desc = slider_get_screen_desc(screen);
// add refresh rate tweaker
if (machine.options().cheat())
@ -1985,34 +1977,33 @@ std::vector<ui_menu_item> ui_manager::slider_init(running_machine &machine)
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_yoffset, param));
}
laserdisc_device_iterator lditer(machine.root_device());
for (laserdisc_device *laserdisc = lditer.first(); laserdisc != nullptr; laserdisc = lditer.next())
for (laserdisc_device &laserdisc : laserdisc_device_iterator(machine.root_device()))
{
if (laserdisc->overlay_configured())
if (laserdisc.overlay_configured())
{
laserdisc_overlay_config config;
laserdisc->get_overlay_config(config);
laserdisc.get_overlay_config(config);
int defxscale = floor(config.m_overscalex * 1000.0f + 0.5f);
int defyscale = floor(config.m_overscaley * 1000.0f + 0.5f);
int defxoffset = floor(config.m_overposx * 1000.0f + 0.5f);
int defyoffset = floor(config.m_overposy * 1000.0f + 0.5f);
void *param = (void *)laserdisc;
void *param = (void *)&laserdisc;
// add scale and offset controls per-overlay
std::string str = string_format(_("Laserdisc '%1$s' Horiz Stretch"), laserdisc->tag());
std::string str = string_format(_("Laserdisc '%1$s' Horiz Stretch"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param));
str = string_format(_("Laserdisc '%1$s' Horiz Position"), laserdisc->tag());
str = string_format(_("Laserdisc '%1$s' Horiz Position"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_overxoffset, param));
str = string_format(_("Laserdisc '%1$s' Vert Stretch"), laserdisc->tag());
str = string_format(_("Laserdisc '%1$s' Vert Stretch"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param));
str = string_format(_("Laserdisc '%1$s' Vert Position"), laserdisc->tag());
str = string_format(_("Laserdisc '%1$s' Vert Position"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_overyoffset, param));
}
}
for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next())
for (screen_device &screen : scriter)
{
if (screen->screen_type() == SCREEN_TYPE_VECTOR)
if (screen.screen_type() == SCREEN_TYPE_VECTOR)
{
// add vector control
sliders.push_back(slider_alloc(machine, _("Vector Flicker"), 0, 0, 1000, 10, slider_flicker, nullptr));
@ -2462,10 +2453,7 @@ static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, i
static std::string slider_get_screen_desc(screen_device &screen)
{
screen_device_iterator iter(screen.machine().root_device());
int scrcount = iter.count();
if (scrcount > 1)
if (screen_device_iterator(screen.machine().root_device()).count() > 1)
return string_format(_("Screen '%1$s'"), screen.tag());
else
return _("Screen");

View File

@ -159,7 +159,7 @@ struct ui_software_info
std::string publisher;
UINT8 supported = 0;
std::string part;
const game_driver *driver;
const game_driver *driver = nullptr;
std::string listname;
std::string interface;
std::string instance;

View File

@ -168,11 +168,8 @@ void ui_gfx_init(running_machine &machine)
static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
{
palette_device_iterator pal_iter(machine.root_device());
gfx_interface_iterator gfx_iter(machine.root_device());
// count the palette devices
state.palette.devcount = pal_iter.count();
state.palette.devcount = palette_device_iterator(machine.root_device()).count();
// set the pointer to the first palette
if (state.palette.devcount > 0)
@ -180,27 +177,20 @@ static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
// count the gfx devices
state.gfxset.devcount = 0;
int tempcount = gfx_iter.count();
// count the gfx sets in each device, skipping devices with none
if (tempcount > 0)
for (device_gfx_interface &interface : gfx_interface_iterator(machine.root_device()))
{
device_gfx_interface *interface;
int i, count;
// count the gfx sets in each device, skipping devices with none
int count = 0;
while (count < MAX_GFX_ELEMENTS && interface.gfx(count) != nullptr)
count++;
for (i = 0, interface = gfx_iter.first();
i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS;
i++, interface = gfx_iter.next())
// count = index of first NULL
if (count > 0)
{
for (count = 0; count < MAX_GFX_ELEMENTS && interface->gfx(count) != nullptr; count++) { }
// count = index of first NULL
if (count > 0)
{
state.gfxdev[state.gfxset.devcount].interface = interface;
state.gfxdev[state.gfxset.devcount].setcount = count;
state.gfxset.devcount++;
}
state.gfxdev[state.gfxset.devcount].interface = &interface;
state.gfxdev[state.gfxset.devcount].setcount = count;
if (++state.gfxset.devcount == MAX_GFX_DECODERS)
break;
}
}

View File

@ -570,11 +570,10 @@ void validity_checker::validate_driver()
void validity_checker::validate_roms()
{
// iterate, starting with the driver's ROMs and continuing with device ROMs
device_iterator deviter(m_current_config->root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
for (device_t &device : device_iterator(m_current_config->root_device()))
{
// track the current device
m_current_device = device;
m_current_device = &device;
// scan the ROM entries for this device
const char *last_region_name = "???";
@ -583,7 +582,7 @@ void validity_checker::validate_roms()
int items_since_region = 1;
int last_bios = 0;
int total_files = 0;
for (const rom_entry *romp = rom_first_region(*device); romp != nullptr && !ROMENTRY_ISEND(romp); romp++)
for (const rom_entry *romp = rom_first_region(device); romp != nullptr && !ROMENTRY_ISEND(romp); romp++)
{
// if this is a region, make sure it's valid, and record the length
if (ROMENTRY_ISREGION(romp))
@ -608,7 +607,7 @@ void validity_checker::validate_roms()
validate_tag(basetag);
// generate the full tag
std::string fulltag = rom_region_name(*device, romp);
std::string fulltag = rom_region_name(device, romp);
// attempt to add it to the map, reporting duplicates as errors
current_length = ROMREGION_GETLENGTH(romp);
@ -831,20 +830,19 @@ void validity_checker::validate_inputs()
std::unordered_set<std::string> port_map;
// iterate over devices
device_iterator iter(m_current_config->root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
for (device_t &device : device_iterator(m_current_config->root_device()))
{
// see if this device has ports; if not continue
if (device->input_ports() == nullptr)
if (device.input_ports() == nullptr)
continue;
// track the current device
m_current_device = device;
m_current_device = &device;
// allocate the input ports
ioport_list portlist;
std::string errorbuf;
portlist.append(*device, errorbuf);
portlist.append(device, errorbuf);
// report any errors during construction
if (!errorbuf.empty())
@ -904,12 +902,12 @@ void validity_checker::validate_inputs()
// verify conditions on the field
if (!field.condition().none())
validate_condition(field.condition(), *device, port_map);
validate_condition(field.condition(), device, port_map);
// verify conditions on the settings
for (ioport_setting &setting : field.settings())
if (!setting.condition().none())
validate_condition(setting.condition(), *device, port_map);
validate_condition(setting.condition(), device, port_map);
}
// done with this port
@ -931,32 +929,31 @@ void validity_checker::validate_devices()
{
std::unordered_set<std::string> device_map;
device_iterator iter_find(m_current_config->root_device());
for (const device_t *device = iter_find.first(); device != nullptr; device = iter_find.next())
for (device_t &device : device_iterator(m_current_config->root_device()))
{
// track the current device
m_current_device = device;
m_current_device = &device;
// validate auto-finders
device->findit(true);
device.findit(true);
// validate the device tag
validate_tag(device->basetag());
validate_tag(device.basetag());
// look for duplicates
if (!device_map.insert(device->tag()).second)
osd_printf_error("Multiple devices with the same tag '%s' defined\n", device->tag());
if (!device_map.insert(device.tag()).second)
osd_printf_error("Multiple devices with the same tag '%s' defined\n", device.tag());
// all devices must have a shortname
if (strcmp(device->shortname(), "") == 0)
if (strcmp(device.shortname(), "") == 0)
osd_printf_error("Device does not have short name defined\n");
// all devices must have a source file defined
if (strcmp(device->source(), "") == 0)
if (strcmp(device.source(), "") == 0)
osd_printf_error("Device does not have source file location defined\n");
// check for device-specific validity check
device->validity_check(*this);
device.validity_check(*this);
// done with this device
m_current_device = nullptr;
@ -964,24 +961,22 @@ void validity_checker::validate_devices()
// if device is slot cart device, we must have a shortname
std::unordered_set<std::string> slot_device_map;
slot_interface_iterator slotiter(m_current_config->root_device());
for (const device_slot_interface *slot = slotiter.first(); slot != nullptr; slot = slotiter.next())
for (const device_slot_interface &slot : slot_interface_iterator(m_current_config->root_device()))
{
for (const device_slot_option &option : slot->option_list())
for (const device_slot_option &option : slot.option_list())
{
std::string temptag("_");
temptag.append(option.name());
device_t *dev = const_cast<machine_config &>(*m_current_config).device_add(&m_current_config->root_device(), temptag.c_str(), option.devtype(), 0);
// notify this device and all its subdevices that they are now configured
device_iterator subiter(*dev);
for (device_t *device = subiter.first(); device != nullptr; device = subiter.next())
if (!device->configured())
device->config_complete();
for (device_t &device : device_iterator(*dev))
if (!device.configured())
device.config_complete();
if (strcmp(dev->shortname(), "") == 0) {
if (slot_device_map.insert(dev->name()).second)
osd_printf_error("Device '%s' is slot cart device but does not have short name defined\n",dev->name());
osd_printf_error("Device '%s' is slot cart device but does not have short name defined\n", dev->name());
}
const_cast<machine_config &>(*m_current_config).device_remove(&m_current_config->root_device(), temptag.c_str());

View File

@ -292,9 +292,8 @@ std::string video_manager::speed_text()
// display the number of partial updates as well
int partials = 0;
screen_device_iterator iter(machine().root_device());
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
partials += screen->partial_updates();
for (screen_device &screen : screen_device_iterator(machine().root_device()))
partials += screen.partial_updates();
if (partials > 1)
util::stream_format(str, "\n%d partial updates", partials);
@ -345,14 +344,13 @@ void video_manager::save_active_screen_snapshots()
if (m_snap_native)
{
// write one snapshot per visible screen
screen_device_iterator iter(machine().root_device());
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
if (machine().render().is_live(*screen))
for (screen_device &screen : screen_device_iterator(machine().root_device()))
if (machine().render().is_live(screen))
{
emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
osd_file::error filerr = open_next(file, "png");
if (filerr == osd_file::error::NONE)
save_snapshot(screen, file);
save_snapshot(&screen, file);
}
}
@ -699,14 +697,14 @@ bool video_manager::finish_screen_updates()
// finish updating the screens
screen_device_iterator iter(machine().root_device());
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
screen->update_partial(screen->visible_area().max_y);
for (screen_device &screen : iter)
screen.update_partial(screen.visible_area().max_y);
// now add the quads for all the screens
bool anything_changed = m_output_changed;
m_output_changed = false;
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
if (screen->update_quads())
for (screen_device &screen : iter)
if (screen.update_quads())
anything_changed = true;
// draw HUD from LUA callback (if any)
@ -718,13 +716,13 @@ bool video_manager::finish_screen_updates()
record_frame();
// iterate over screens and update the burnin for the ones that care
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
screen->update_burnin();
for (screen_device &screen : iter)
screen.update_burnin();
}
// draw any crosshairs
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
machine().crosshair().render(*screen);
for (screen_device &screen : iter)
machine().crosshair().render(screen);
return anything_changed;
}
@ -1008,10 +1006,9 @@ void video_manager::update_refresh_speed()
// find the screen with the shortest frame period (max refresh rate)
// note that we first check the token since this can get called before all screens are created
attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND;
screen_device_iterator iter(machine().root_device());
for (screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
for (screen_device &screen : screen_device_iterator(machine().root_device()))
{
attoseconds_t period = screen->frame_period().attoseconds();
attoseconds_t period = screen.frame_period().attoseconds();
if (period != 0)
min_frame_period = MIN(min_frame_period, period);
}
@ -1202,19 +1199,18 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension)
//printf("check template: %s\n", snapdevname.c_str());
// verify that there is such a device for this system
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{
// get the device name
std::string tempdevname(image->brief_instance_name());
std::string tempdevname(image.brief_instance_name());
//printf("check device: %s\n", tempdevname.c_str());
if (snapdevname.compare(tempdevname) == 0)
{
// verify that such a device has an image mounted
if (image->basename() != nullptr)
if (image.basename() != nullptr)
{
std::string filename(image->basename());
std::string filename(image.basename());
// strip extension
filename = filename.substr(0, filename.find_last_of('.'));

View File

@ -626,7 +626,7 @@ DRIVER_INIT_MEMBER(crospang_state,crospang)
tumblepb_gfx1_rearrange();
}
GAME( 1998, crospang, 0, crospang, crospang, crospang_state, crospang, ROT0, "F2 System", "Cross Pang", MACHINE_SUPPORTS_SAVE )
GAME( 199?, heuksun, 0, crospang, heuksun, crospang_state, crospang, ROT0, "Oksan / F2 System", "Heuk Sun Baek Sa (Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1998, bestri, 0, bestri, bestri, crospang_state, crospang, ROT0, "F2 System", "Bestri (Korea, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1998, bestria, 0, bestria, bestri, crospang_state, crospang, ROT0, "F2 System", "Bestri (Korea, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1998, crospang, 0, crospang, crospang, crospang_state, crospang, ROT0, "F2 System", "Cross Pang", MACHINE_SUPPORTS_SAVE )
GAME( 199?, heuksun, 0, crospang, heuksun, crospang_state, crospang, ROT0, "Oksan / F2 System", "Heuk Sun Baek Sa (Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1998, bestri, 0, bestri, bestri, crospang_state, crospang, ROT0, "F2 System", "Bestri (Korea, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1998, bestria, bestri, bestria, bestri, crospang_state, crospang, ROT0, "F2 System", "Bestri (Korea, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )

View File

@ -4964,7 +4964,8 @@ MACHINE_CONFIG_END
known releases:
- World: Copy Cat
- USA: Follow Me, distributed by Sears
- USA(1): Follow Me, distributed by Sears
- USA(2): Electronic Repeat, distributed by Tandy
***************************************************************************/
@ -5031,7 +5032,7 @@ static INPUT_PORTS_START( copycat )
PORT_START("IN.3") // R7
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Best Play")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Play")
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Replay")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
@ -5041,7 +5042,7 @@ static const INT16 copycat_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 };
static MACHINE_CONFIG_START( copycat, copycat_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=47K, C=47pf
MCFG_CPU_ADD("maincpu", TMS1000, 320000) // approximation - RC osc. R=47K, C=47pf
MCFG_TMS1XXX_READ_K_CB(READ8(copycat_state, read_k))
MCFG_TMS1XXX_WRITE_R_CB(WRITE16(copycat_state, write_r))
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(copycat_state, write_o))
@ -5085,14 +5086,16 @@ public:
WRITE16_MEMBER(copycatm2_state::write_r)
{
// R0-R3: leds
display_matrix(4, 1, data & 0xf, 1);
display_matrix(9, 1, data, 1);
}
WRITE16_MEMBER(copycatm2_state::write_o)
{
// O0,O1: speaker out
// others: N/C
m_speaker->level_w(data & 3);
//m_speaker->level_w(data & 3);
popmessage("O = %02x", data);
}
@ -5115,7 +5118,7 @@ static MACHINE_CONFIG_START( copycatm2, copycatm2_state )
MCFG_TMS1XXX_WRITE_O_CB(WRITE16(copycatm2_state, write_o))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
MCFG_DEFAULT_LAYOUT(layout_copycat)
MCFG_DEFAULT_LAYOUT(layout_hh_tms1k_test)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -5979,7 +5982,7 @@ CONS( 1982, lostreas, 0, 0, lostreas, lostreas, driver_device, 0, "Par
CONS( 1981, tandy12, 0, 0, tandy12, tandy12, driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // some of the minigames: ***
CONS( 1979, copycat, 0, 0, copycat, copycat, driver_device, 0, "Tiger Electronics", "Copy Cat (model 7-520)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
CONS( 1989, copycatm2, copycat, 0, copycatm2, copycatm2, driver_device, 0, "Tiger Electronics", "Copy Cat (model 7-522)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_NOT_WORKING )
CONS( 1989, copycatm2, copycat, 0, copycatm2, copycatm2, driver_device, 0, "Tiger Electronics", "Copy Cat (model 7-522)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
CONS( 1979, tbreakup, 0, 0, tbreakup, tbreakup, driver_device, 0, "Tomy", "Break Up (Tomy)", MACHINE_SUPPORTS_SAVE )
CONS( 1980, phpball, 0, 0, phpball, phpball, driver_device, 0, "Tomy", "Power House Pinball", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )

View File

@ -3705,6 +3705,33 @@ ROM_START( gowcaizr )
ROM_LOAD16_BYTE( "094-c8.c8", 0xc00001, 0x200000, CRC(d80dd241) SHA1(1356a64e4d4e271f62cd0d83f79ee9c906440810) ) /* Plane 2,3 */ /* TC5316200 */
ROM_END
/****************************************
dev board, same ID as gowcaizr
****************************************/
ROM_START( dragonsh )
ROM_REGION( 0x100000, "maincpu", 0 )
ROM_LOAD16_BYTE( "EP2.bin", 0x000000, 0x080000, CRC(f25c71ad) SHA1(803fb6cd6a7ada59678ad901ff9788b1e54ddd0c) )
ROM_LOAD16_BYTE( "EP1.bin", 0x000001, 0x080000, CRC(f353448c) SHA1(f0f966ca15d503e01b40e901765ff0888463b65d) )
NEO_SFIX_128K( "s1.s1", BAD_DUMP CRC(706477a7) SHA1(8cbee7f6832e7edd2dc792ca330420a6a984b879) ) // was a dead AXS512PC 512KB sram card, this data is handcrafted to make the set usable (hence BAD_DUMP)
NEOGEO_BIOS
ROM_REGION( 0x20000, "audiobios", 0 )
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
ROM_REGION( 0x30000, "audiocpu", ROMREGION_ERASEFF )
/* not present */
ROM_REGION( 0x200000, "ymsnd", ROMREGION_ERASE00 )
ROM_LOAD( "sram.v1", 0x000000, 0x200000, NO_DUMP ) // was a dead AXS2000PC 2MB sram card, battery dead, data lost.
NO_DELTAT_REGION
ROM_REGION( 0x2000000, "sprites", 0 )
ROM_LOAD16_BYTE( "no3.bin", 0x000000, 0x1000000, CRC(81821826) SHA1(b7c1a53e32633383675206a16c68f6f2ff984865) )
ROM_LOAD16_BYTE( "no4.bin", 0x000001, 0x1000000, CRC(3601d568) SHA1(800323e52f5d33b402f84d31850b42c688082d67) )
ROM_END
/****************************************
ID-0095
. NGM-095
@ -7459,29 +7486,6 @@ ROM_END
ROM_START( unkneo )
ROM_REGION( 0x100000, "maincpu", 0 )
ROM_LOAD16_BYTE( "EP1.bin", 0x000001, 0x080000, CRC(f353448c) SHA1(f0f966ca15d503e01b40e901765ff0888463b65d) )
ROM_LOAD16_BYTE( "EP2.bin", 0x000000, 0x080000, CRC(f25c71ad) SHA1(803fb6cd6a7ada59678ad901ff9788b1e54ddd0c) )
NEO_SFIX_128K( "s1.s1", CRC(706477a7) SHA1(8cbee7f6832e7edd2dc792ca330420a6a984b879) ) // was a dead AXS512PC 512KB sram card, this data is handcrafted to make the set usable (hence BAD_DUMP)
NEOGEO_BIOS
ROM_REGION( 0x20000, "audiobios", 0 )
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
ROM_REGION( 0x30000, "audiocpu", ROMREGION_ERASE00 )
/* not present */
ROM_REGION( 0x400000, "ymsnd", 0 )
ROM_LOAD( "sram.v1", 0x000000, 0x200000, NO_DUMP ) // was a dead AXS2000PC 2MB sram card, battery dead, data lost.
NO_DELTAT_REGION
ROM_REGION( 0x2000000, "sprites", 0 )
ROM_LOAD16_BYTE( "no3.bin", 0x000000, 0x1000000, CRC(81821826) SHA1(b7c1a53e32633383675206a16c68f6f2ff984865) )
ROM_LOAD16_BYTE( "no4.bin", 0x000001, 0x1000000, CRC(3601d568) SHA1(800323e52f5d33b402f84d31850b42c688082d67) )
ROM_END
/*************************************
*
* Bootleg sets
@ -9786,6 +9790,7 @@ GAME( 2001, nitdbl, nitd, neogeo_noslot, neogeo, neogeo_state, neoge
/* Face */
GAME( 1994, gururin, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Face", "Gururin", MACHINE_SUPPORTS_SAVE )
GAME( 1997, miexchng, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Face", "Money Puzzle Exchanger / Money Idol Exchanger", MACHINE_SUPPORTS_SAVE )
GAME( 1997, dragonsh, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Face", "Dragon's Heaven (development board)", MACHINE_IS_INCOMPLETE | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // same ID code as Voltage Fighter Gowkaizer, developed by ex-Technos staff
/* Hudson Soft */
GAME( 1994, panicbom, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Eighting / Hudson", "Panic Bomber", MACHINE_SUPPORTS_SAVE )
@ -9812,8 +9817,8 @@ GAME( 1995, quizkofk, quizkof, neogeo_noslot, neogeo, neogeo_state, neoge
GAME( 1995, stakwin, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Stakes Winner / Stakes Winner - GI kinzen seiha e no michi", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ragnagrd, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Ragnagard / Shin-Oh-Ken", MACHINE_SUPPORTS_SAVE )
GAME( 1996, pgoal, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Pleasure Goal / Futsal - 5 on 5 Mini Soccer (NGM-219)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ironclad, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Choutetsu Brikin'ger - Iron clad (Prototype)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ironclado, ironclad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "bootleg", "Choutetsu Brikin'ger - Iron clad (Prototype, bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ironclad, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Choutetsu Brikin'ger - Iron clad (prototype)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ironclado, ironclad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "bootleg", "Choutetsu Brikin'ger - Iron clad (prototype, bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, stakwin2, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Stakes Winner 2", MACHINE_SUPPORTS_SAVE )
GAME( 1997, shocktro, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Shock Troopers (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1997, shocktroa, shocktro, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Saurus", "Shock Troopers (set 2)", MACHINE_SUPPORTS_SAVE )
@ -9837,8 +9842,6 @@ GAME( 1995, marukodq, neogeo, neogeo_noslot, neogeo, neogeo_state, neoge
GAME( 1995, doubledr, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan", "Double Dragon (Neo-Geo)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, gowcaizr, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan", "Voltage Fighter - Gowcaizer / Choujin Gakuen Gowcaizer", MACHINE_SUPPORTS_SAVE )
GAME( 1996, sdodgeb, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan", "Super Dodge Ball / Kunio no Nekketsu Toukyuu Densetsu", MACHINE_SUPPORTS_SAVE )
GAME( 199?, unkneo, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan?", "Unknown Neo-Geo Vs. Fighter (prototype)", MACHINE_SUPPORTS_SAVE ) // same ID code as Voltage Fighter Gowkaizer so probably by Technos
/* Tecmo */
GAME( 1996, tws96, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Tecmo", "Tecmo World Soccer '96", MACHINE_SUPPORTS_SAVE )

View File

@ -4633,7 +4633,7 @@ GAME( 2002, ket, 0, pgm_arm_type1_cave, pgm, pgm_arm_type1_s
GAME( 2002, ket1, ket, pgm_arm_type1_cave, pgm, pgm_arm_type1_state, ket, ROT270, "Cave (AMI license)", "Ketsui: Kizuna Jigoku Tachi (2003/01/01. Master Ver.) (alt rom fill)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 2002, keta, ket, pgm_arm_type1_cave, pgm, pgm_arm_type1_state, ket, ROT270, "Cave (AMI license)", "Ketsui: Kizuna Jigoku Tachi (2003/01/01 Master Ver.)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 2002, ketb, ket, pgm_arm_type1_cave, pgm, pgm_arm_type1_state, ket, ROT270, "Cave (AMI license)", "Ketsui: Kizuna Jigoku Tachi (2003/01/01 Master Ver)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 2001, ketbl, ket, pgm_arm_type2, pgm, pgm_arm_type2_state, ddp2, ROT270, "bootleg", "Ketsui: Kizuna Jigoku Tachi (2003/01/01. Master Ver., bootleg cartridge conversion)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 2002, ketbl, ket, pgm_arm_type2, pgm, pgm_arm_type2_state, ddp2, ROT270, "bootleg", "Ketsui: Kizuna Jigoku Tachi (2003/01/01. Master Ver., bootleg cartridge conversion)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
// these are modern hacks, some of them have been seen on original PCBs, also reportedly on a bootleg PCB with mostly original components but the ARM replaced with a custom chip.
@ -4656,13 +4656,13 @@ GAME( 2012, ketarrf, ket, pgm_arm_type1_cave, pgm, pgm_arm_type1_s
GAME( 2003, espgal, 0, pgm_arm_type1_cave, pgm, pgm_arm_type1_state, espgal, ROT270, "Cave (AMI license)", "Espgaluda (2003/10/15 Master Ver)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 2001, espgalbl, espgal, pgm_arm_type2, pgm, pgm_arm_type2_state, ddp2, ROT270, "bootleg", "Espgaluda (2003/10/15 Master Ver, bootleg cartridge conversion)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 2003, espgalbl, espgal, pgm_arm_type2, pgm, pgm_arm_type2_state, ddp2, ROT270, "bootleg", "Espgaluda (2003/10/15 Master Ver, bootleg cartridge conversion)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
// protection simulated, but should be correct
GAME( 1999, puzzli2, pgm, pgm_arm_type1_sim, puzzli2, pgm_arm_type1_state, puzzli2, ROT0, "IGS", "Puzzli 2 (ver. 100)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // ROM label is V100 ( V0001, 11/22/99 09:27:58 in program ROM )
GAME( 2001, puzzli2s, puzzli2, pgm_arm_type1_sim, puzzli2, pgm_arm_type1_state, puzzli2, ROT0, "IGS", "Puzzli 2 Super (ver. 200)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // ( V200, 12/28/01 12:53:34 in program ROM )
GAME( 2005, killbldp, pgm, pgm_arm_type3, pgm, pgm_arm_type3_state, killbldp, ROT0, "IGS", "The Killing Blade Plus (China, ver. 300)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) /* using internal rom from bootleg */
GAME( 2005, killbldp, pgm, pgm_arm_type3, pgm, pgm_arm_type3_state, killbldp, ROT0, "IGS", "The Killing Blade Plus (China, ver. 300)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) /* using internal rom from bootleg */
// we're using a partial dump of the internal rom (sans the execute only area) with handcrafted startup code..
// all 3 68k roms still have V100 strings, but are clearly different builds, there don't appear to be build string dates in them. Two of the external ARM roms are marked V100 but are different builds, the single PCB v100 appears to be a later revision than the cart V100 as it shares the internal ROM with the V107 cart version, the v100 cart has a different internal ROM

View File

@ -35,7 +35,7 @@
switch between them.
* There existed a vertical version of Head On as well.
* According to the manuals, Borderline has the same sound
board as Tranquilizer Gun.
board as Tranquillizer Gun.
Known issues/to-do's:
* Analog sound missing in many games
@ -3627,7 +3627,7 @@ GAME( 1980, samurai, 0, samurai, samurai, driver_device, 0, ROT270
GAME( 1979, invinco, 0, invinco, invinco, driver_device, 0, ROT270, "Sega", "Invinco", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1979, invds, 0, invds, invds, driver_device, 0, ROT270, "Sega", "Invinco / Deep Scan", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1979, carhntds, 0, carhntds, carhntds, driver_device, 0, ROT270, "Sega", "Car Hunt / Deep Scan (France)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1980, tranqgun, 0, tranqgun, tranqgun, driver_device, 0, ROT270, "Sega", "Tranquilizer Gun", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1980, tranqgun, 0, tranqgun, tranqgun, driver_device, 0, ROT270, "Sega", "Tranquillizer Gun", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1980, spacetrk, 0, spacetrk, spacetrk, driver_device, 0, ROT270, "Sega", "Space Trek (upright)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1980, spacetrkc, spacetrk, spacetrk, spacetrkc, driver_device, 0, ROT270, "Sega", "Space Trek (cocktail)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1980, carnival, 0, carnival, carnival, driver_device, 0, ROT270, "Sega", "Carnival (upright)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
@ -3638,7 +3638,7 @@ GAME( 1981, brdrline, 0, brdrline, brdrline, driver_device, 0, ROT270
GAME( 1981, starrkr, brdrline, brdrline, starrkr, driver_device, 0, ROT270, "Sega", "Star Raker", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, brdrlins, brdrline, brdrline, brdrline, driver_device, 0, ROT270, "bootleg (Sidam)", "Borderline (Sidam bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, brdrlinb, brdrline, brdrline, brdrline, driver_device, 0, ROT270, "bootleg (Karateco)", "Borderline (Karateco bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, brdrlinet, brdrline, tranqgun, tranqgun, driver_device, 0, ROT270, "Sega", "Borderline (Tranquilizer Gun conversion)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // official factory conversion
GAME( 1981, brdrlinet, brdrline, tranqgun, tranqgun, driver_device, 0, ROT270, "Sega", "Borderline (Tranquillizer Gun conversion)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // official factory conversion
GAME( 198?, startrks, 0, headons, headons, driver_device, 0, ROT0, "bootleg (Sidam)", "Star Trek (Head On hardware)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1980, digger, 0, digger, digger, driver_device, 0, ROT270, "Sega", "Digger", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, pulsar, 0, pulsar, pulsar, driver_device, 0, ROT270, "Sega", "Pulsar", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )

View File

@ -3,6 +3,48 @@
<!-- define elements -->
<element name="static_black"><rect><color red="0" green="0" blue="0" /></rect></element>
<element name="static_white"><rect><color red="0.9" green="0.89" blue="0.8" /></rect></element>
<element name="static_red"><rect><color red="0.9" green="0.3" blue="0.3" /></rect></element>
<element name="static_green"><rect><color red="0.3" green="0.9" blue="0.3" /></rect></element>
<element name="static_yellow"><rect><color red="0.9" green="0.9" blue="0.3" /></rect></element>
<element name="static_orange"><rect><color red="0.9" green="0.6" blue="0.3" /></rect></element>
<element name="text_b1"><text string="REPLAY"><color red="0.9" green="0.89" blue="0.8" /></text></element>
<element name="text_b2"><text string="PLAY"><color red="0.9" green="0.89" blue="0.8" /></text></element>
<element name="text_b3"><text string="BEST PLAY"><color red="0.9" green="0.89" blue="0.8" /></text></element>
<element name="hlh" defstate="0">
<text string=" ">
<bounds x="0.0" y="0.0" width="2.0" height="1.0" />
<color red="0.0" green="0.0" blue="0.0" />
</text>
<disk state="1">
<bounds x="0.57" y="0.07" width="0.86" height="0.86" />
<color red="0.0" green="0.0" blue="0.0" />
</disk>
</element>
<element name="hlv" defstate="0">
<text string=" ">
<bounds x="0.0" y="0.0" width="1.0" height="2.0" />
<color red="0.0" green="0.0" blue="0.0" />
</text>
<disk state="1">
<bounds x="0.07" y="0.57" width="0.86" height="0.86" />
<color red="0.0" green="0.0" blue="0.0" />
</disk>
</element>
<element name="hlb" defstate="0">
<text string=" ">
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
<color red="0.0" green="0.0" blue="0.0" />
</text>
<rect state="1">
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element>
<element name="ledr" defstate="0">
<disk state="0"><color red="0.2" green="0.04" blue="0.04" /></disk>
<disk state="1"><color red="1.0" green="0.2" blue="0.2" /></disk>
@ -24,12 +66,43 @@
<!-- build screen -->
<view name="Internal Layout">
<bounds left="0" right="100" top="0" bottom="100" />
<bounds left="0" right="12" top="0" bottom="12" />
<bezel element="static_white">
<bounds left="-1" right="13" top="-1" bottom="13" />
</bezel>
<bezel name="0.0" element="ledg"><bounds x="1" y="1" width="1" height="1" /></bezel>
<bezel name="0.1" element="ledr"><bounds x="3" y="1" width="1" height="1" /></bezel>
<bezel name="0.2" element="ledo"><bounds x="5" y="1" width="1" height="1" /></bezel>
<bezel name="0.3" element="ledy"><bounds x="7" y="1" width="1" height="1" /></bezel>
<!-- middle part -->
<bezel element="static_black"><bounds x="4" y="4" width="4" height="4" /></bezel>
<bezel element="static_yellow"><bounds x="4.5625" y="6" width="0.5" height="0.5" /></bezel>
<bezel element="static_green"><bounds x="5.625" y="5.875" width="0.75" height="0.75" /></bezel>
<bezel element="static_yellow"><bounds x="6.9375" y="6" width="0.5" height="0.5" /></bezel>
<bezel element="hlb" inputtag="IN.3" inputmask="0x04"><bounds x="4.5625" y="6" width="0.5" height="0.5" /><color alpha="0.25" /></bezel>
<bezel element="hlb" inputtag="IN.3" inputmask="0x02"><bounds x="5.625" y="5.875" width="0.75" height="0.75" /><color alpha="0.25" /></bezel>
<bezel element="hlb" inputtag="IN.3" inputmask="0x01"><bounds x="6.9375" y="6" width="0.5" height="0.5" /><color alpha="0.25" /></bezel>
<bezel element="text_b1"><bounds x="4.0625" y="6.75" width="1.5" height="0.25" /></bezel>
<bezel element="text_b2"><bounds x="5.125" y="6.75" width="1.75" height="0.25" /></bezel>
<bezel element="text_b3"><bounds x="6.2375" y="6.75" width="1.9" height="0.25" /></bezel>
<!-- main buttons and leds -->
<bezel element="static_red"><bounds x="1" y="4" width="2" height="4" /></bezel>
<bezel element="static_yellow"><bounds x="4" y="1" width="4" height="2" /></bezel>
<bezel element="static_orange"><bounds x="9" y="4" width="2" height="4" /></bezel>
<bezel element="static_green"><bounds x="4" y="9" width="4" height="2" /></bezel>
<bezel element="hlv" inputtag="IN.0" inputmask="0x02"><bounds x="1" y="4" width="2" height="4" /><color alpha="0.15" /></bezel>
<bezel element="hlh" inputtag="IN.0" inputmask="0x08"><bounds x="4" y="1" width="4" height="2" /><color alpha="0.15" /></bezel>
<bezel element="hlv" inputtag="IN.0" inputmask="0x04"><bounds x="9" y="4" width="2" height="4" /><color alpha="0.15" /></bezel>
<bezel element="hlh" inputtag="IN.0" inputmask="0x01"><bounds x="4" y="9" width="4" height="2" /><color alpha="0.15" /></bezel>
<bezel name="0.0" element="ledg"><bounds x="5.75" y="8.25" width="0.5" height="0.5" /></bezel>
<bezel name="0.1" element="ledr"><bounds x="3.25" y="5.75" width="0.5" height="0.5" /></bezel>
<bezel name="0.2" element="ledo"><bounds x="8.25" y="5.75" width="0.5" height="0.5" /></bezel>
<bezel name="0.3" element="ledy"><bounds x="5.75" y="3.25" width="0.5" height="0.5" /></bezel>
</view>
</mamelayout>

View File

@ -970,17 +970,15 @@ atarigen_state::atarigen_state(const machine_config &mconfig, device_type type,
void atarigen_state::machine_start()
{
screen_device *screen;
int i;
// allocate timers for all screens
screen_device_iterator iter(*this);
assert(iter.count() <= ARRAY_LENGTH(m_screen_timer));
for (i = 0, screen = iter.first(); screen != nullptr; i++, screen = iter.next())
int i = 0;
for (screen_device &screen : screen_device_iterator(*this))
{
m_screen_timer[i].screen = screen;
m_screen_timer[i].scanline_interrupt_timer = timer_alloc(TID_SCANLINE_INTERRUPT, (void *)screen);
m_screen_timer[i].scanline_timer = timer_alloc(TID_SCANLINE_TIMER, (void *)screen);
assert(i <= ARRAY_LENGTH(m_screen_timer));
m_screen_timer[i].screen = &screen;
m_screen_timer[i].scanline_interrupt_timer = timer_alloc(TID_SCANLINE_INTERRUPT, (void *)&screen);
m_screen_timer[i].scanline_timer = timer_alloc(TID_SCANLINE_TIMER, (void *)&screen);
i++;
}
save_item(NAME(m_scanline_int_state));

View File

@ -28316,6 +28316,7 @@ ctomaday // 0249 (c) 1999 Visco
cyberlip // 0010 (c) 1990 SNK
diggerma // No Game ID (unlicensed), (c) 2000 Kyle Hodgetts, prototype
doubledr // 0082 (c) 1995 Technos
dragonsh // same ID as gowcaizr, dev board
eightman // 0025 (c) 1991 SNK / Pallas
fatfursp // 0058 (c) 1993 SNK
fatfurspa // 0058 (c) 1993 SNK
@ -28336,7 +28337,6 @@ garoup // 0253 (c) 1999 SNK
ghostlop // 0228 GhostLop (prototype) 1996? Data East
goalx3 // 0209 (c) 1995 Visco
gowcaizr // 0094 (c) 1995 Technos
unkneo // prototype
gpilots // 0020 (c) 1991 SNK
gpilotsh // 0020 (c) 1991 SNK
gururin // 0067 (c) 1994 Face

View File

@ -130,12 +130,9 @@ VIDEO_START_MEMBER(cyberbal_state,cyberbal2p)
void cyberbal_state::scanline_update(screen_device &screen, int scanline)
{
int i;
screen_device *update_screen;
/* loop over screens */
screen_device_iterator iter(*this);
for (i = 0, update_screen = iter.first(); update_screen != nullptr; i++, update_screen = iter.next())
int i = 0;
for (screen_device &update_screen : screen_device_iterator(*this))
{
/* need explicit target() because one is optional_device and other is required_device */
tilemap_t *curplayfield = i ? m_playfield2_tilemap.target() : m_playfield_tilemap.target();
@ -155,7 +152,7 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
if (((word >> 1) & 7) != m_playfield_palette_bank[i])
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
update_screen.update_partial(scanline - 1);
m_playfield_palette_bank[i] = (word >> 1) & 7;
curplayfield->set_palette_offset(m_playfield_palette_bank[i] << 8);
}
@ -167,7 +164,7 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
if (newscroll != m_playfield_xscroll[i])
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
update_screen.update_partial(scanline - 1);
curplayfield->set_scrollx(0, newscroll);
m_playfield_xscroll[i] = newscroll;
}
@ -180,7 +177,7 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
if (newscroll != m_playfield_yscroll[i])
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
update_screen.update_partial(scanline - 1);
curplayfield->set_scrolly(0, newscroll);
m_playfield_yscroll[i] = newscroll;
}
@ -191,10 +188,11 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
if (m_current_slip[i] != word)
{
if (scanline > 0)
update_screen->update_partial(scanline - 1);
update_screen.update_partial(scanline - 1);
m_current_slip[i] = word;
}
}
i++;
}
}

View File

@ -91,14 +91,7 @@ int DevicesWindowModel::rowCount(const QModelIndex &parent) const
return 1;
device_t *dparent = static_cast<device_t *>(parent.internalPointer());
int count = 0;
for (device_t &child : dparent->subdevices())
{
(void)child;
count++;
}
return count;
return dparent->subdevices().count();
}
int DevicesWindowModel::columnCount(const QModelIndex &parent) const

View File

@ -469,13 +469,12 @@ void MainWindow::createImagesMenu()
QMenu* imagesMenu = menuBar()->addMenu("&Images");
int interfaceIndex = 0;
image_interface_iterator iter(m_machine->root_device());
for (device_image_interface *img = iter.first(); img != NULL; img = iter.next())
for (device_image_interface &img : image_interface_iterator(m_machine->root_device()))
{
std::string menuName = string_format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]");
std::string menuName = string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[empty slot]");
QMenu* interfaceMenu = imagesMenu->addMenu(menuName.c_str());
interfaceMenu->setObjectName(img->device().name());
interfaceMenu->setObjectName(img.device().name());
QAction* mountAct = new QAction("Mount...", interfaceMenu);
QAction* unmountAct = new QAction("Unmount", interfaceMenu);
@ -486,7 +485,7 @@ void MainWindow::createImagesMenu()
connect(mountAct, &QAction::triggered, this, &MainWindow::mountImage);
connect(unmountAct, &QAction::triggered, this, &MainWindow::unmountImage);
if (!img->exists())
if (!img.exists())
unmountAct->setEnabled(false);
interfaceMenu->addAction(mountAct);

View File

@ -37,13 +37,12 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) :
{
// Add image menu only if image devices exist
image_interface_iterator iter(machine().root_device());
device_image_interface *img = iter.first();
if (img != NULL)
if (iter.first() != nullptr)
{
m_devices_menu = CreatePopupMenu();
for ( ; img != NULL; img = iter.next())
for (device_image_interface &img : iter)
{
TCHAR *tc_buf = tstring_from_utf8(string_format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[no image]").c_str());
TCHAR *tc_buf = tstring_from_utf8(string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[no image]").c_str());
if (tc_buf != NULL)
{
AppendMenu(m_devices_menu, MF_ENABLED, 0, tc_buf);
@ -163,32 +162,30 @@ void consolewin_info::update_menu()
if (m_devices_menu != NULL)
{
// create the image menu
image_interface_iterator iter(machine().root_device());
device_image_interface *img;
UINT32 cnt;
for (img = iter.first(), cnt = 0; img != NULL; img = iter.next(), cnt++)
UINT32 cnt = 0;
for (device_image_interface &img : image_interface_iterator(machine().root_device()))
{
HMENU const devicesubmenu = CreatePopupMenu();
UINT_PTR const new_item = ID_DEVICE_OPTIONS + (cnt * DEVOPTION_MAX);
UINT flags_for_exists = MF_ENABLED | MF_STRING;
if (!img->exists())
if (!img.exists())
flags_for_exists |= MF_GRAYED;
UINT flags_for_writing = flags_for_exists;
if (img->is_readonly())
if (img.is_readonly())
flags_for_writing |= MF_GRAYED;
AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_OPEN, TEXT("Mount..."));
//if (img->is_creatable())
//if (img.is_creatable())
//AppendMenu(devicesubmenu, MF_STRING, new_item + DEVOPTION_CREATE, TEXT("Create..."));
AppendMenu(devicesubmenu, flags_for_exists, new_item + DEVOPTION_CLOSE, TEXT("Unmount"));
if (img->device().type() == CASSETTE)
if (img.device().type() == CASSETTE)
{
cassette_state const state = (cassette_state)(img->exists() ? (downcast<cassette_image_device *>(&img->device())->get_state() & CASSETTE_MASK_UISTATE) : CASSETTE_STOPPED);
cassette_state const state = (cassette_state)(img.exists() ? (downcast<cassette_image_device *>(&img.device())->get_state() & CASSETTE_MASK_UISTATE) : CASSETTE_STOPPED);
AppendMenu(devicesubmenu, MF_SEPARATOR, 0, NULL);
AppendMenu(devicesubmenu, flags_for_exists | ((state == CASSETTE_STOPPED) ? MF_CHECKED : 0), new_item + DEVOPTION_CASSETTE_STOPPAUSE, TEXT("Pause/Stop"));
AppendMenu(devicesubmenu, flags_for_exists | ((state == CASSETTE_PLAY) ? MF_CHECKED : 0), new_item + DEVOPTION_CASSETTE_PLAY, TEXT("Play"));
@ -197,12 +194,14 @@ void consolewin_info::update_menu()
AppendMenu(devicesubmenu, flags_for_exists, new_item + DEVOPTION_CASSETTE_FASTFORWARD, TEXT("Fast Forward"));
}
TCHAR *tc_buf = tstring_from_utf8(string_format("%s :%s", img->device().name(), img->exists() ? img->filename() : "[empty slot]").c_str());
TCHAR *tc_buf = tstring_from_utf8(string_format("%s :%s", img.device().name(), img.exists() ? img.filename() : "[empty slot]").c_str());
if (tc_buf != NULL)
{
ModifyMenu(m_devices_menu, cnt, MF_BYPOSITION | MF_POPUP, (UINT_PTR)devicesubmenu, tc_buf);
osd_free(tc_buf);
}
cnt++;
}
}
}

View File

@ -113,7 +113,6 @@ public:
class sdl_window_info;
// REVIEW: Do we need to handle SDLMAME_EVENTS_IN_WORKER_THREAD eventually?
class sdl_event_manager : public event_manager_t<sdl_event_subscriber>
{
private:

View File

@ -154,7 +154,7 @@ const options_entry osd_options::s_option_entries[] =
};
osd_options::osd_options()
: cli_options()
: emu_options()
{
add_entries(osd_options::s_option_entries);
}

View File

@ -23,7 +23,7 @@
#include "modules/netdev/netdev_module.h"
#include "modules/midi/midi_module.h"
#include "modules/output/output_module.h"
#include "cliopts.h"
#include "emuopts.h"
class ui_menu_item;
@ -90,7 +90,7 @@ class ui_menu_item;
// TYPE DEFINITIONS
//============================================================
class osd_options : public cli_options
class osd_options : public emu_options
{
public:
// construction/destruction

View File

@ -1376,11 +1376,7 @@ int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly,
int next_index = source_index;
screen_device_iterator screen_iterator(machine->root_device());
screen_device *screen = screen_iterator.first();
for (int i = 0; i < curr_screen; i++)
{
screen = screen_iterator.next();
}
screen_device *screen = screen_iterator.byindex(curr_screen);
render_container &screen_container = screen->container();
float xscale = screen_container.xscale();

View File

@ -16,7 +16,6 @@
#include "emucore.h"
#include "osdcore.h"
#include "unicode.h"
#include "cliopts.h"
#include "ui/menu.h"
#include <memory>

View File

@ -7,21 +7,6 @@
#include "modules/osdmodule.h"
#include "modules/font/font_module.h"
//============================================================
// System dependent defines
//============================================================
#if defined(SDLMAME_WIN32)
#define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
#define SDLMAME_INIT_IN_WORKER_THREAD (0)
#define SDL13_COMBINE_RESIZE (0) //(1) no longer needed
#else
#define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
#define SDLMAME_INIT_IN_WORKER_THREAD (0)
#define SDL13_COMBINE_RESIZE (0)
#endif
//============================================================
// Defines
//============================================================

View File

@ -274,10 +274,7 @@ void sdl_osd_interface::osd_exit()
{
osd_common_t::osd_exit();
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER );
}
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
//============================================================
@ -491,14 +488,11 @@ void sdl_osd_interface::init(running_machine &machine)
/* Initialize SDL */
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
if (SDL_InitSubSystem(SDL_INIT_VIDEO)) {
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
exit(-1);
}
osd_sdl_info();
if (SDL_InitSubSystem(SDL_INIT_VIDEO)) {
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
exit(-1);
}
osd_sdl_info();
defines_verbose();

View File

@ -181,15 +181,6 @@ static inline void execute_async_wait(osd_work_callback callback, const worker_p
static OSDWORK_CALLBACK(sdlwindow_thread_id)
{
window_threadid = SDL_ThreadID();
if (SDLMAME_INIT_IN_WORKER_THREAD)
{
if (SDL_InitSubSystem(SDL_INIT_VIDEO))
{
osd_printf_error("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
}
}
return nullptr;
}
@ -310,9 +301,6 @@ void sdl_osd_interface::build_slider_list()
static OSDWORK_CALLBACK( sdlwindow_exit_wt )
{
if (SDLMAME_INIT_IN_WORKER_THREAD)
SDL_Quit();
if (param)
osd_free(param);
return nullptr;
@ -1082,22 +1070,8 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt )
{
#if 1
int scrnum = 0;
int is_vector = 0;
screen_device_iterator iter(window->machine().root_device());
for (const screen_device *screen = iter.first(); screen != nullptr; screen = iter.next())
{
if (scrnum == window->m_index)
{
is_vector = (screen->screen_type() == SCREEN_TYPE_VECTOR) ? 1 : 0;
break;
}
else
{
scrnum++;
}
}
if (is_vector)
const screen_device *screen = screen_device_iterator(window->machine().root_device()).byindex(window->m_index);
if ((screen != nullptr) && (screen->screen_type() == SCREEN_TYPE_VECTOR))
window->renderer().set_flags(osd_renderer::FLAG_HAS_VECTOR_SCREEN);
else
window->renderer().clear_flags(osd_renderer::FLAG_HAS_VECTOR_SCREEN);
@ -1371,9 +1345,6 @@ sdl_window_info::sdl_window_info(running_machine &a_machine, int index, osd_moni
const osd_window_config *config)
: osd_window(), m_next(NULL),
// Following three are used by input code to defer resizes
m_resize_width(0),
m_resize_height(0),
m_last_resize(0),
m_minimum_dim(0,0),
m_windowed_dim(0,0),
m_rendered_event(0, 1), m_target(0),

View File

@ -70,11 +70,6 @@ public:
// Pointer to next window
sdl_window_info * m_next;
// These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE
int m_resize_width;
int m_resize_height;
osd_ticks_t m_last_resize;
private:
// window handle and info
char m_title[256];