From 919913f118760c0ca41ab63512bd5c106f6fd840 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Wed, 27 Apr 2011 05:11:18 +0000 Subject: Collapsed device_config and device_t into one class. Updated all existing modern devices and the legacy wrappers to work in this environment. This in general greatly simplifies writing a modern device. [Aaron Giles] General notes: * some more cleanup probably needs to happen behind this change, but I needed to get it in before the next device modernization or import from MESS :) * new template function device_creator which automatically defines the static function that creates the device; use this instead of creating a static_alloc_device_config function * added device_stop() method which is called at around the time the previous device_t's destructor was called; if you auto_free anything, do it here because the machine is gone when the destructor is called * changed the static_set_* calls to pass a device_t & instead of a device_config * * for many devices, the static config structure member names over- lapped the device's names for devcb_* functions; in these cases the members in the interface were renamed to have a _cb suffix * changed the driver_enumerator to only cache 100 machine_configs because caching them all took a ton of memory; fortunately this implementation detail is completely hidden behind the driver_enumerator interface * got rid of the macros for creating derived classes; doing it manually is now clean enough that it isn't worth hiding the details in a macro --- src/emu/softlist.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/emu/softlist.c') diff --git a/src/emu/softlist.c b/src/emu/softlist.c index 9d128c8b24f..adb85863c21 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -1343,7 +1343,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar software_name_split( image->device().machine(), path, &swlist_name, &swname, &swpart ); swname_bckp = swname; - const char *interface = image->image_config().image_interface(); + const char *interface = image->image_interface(); if ( swlist_name ) { @@ -1363,12 +1363,12 @@ bool load_software_part(device_image_interface *image, const char *path, softwar else { /* Loop through all the software lists named in the driver */ - for (device_t *swlists = image->device().machine().m_devicelist.first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) + for (device_t *swlists = image->device().machine().devicelist().first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) { if ( swlists ) { - software_list_config *swlist = (software_list_config *)downcast(&swlists->baseconfig())->inline_config(); + software_list_config *swlist = (software_list_config *)downcast(swlists)->inline_config(); UINT32 i = DEVINFO_STR_SWLIST_0; while ( ! software_part_ptr && i <= DEVINFO_STR_SWLIST_MAX ) @@ -1459,15 +1459,15 @@ bool load_software_part(device_image_interface *image, const char *path, softwar if (software_info_ptr == NULL) { // check if there is at least a software list - if (image->device().machine().m_devicelist.first(SOFTWARE_LIST)) + if (image->device().machine().devicelist().first(SOFTWARE_LIST)) { mame_printf_error("\n\"%s\" approximately matches the following\n" "supported software items (best match first):\n\n", swname_bckp); } - for (device_t *swlists = image->device().machine().m_devicelist.first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) + for (device_t *swlists = image->device().machine().devicelist().first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) { - software_list_config *swlist = (software_list_config *)downcast(&swlists->baseconfig())->inline_config(); + software_list_config *swlist = (software_list_config *)downcast(swlists)->inline_config(); for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++) { @@ -1482,7 +1482,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar software_list_parse(list, list->error_proc, NULL); // get the top 5 approximate matches for the selected device interface (i.e. only carts for cartslot, etc.) - software_list_find_approx_matches(list, swname_bckp, ARRAY_LENGTH(matches), matches, image->image_config().image_interface()); + software_list_find_approx_matches(list, swname_bckp, ARRAY_LENGTH(matches), matches, image->image_interface()); if (matches[0] != 0) { @@ -1609,7 +1609,7 @@ static DEVICE_START( software_list ) static DEVICE_VALIDITY_CHECK( software_list ) { - software_list_config *swlist = (software_list_config *)downcast(device)->inline_config(); + software_list_config *swlist = (software_list_config *)downcast(device)->inline_config(); int error = FALSE; softlist_map names; softlist_map descriptions; @@ -1790,7 +1790,7 @@ DEVICE_GET_INFO( software_list ) if ( state >= DEVINFO_STR_SWLIST_0 && state <= DEVINFO_STR_SWLIST_MAX ) { - software_list_config *config = (software_list_config *)downcast(device)->inline_config(); + software_list_config *config = (software_list_config *)downcast(device)->inline_config(); if ( config->list_name[ state - DEVINFO_STR_SWLIST_0 ] ) strcpy(info->s, config->list_name[ state - DEVINFO_STR_SWLIST_0 ]); -- cgit v1.2.3-70-g09d2