Previous 15994 Revisions Next

r2282 Saturday 5th April, 2008 at 22:12:21 UTC by Nathan Woods
More device refactoring
[src/mess]climess.c configms.c infomess.c

src/mess/climess.c
r2281r2282
4646   int i;
4747   machine_config *config;
4848   const device_config *dev;
49   const struct IODevice *iodev;
49   image_device_info info;
5050   const char *src;
5151   const char *driver_name;
5252   const char *name;
r2281r2282
7272
7373         for (dev = image_device_first(config); dev != NULL; dev = image_device_next(dev))
7474         {
75            iodev = mess_device_from_core_device(dev);
75            info = image_device_getinfo(dev);
7676
77            src = iodev->file_extensions;
77            src = info.file_extensions;
78            name = info.instance_name;
79            shortname = info.brief_instance_name;
7880
79            name = device_instancename(&iodev->devclass, iodev->index_in_device);
80            shortname = device_briefinstancename(&iodev->devclass, iodev->index_in_device);
81
8281            sprintf(paren_shortname, "(%s)", shortname);
8382
8483            mame_printf_info("%-13s%-12s%-8s   ", driver_name, name, paren_shortname);
src/mess/configms.c
r2281r2282
66
77#include "mame.h"
88#include "deprecat.h"
9#include "device.h"
109#include "configms.h"
1110#include "config.h"
1211#include "xmlfile.h"
r2281r2282
2524{
2625   xml_data_node *node;
2726   const device_config *dev;
28   const struct IODevice *iodev;
27   image_device_info info;
2928   const device_config *image;
3029   const char *dev_instance;
3130   const char *working_directory;
r2281r2282
3736         image = NULL;
3837         dev_instance = xml_get_attribute_string(node, "instance", NULL);
3938
40         if (dev_instance != NULL)
39         if ((dev_instance != NULL) && (dev_instance[0] != '\0'))
4140         {
4241            for (dev = image_device_first(Machine->config); (image == NULL) && (dev != NULL); dev = image_device_next(dev))
4342            {
44               iodev = mess_device_from_core_device(dev);
45               if (iodev != NULL)
46               {
47                  if (!strcmp(dev_instance, device_instancename(&iodev->devclass, iodev->index_in_device)))
48                     image = dev;
49               }
43               info = image_device_getinfo(dev);
44               if (!strcmp(dev_instance, info.instance_name))
45                  image = dev;
5046            }
5147
5248            if (image != NULL)
r2281r2282
7066static void device_dirs_save(int config_type, xml_data_node *parentnode)
7167{
7268   xml_data_node *node;
73   const struct IODevice *dev;
69   image_device_info info;
7470   const device_config *image;
7571   const char *dev_instance;
7672
r2281r2282
7975   {
8076      for (image = image_device_first(Machine->config); image != NULL; image = image_device_next(image))
8177      {
82         dev = mess_device_from_core_device(image);
83         dev_instance = device_instancename(&dev->devclass, dev->index_in_device);
78         info = image_device_getinfo(image);
79         dev_instance = info.instance_name;
8480
8581         node = xml_add_child(parentnode, "device", NULL);
8682         if (node != NULL)
src/mess/infomess.c
r2281r2282
2929void print_game_device(FILE *out, const game_driver *game, const machine_config *config)
3030{
3131   const device_config *dev;
32   const struct IODevice *iodev;
32   image_device_info info;
3333   const char *name;
3434   const char *shortname;
35   const char *ext;
3536
3637   for (dev = image_device_first(config); dev != NULL; dev = image_device_next(dev))
3738   {
38      iodev = mess_device_from_core_device(dev);
39      info = image_device_getinfo(dev);
3940
4041      /* print out device type */
41      fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(device_typename(iodev->type)));
42      fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(device_typename(info.type)));
4243
4344      /* does this device have a tag? */
44      if (iodev->tag)
45         fprintf(out, " tag=\"%s\"", xml_normalize_string(iodev->tag));
45      if (dev->tag)
46         fprintf(out, " tag=\"%s\"", xml_normalize_string(dev->tag));
4647
4748      /* is this device mandatory? */
48      if (iodev->must_be_loaded)
49      if (info.must_be_loaded)
4950         fprintf(out, " mandatory=\"1\"");
5051
5152      /* close the XML tag */
5253      fprintf(out, ">\n");
5354
54      name = device_instancename(&iodev->devclass, iodev->index_in_device);
55      shortname = device_briefinstancename(&iodev->devclass, iodev->index_in_device);
55      name = info.instance_name;
56      shortname = info.brief_instance_name;
5657
5758      fprintf(out, "\t\t\t<instance");
5859      fprintf(out, " name=\"%s\"", xml_normalize_string(name));
5960      fprintf(out, " briefname=\"%s\"", xml_normalize_string(shortname));
6061      fprintf(out, "/>\n");
6162
62      if (iodev->file_extensions)
63      ext = info.file_extensions;
64      while (*ext)
6365      {
64         const char* ext = iodev->file_extensions;
65         while (*ext)
66         {
67            fprintf(out, "\t\t\t<extension");
68            fprintf(out, " name=\"%s\"", xml_normalize_string(ext));
69            fprintf(out, "/>\n");
70            ext += strlen(ext) + 1;
71         }
66         fprintf(out, "\t\t\t<extension");
67         fprintf(out, " name=\"%s\"", xml_normalize_string(ext));
68         fprintf(out, "/>\n");
69         ext += strlen(ext) + 1;
7270      }
7371
7472      fprintf(out, "\t\t</device>\n");

Previous 15994 Revisions Next


© 1998-2018 The MESS Team