Previous 15994 Revisions Next

r2283 Saturday 5th April, 2008 at 22:51:51 UTC by Nathan Woods
More device refactorings
[src/mess]filemngr.c
[src/mess/devices]cassette.c snapquik.c
[src/mess/machine]cbm.c

src/mess/devices/cassette.c
r2282r2283
256256   tag = get_cassimg(image);
257257
258258   /* figure out the cassette format */
259   dev = device_find_from_machine(image->machine, IO_CASSETTE);
259   dev = mess_device_from_core_device(image);
260260   formats = mess_device_get_info_ptr(&dev->devclass, MESS_DEVINFO_PTR_CASSETTE_FORMATS);
261261
262262   if (image_has_been_created(image))
src/mess/devices/snapquik.c
r2282r2283
1414
1515struct snapquick_info
1616{
17   const struct IODevice *dev;
1817   const device_config *img;
1918   int file_size;
2019   struct snapquick_info *next;
r2282r2283
2928   struct snapquick_info *si = (struct snapquick_info *) ptr;
3029   snapquick_loadproc loadproc;
3130   const char *file_type;
31   const struct IODevice *dev;
3232
33   loadproc = (snapquick_loadproc) mess_device_get_info_fct(&si->dev->devclass, MESS_DEVINFO_PTR_SNAPSHOT_LOAD);
33   dev = mess_device_from_core_device(si->img);
34   loadproc = (snapquick_loadproc) mess_device_get_info_fct(&dev->devclass, MESS_DEVINFO_PTR_SNAPSHOT_LOAD);
3435   file_type = image_filetype(si->img);
3536   loadproc(machine, si->img, file_type, si->file_size);
3637   image_unload(si->img);
r2282r2283
5657   dev = mess_device_from_core_device(image);
5758   assert(dev);
5859
59   si->dev = dev;
6060   si->img = image;
6161   si->file_size = file_size;
6262   si->next = snapquick_infolist;
6363   snapquick_infolist = si;
6464
65   delay = mess_device_get_info_double(&si->dev->devclass, MESS_DEVINFO_FLOAT_SNAPSHOT_DELAY);
65   delay = mess_device_get_info_double(&dev->devclass, MESS_DEVINFO_FLOAT_SNAPSHOT_DELAY);
6666
6767   timer_set(double_to_attotime(delay), si, 0, snapquick_processsnapshot);
6868   return INIT_PASS;
src/mess/filemngr.c
r2282r2283
636636   static int previous_sel;
637637   const char *name;
638638   ui_menu_item menu_items[40];
639   const struct IODevice *devices[40];
639   const device_config *devices[40];
640640   char names[40][64];
641641   int sel, total, arrowize;
642642   const device_config *image;
r2282r2283
654654      menu_items[total].text = (names[total]) ? names[total] : "---";
655655      menu_items[total].subtext = (name) ? name : "---";
656656
657      devices[total] = mess_device_from_core_device(image);
657      devices[total] = image;
658658     
659659      total++;
660660   }
r2282r2283
663663   /* if the fileselect() mode is active */
664664   if (sel & (2 << SEL_BITS))
665665   {
666      image = image_from_device(devices[previous_sel & SEL_MASK]);
666      image = devices[previous_sel & SEL_MASK];
667667      sel = fileselect(selected & ~(2 << SEL_BITS), image_filename(image), image_working_directory(image));
668668      if (sel != 0 && sel != -1 && sel!=-2)
669669         return sel | (2 << SEL_BITS);
r2282r2283
676676         previous_sel = previous_sel & SEL_MASK;
677677
678678         /* attempt a filename change */
679         image = image_from_device(devices[previous_sel]);
679         image = devices[previous_sel];
680680         if (entered_filename[0])
681681            image_load(image, entered_filename);
682682         else
r2282r2283
713713      {
714714         /* yes */
715715         sel &= SEL_MASK;
716         image = image_from_device(devices[sel]);
716         image = devices[sel];
717717         image_load(image, NULL);
718718      }
719719
r2282r2283
743743      /* no, let the osd code have a crack at changing files */
744744      else
745745      {
746         image = image_from_device(devices[sel]);
746         image = devices[sel];
747747         os_sel = 0;
748748      }
749749
src/mess/machine/cbm.c
r2282r2283
169169   cbm_rom[id].chip = 0;
170170}
171171
172static const struct IODevice *cbm_rom_find_device(running_machine *machine)
173{
174   return device_find_from_machine(machine, IO_CARTSLOT);
175}
176
177172static DEVICE_START(cbm_rom)
178173{
179174   int id = image_index_in_device(device);
r2282r2283
190185   int size, j, read_;
191186   const char *filetype;
192187   int adr = 0;
193   const struct IODevice *dev;
194188
195189   for (i=0; (i<sizeof(cbm_rom) / sizeof(cbm_rom[0])) && (cbm_rom[i].size!=0); i++)
196190      ;
197191   if (i >= sizeof(cbm_rom) / sizeof(cbm_rom[0]))
198192      return INIT_FAIL;
199193
200   dev = cbm_rom_find_device(image->machine);
201
202194   size = image_length(image);
203195
204196   filetype = image_filetype(image);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team