Previous 15994 Revisions Next

r2225 Thursday 3rd April, 2008 at 00:22:14 UTC by Nathan Woods
Moved some deprecated functions to device.c
[src/mess]configms.c device.c device.h image.c image.h mess.h
[src/mess/devices]appldriv.h

src/mess/devices/appldriv.h
r2224r2225
1010#define APPLDRIV_H
1111
1212#include "mame.h"
13#include "device.h"
1314
1415
1516enum
src/mess/configms.c
r2224r2225
66
77#include "mame.h"
88#include "deprecat.h"
9#include "device.h"
910#include "configms.h"
1011#include "config.h"
1112#include "xmlfile.h"
src/mess/mess.h
r2224r2225
1313
1414struct SystemConfigurationParamBlock;
1515
16#include "device.h"
1716#include "image.h"
1817#include "artworkx.h"
1918#include "memory.h"
src/mess/image.c
r2224r2225
16411641{
16421642   return Machine->images_data->slots[absolute_index].dev;
16431643}
1644
1645
1646
1647/****************************************************************************
1648  Deprecated functions
1649
1650  The usage of these functions is to be phased out.  The first group because
1651  they reflect the outdated fixed relationship between devices and their
1652  type/id.
1653****************************************************************************/
1654
1655const device_config *image_from_device(const struct IODevice *device)
1656{
1657   return device->devconfig;
1658}
1659
1660
1661
1662const device_config *image_from_devtag_and_index(const char *devtag, int id)
1663{
1664   const device_config *image = NULL;
1665   const device_config *dev;
1666   const struct IODevice *iodev;
1667
1668   for (dev = image_device_first(Machine->config); dev != NULL; dev = image_device_next(dev))
1669   {
1670      iodev = mess_device_from_core_device(dev);
1671      if ((iodev != NULL) && (iodev->tag != NULL) && !strcmp(iodev->tag, devtag) && (iodev->index_in_device == id))
1672      {
1673         image = dev;
1674         break;
1675      }
1676   }
1677
1678   assert(image != NULL);
1679   return image;
1680}
1681
1682
1683
1684const device_config *image_from_devtype_and_index(iodevice_t type, int id)
1685{
1686   const device_config *image = NULL;
1687   const device_config *dev;
1688   const struct IODevice *iodev;
1689
1690   assert((Machine->images_data->multiple_dev_mask & (1 << type)) == 0);
1691   assert(id < device_count(Machine, type));
1692
1693   for (dev = image_device_first(Machine->config); dev != NULL; dev = image_device_next(dev))
1694   {
1695      iodev = mess_device_from_core_device(dev);
1696      if ((iodev != NULL) && (type == iodev->type) && (iodev->index_in_device == id))
1697      {
1698         image = dev;
1699         break;
1700      }
1701   }
1702
1703   assert(image);
1704   return image;
1705}
1706
1707
1708
1709iodevice_t image_devtype(const device_config *image)
1710{
1711   const struct IODevice *iodev = mess_device_from_core_device(image);
1712   assert(iodev != NULL);
1713   return iodev->type;
1714}
1715
1716
1717
1718int image_index_in_device(const device_config *image)
1719{
1720   const struct IODevice *iodev = mess_device_from_core_device(image);
1721   assert(iodev != NULL);
1722   return iodev->index_in_device;
1723}
src/mess/image.h
r2224r2225
1414#include "fileio.h"
1515#include "utils.h"
1616#include "opresolv.h"
17#include "device.h"
1817#include "osdmess.h"
1918
2019
2120
2221/***************************************************************************
23    CONSTANTS
22    TYPE DEFINITIONS
2423***************************************************************************/
2524
2625typedef enum
r2224r2225
189188
190189
191190/****************************************************************************
192  Deprecated functions
193
194  The usage of these functions is to be phased out.  The first group because
195  they reflect the outdated fixed relationship between devices and their
196  type/id.
197****************************************************************************/
198
199int image_index_in_device(const device_config *img);
200const device_config *image_from_device(const struct IODevice *dev);
201const device_config *image_from_devtag_and_index(const char *devtag, int id);
202
203/* deprecated; as there can be multiple devices of a certain type */
204iodevice_t image_devtype(const device_config *img);
205const device_config *image_from_devtype_and_index(iodevice_t type, int id);
206
207
208
209
210/****************************************************************************
211191  Macros for declaring device callbacks
212192****************************************************************************/
213193
src/mess/device.c
r2224r2225
88
99#include <stddef.h>
1010
11#include "driver.h"
1112#include "device.h"
13#include "deprecat.h"
1214#include "mslegacy.h"
13#include "driver.h"
1415#include "pool.h"
1516#include "tagpool.h"
1617
r2224r2225
623624
624625/*************************************
625626 *
627 *   Deprecated device access functions
628 *
629 *************************************/
630
631int image_index_in_device(const device_config *image)
632{
633   const struct IODevice *iodev = mess_device_from_core_device(image);
634   assert(iodev != NULL);
635   return iodev->index_in_device;
636}
637
638
639
640const device_config *image_from_device(const struct IODevice *device)
641{
642   return device->devconfig;
643}
644
645
646
647const device_config *image_from_devtag_and_index(const char *devtag, int id)
648{
649   const device_config *image = NULL;
650   const device_config *dev;
651   const struct IODevice *iodev;
652
653   for (dev = device_list_first(Machine->config->devicelist, MESS_DEVICE); dev != NULL; dev = device_list_next(dev, MESS_DEVICE))
654   {
655      iodev = mess_device_from_core_device(dev);
656      if ((iodev->tag != NULL) && !strcmp(iodev->tag, devtag) && (iodev->index_in_device == id))
657      {
658         image = dev;
659         break;
660      }
661   }
662
663   assert(image != NULL);
664   return image;
665}
666
667
668
669iodevice_t image_devtype(const device_config *image)
670{
671   const struct IODevice *iodev = mess_device_from_core_device(image);
672   assert(iodev != NULL);
673   return iodev->type;
674}
675
676
677
678const device_config *image_from_devtype_and_index(iodevice_t type, int id)
679{
680   const device_config *image = NULL;
681   const device_config *dev;
682   const struct IODevice *iodev;
683
684   assert((Machine->images_data->multiple_dev_mask & (1 << type)) == 0);
685   assert(id < device_count(Machine, type));
686
687   for (dev = device_list_first(Machine->config->devicelist, MESS_DEVICE); dev != NULL; dev = device_list_next(dev, MESS_DEVICE))
688   {
689      iodev = mess_device_from_core_device(dev);
690      if ((type == iodev->type) && (iodev->index_in_device == id))
691      {
692         image = dev;
693         break;
694      }
695   }
696
697   assert(image);
698   return image;
699}
700
701
702
703/*************************************
704 *
626705 *   Diagnostics
627706 *
628707 *************************************/
src/mess/device.h
r2224r2225
295295void *image_alloctag(const device_config *device, const char *tag, size_t size);
296296void *image_lookuptag(const device_config *device, const char *tag);
297297
298/* deprecated device access functions */
299int image_index_in_device(const device_config *device);
300const device_config *image_from_device(const struct IODevice *iodev);
301const device_config *image_from_devtag_and_index(const char *devtag, int id);
302
303/* deprecated device access functions that assume one device of any given type */
304iodevice_t image_devtype(const device_config *device);
305const device_config *image_from_devtype_and_index(iodevice_t type, int id);
306
298307/* diagnostics */
299308int device_valididtychecks(void);
300309

Previous 15994 Revisions Next


© 1998-2018 The MESS Team