diff options
author | 2014-03-11 15:54:58 +0000 | |
---|---|---|
committer | 2014-03-11 15:54:58 +0000 | |
commit | 4ea9df02a1daf1893246a01e21ffe201781f9266 (patch) | |
tree | 70dcb5feb88dcabe713fc172c30fd159ed1a0a43 /src/emu/ui/swlist.c | |
parent | b05606404a780c5309d39d8ee45411292279f117 (diff) |
Moved core template container classes up from emutempl.h to coretmpl.h:
[Aaron Giles]
* these classes now no longer take a resource_pool; everything is
managed globally -- this means that objects added to lists must be
allocated with global_alloc
* added new auto_pointer<> template which wraps a pointer and auto-frees
it upon destruction; it also defaults to NULL so it doesn't need to
be explicitly initialized
* moved tagged_list template to tagmap.h
Redo of the low-level memory tracking system: [Aaron Giles]
* moved low-level tracking out of emu\emualloc into lib\util\corealloc
so it can be shared among all components and used by core libraries
* global_alloc and friends no longer use a resource pool to track
allocations; turns out this was a wholly redundant system that wasted
a lot of memory
* removed global_resource_pool entirely
* added global_free_array to delete arrays allocated with
global_alloc_array
* added tracking of object versus array allocation; we will now error
if you use global_free on an array, or global_free_array on an object
Added new utility helper const_string_pool which can be used to
efficiently accumulate strings that are not intended to be modified.
Used by updated makelist and software list code. [Aaron Giles]
Updated png2bdc and makelist tools to not leak memory and use more modern
techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles]
Deprecated auto_strdup and removed all uses by way of caller-managed
astrings and the software list rewrite. [Aaron Giles]
Rewrote software list management: [Aaron Giles]
* removed the notion of a software_list that is separate from a
software_list_device; they are one and the same now
* moved several functions into device_image_interface since they really
didn't belong in the core software list class
* lots of simplification as a result of the above changes
Additional notes (no whatsnew):
Moved definition of FPTR to osdcomm.h.
Some changes happened in the OSD code to fix issues, especially regarding
freeing arrays. SDL folks may need to fix up some of these.
The following devices still are using tokens and should be modernized
(I found them because they kept their token as void * and tried to
delete it, which you can't):
namco_52xx_device (mame/audio/namco52.c)
namco_54xx_device (mame/audio/namco54.c)
namco_06xx_device (mame/machine/namco06.c)
namco_50xx_device (mame/machine/namco50.c)
namco_51xx_device (mame/machine/namco51.c)
namco_53xx_device (mame/machine/namco53.c)
voodoo_device (emu/video/voodoo.c)
mos6581_device (emu/sound/mos6581.c)
aica_device (emu/sound/aica.c)
scsp_device (emu/sound/scsp.c)
dmadac_sound_device (emu/sound/dmadac.c)
s3c2440_device (emu/machine/s3c2440.c)
wd1770_device (emu/machine/wd17xx.c)
latch8_device (emu/machine/latch8.c)
duart68681_device (emu/machine/68681.c)
s3c2400_device (emu/machine/s3c2400.c)
s3c2410_device (emu/machine/s3c2410.c)
strataflash_device (mess/machine/strata.c)
hd63450_device (mess/machine/hd63450.c)
tap_990_device (mess/machine/ti99/990_tap.c)
omti8621_device (mess/machine/omti8621.c)
vdt911_device (mess/video/911_vdt.c)
apollo_graphics_15i (mess/video/apollo.c)
asr733_device (mess/video/733_asr.c)
Diffstat (limited to 'src/emu/ui/swlist.c')
-rw-r--r-- | src/emu/ui/swlist.c | 98 |
1 files changed, 29 insertions, 69 deletions
diff --git a/src/emu/ui/swlist.c b/src/emu/ui/swlist.c index 454ebb06a97..3eaf3908830 100644 --- a/src/emu/ui/swlist.c +++ b/src/emu/ui/swlist.c @@ -56,23 +56,19 @@ ui_menu_software_parts::~ui_menu_software_parts() void ui_menu_software_parts::populate() { - for (const software_part *swpart = software_find_part(m_info, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart)) + for (const software_part *swpart = m_info->first_part(); swpart != NULL; swpart = swpart->next()) { - if (softlist_contain_interface(m_interface, swpart->interface_)) + if (swpart->matches_interface(m_interface)) { software_part_menu_entry *entry = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry)); // check if the available parts have specific part_id to be displayed (e.g. "Map Disc", "Bonus Disc", etc.) // if not, we simply display "part_name"; if yes we display "part_name (part_id)" - astring menu_part_name(swpart->name); - if (software_part_get_feature(swpart, "part_id") != NULL) - { - menu_part_name.cat(" ("); - menu_part_name.cat(software_part_get_feature(swpart, "part_id")); - menu_part_name.cat(")"); - } + astring menu_part_name(swpart->name()); + if (swpart->feature("part_id") != NULL) + menu_part_name.cat(" (").cat(swpart->feature("part_id")).cat(")"); entry->type = T_ENTRY; entry->part = swpart; - item_append(m_info->shortname, menu_part_name.cstr(), 0, entry); + item_append(m_info->shortname(), menu_part_name.cstr(), 0, entry); } } @@ -113,7 +109,7 @@ void ui_menu_software_parts::handle() // ctor //------------------------------------------------- -ui_menu_software_list::ui_menu_software_list(running_machine &machine, render_container *container, const software_list_device *swlist, const char *interface, astring &result) +ui_menu_software_list::ui_menu_software_list(running_machine &machine, render_container *container, software_list_device *swlist, const char *interface, astring &result) : ui_menu(machine, container), m_result(result) { m_swlist = swlist; @@ -181,17 +177,17 @@ ui_menu_software_list::entry_info *ui_menu_software_list::append_software_entry( bool entry_updated = FALSE; // check if at least one of the parts has the correct interface and add a menu entry only in this case - for (const software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart)) + for (const software_part *swpart = swinfo->first_part(); swpart != NULL; swpart = swpart->next()) { - if ((softlist_contain_interface(m_interface, swpart->interface_)) && is_software_compatible(swpart, m_swlist)) + if (swpart->matches_interface(m_interface) && swpart->is_compatible(*m_swlist)) { entry_updated = TRUE; // allocate a new entry entry = (entry_info *) m_pool_alloc(sizeof(*entry)); memset(entry, 0, sizeof(*entry)); - entry->short_name = pool_strdup(swinfo->shortname); - entry->long_name = pool_strdup(swinfo->longname); + entry->short_name = pool_strdup(swinfo->shortname()); + entry->long_name = pool_strdup(swinfo->longname()); break; } } @@ -219,16 +215,9 @@ ui_menu_software_list::entry_info *ui_menu_software_list::append_software_entry( void ui_menu_software_list::populate() { - const software_list *list = software_list_open(machine().options(), m_swlist->list_name(), false, NULL); - // build up the list of entries for the menu - if (list) - { - for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) - append_software_entry(swinfo); - - software_list_close(list); - } + for (const software_info *swinfo = m_swlist->first_software_info(); swinfo != NULL; swinfo = swinfo->next()) + append_software_entry(swinfo); // add an entry to change ordering item_append("Switch Item Ordering", NULL, 0, (void *)1); @@ -378,7 +367,7 @@ void ui_menu_software_list::handle() // ctor //------------------------------------------------- -ui_menu_software::ui_menu_software(running_machine &machine, render_container *container, const char *interface, const software_list_device **result) +ui_menu_software::ui_menu_software(running_machine &machine, render_container *container, const char *interface, software_list_device **result) : ui_menu(machine, container) { m_interface = interface; @@ -401,68 +390,39 @@ ui_menu_software::~ui_menu_software() void ui_menu_software::populate() { - bool haveCompatible = false; + bool have_compatible = false; // Add original software lists for this system software_list_device_iterator iter(machine().config().root_device()); - for (const software_list_device *swlist = iter.first(); swlist != NULL; swlist = iter.next()) - { - if (swlist->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) - { - const software_list *list = software_list_open(machine().options(), swlist->list_name(), false, NULL); - - if (list && m_interface) + for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next()) + if (swlistdev->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) + if (swlistdev->first_software_info() != NULL && m_interface != NULL) { bool found = false; - for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) - { - const software_part *part = software_find_part(swinfo, NULL, NULL); - if (softlist_contain_interface(m_interface, part->interface_)) + for (const software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next()) + if (swinfo->first_part()->matches_interface(m_interface)) found = true; - } if (found) - { - item_append(list->description, NULL, 0, (void *)swlist); - } - - software_list_close(list); + item_append(swlistdev->description(), NULL, 0, (void *)swlistdev); } - } - } // add compatible software lists for this system - for (const software_list_device *swlist = iter.first(); swlist != NULL; swlist = iter.next()) - { - if (swlist->list_type() == SOFTWARE_LIST_COMPATIBLE_SYSTEM) - { - const software_list *list = software_list_open(machine().options(), swlist->list_name(), false, NULL); - - if (list && m_interface) + for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next()) + if (swlistdev->list_type() == SOFTWARE_LIST_COMPATIBLE_SYSTEM) + if (swlistdev->first_software_info() != NULL && m_interface != NULL) { bool found = false; - for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) - { - const software_part *part = software_find_part(swinfo, NULL, NULL); - if (softlist_contain_interface(m_interface, part->interface_)) - { + for (const software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next()) + if (swinfo->first_part()->matches_interface(m_interface)) found = true; - } - } - if (found) { - if (!haveCompatible) + if (!have_compatible) item_append("[compatible lists]", NULL, MENU_FLAG_DISABLE, NULL); - - item_append(list->description, NULL, 0, (void *)swlist); + item_append(swlistdev->description(), NULL, 0, (void *)swlistdev); } - - haveCompatible = true; - software_list_close(list); + have_compatible = true; } - } - } - } |