Previous 15994 Revisions Next

r2023 Wednesday 19th March, 2008 at 13:07:29 UTC by Nathan Woods
Device Changeover: Eliminated some direct access of machine->devices[] by using
some temporary wrappers
[src/mess]device.c device.h
[src/mess/devices]appldriv.c cassette.c
[src/mess/machine]apple2.c cbm.c
[src/mess/osd/windows]menu.c

src/mess/devices/cassette.c
r2022r2023
237237      return INIT_FAIL;
238238
239239   /* set to default state */
240   dev = device_find(Machine->devices, IO_CASSETTE);
240   dev = device_find_from_machine(Machine, IO_CASSETTE);
241241   get_cassimg(image)->state = get_default_state(dev);
242242
243243   return INIT_PASS;
r2022r2023
259259   tag = get_cassimg(image);
260260
261261   /* figure out the cassette format */
262   dev = device_find(Machine->devices, IO_CASSETTE);
262   dev = device_find_from_machine(Machine, IO_CASSETTE);
263263   formats = mess_device_get_info_ptr(&dev->devclass, MESS_DEVINFO_PTR_CASSETTE_FORMATS);
264264
265265   if (image_has_been_created(image))
src/mess/devices/appldriv.c
r2022r2023
150150   int i, count;
151151   mess_image *image;
152152
153   count = device_count_tag(Machine->devices, APPLE525TAG);
153   count = device_count_tag_from_machine(Machine, APPLE525TAG);
154154
155155   for (i = 0; i < count; i++)
156156   {
r2022r2023
222222{
223223   int i, count;
224224
225   count = device_count_tag(Machine->devices, APPLE525TAG);
225   count = device_count_tag_from_machine(Machine, APPLE525TAG);
226226
227227   for (i = 0; i < count; i++)
228228   {
r2022r2023
258258   int i, count, result = 0;
259259   mess_image *image;
260260
261   count = device_count_tag(Machine->devices, APPLE525TAG);
261   count = device_count_tag_from_machine(Machine, APPLE525TAG);
262262
263263   for (i = 0; i < count; i++)
264264   {
src/mess/device.c
r2022r2023
352352
353353/*************************************
354354 *
355 *   Device enumeration
356 *
357 *************************************/
358
359const struct IODevice *mess_device_first_from_machine(const running_machine *machine)
360{
361   return machine->devices;
362}
363
364
365
366const struct IODevice *mess_device_next(const struct IODevice *dev)
367{
368   dev++;
369   return (dev->type < IO_COUNT) ? dev : NULL;
370}
371
372
373
374/*************************************
375 *
355376 *   Device lookup
356377 *
357378 *************************************/
r2022r2023
378399
379400
380401
402int device_count_tag_from_machine(const running_machine *machine, const char *tag)
403{
404   return device_count_tag(machine->devices, tag);
405}
406
407
408
381409/* this function is deprecated */
382410const struct IODevice *device_find(const struct IODevice *devices, iodevice_t type)
383411{
r2022r2023
393421
394422
395423/* this function is deprecated */
424const struct IODevice *device_find_from_machine(const running_machine *machine, iodevice_t type)
425{
426   return device_find(machine->devices, type);
427}
428
429
430
431/* this function is deprecated */
396432int device_count(iodevice_t type)
397433{
398434   const struct IODevice *dev = NULL;
src/mess/device.h
r2022r2023
279279const struct IODevice *devices_allocate(const game_driver *gamedrv);
280280void devices_free(const struct IODevice *devices);
281281
282/* device enumeration */
283const struct IODevice *mess_device_first_from_machine(const running_machine *machine);
284const struct IODevice *mess_device_next(const struct IODevice *dev);
285
282286/* device lookup */
283287const struct IODevice *device_find_tag(const struct IODevice *devices, const char *tag);
284288int device_count_tag(const struct IODevice *devices, const char *tag);
289int device_count_tag_from_machine(const running_machine *machine, const char *tag);
285290
286291/* deprecated: device lookup; both of these function assume only one of each type of device */
287292const struct IODevice *device_find(const struct IODevice *devices, iodevice_t type);
293const struct IODevice *device_find_from_machine(const running_machine *machine, iodevice_t type);
288294int device_count(iodevice_t type);
289295
290296/* diagnostics */
src/mess/osd/windows/menu.c
r2022r2023
13451345   remove_menu_items(device_menu);
13461346
13471347   // then set up the actual devices
1348   for (dev = machine->devices; dev->type < IO_COUNT; dev++)
1348   for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev))
13491349   {
13501350      for (i = 0; i < dev->count; i++)
13511351      {
src/mess/machine/cbm.c
r2022r2023
172172
173173static const struct IODevice *cbm_rom_find_device(running_machine *machine)
174174{
175   return device_find(machine->devices, IO_CARTSLOT);
175   return device_find_from_machine(machine, IO_CARTSLOT);
176176}
177177
178178static DEVICE_INIT(cbm_rom)
src/mess/machine/apple2.c
r2022r2023
14411441   intf.read_data = apple2_fdc_read_data;
14421442   intf.write_data = apple2_fdc_write_data;
14431443
1444   for (dev = machine->devices; dev->type < IO_COUNT; dev++)
1444   for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev))
14451445   {
14461446      if (!strcmp(dev->tag, "sonydriv"))
14471447         apple2_fdc_has_35 = 1;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team