~ubuntu-branches/ubuntu/lucid/sdlmame/lucid

« back to all changes in this revision

Viewing changes to src/emu/devintrf.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Falco
  • Date: 2009-11-03 17:10:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20091103171015-6hop4ory5lxnumpn
Tags: 0.135-0ubuntu1
* New upstream release - Closes (LP: #403212)
* debian/watch: unstable releases are no longer detected
* mame.ini: added the cheat subdirectories to cheatpath so zipped
  cheatfiles will be searched too
* renamed crsshair subdirectory to crosshair to reflect upstream change
* mame.ini: renamed references to crosshair subdirectory (see above)

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
        /* populate device properties */
123
123
        device->type = type;
124
124
        device->devclass = (device_class)(INT32)devtype_get_info_int(type, DEVINFO_INT_CLASS);
125
 
        device->execute = NULL;
126
125
 
127
126
        /* populate device configuration */
128
127
        device->clock = clock;
 
128
        memset((void *)device->address_map, 0, sizeof(device->address_map));
129
129
        if ((device->clock & 0xff000000) == 0xff000000)
130
130
        {
131
131
                assert(device->owner != NULL);
141
141
        device->tokenbytes = 0;
142
142
        device->region = NULL;
143
143
        device->regionbytes = 0;
 
144
        memset((void *)device->space, 0, sizeof(device->space));
 
145
        device->execute = NULL;
144
146
 
145
147
        /* append the tag */
146
148
        strcpy(device->tag, tag);
359
361
 
360
362
 
361
363
/*-------------------------------------------------
 
364
    device_find_child_by_tag - retrieve a child
 
365
    device configuration based on a tag
 
366
-------------------------------------------------*/
 
367
 
 
368
const device_config *device_find_child_by_tag(const device_config *owner, const char *tag)
 
369
{
 
370
        astring *tempstring;
 
371
        const device_config *child;
 
372
 
 
373
        assert(owner != NULL);
 
374
        assert(tag != NULL);
 
375
 
 
376
        tempstring = astring_alloc();
 
377
        child = device_list_find_by_tag(owner->machine->config->devicelist, device_build_tag(tempstring, owner, tag));
 
378
        astring_free(tempstring);
 
379
 
 
380
        return child;
 
381
}
 
382
 
 
383
 
 
384
/*-------------------------------------------------
362
385
    device_list_index - return the index of a
363
386
    device based on its type and tag;
364
387
    DEVICE_TYPE_WILDCARD is allowed
568
591
        /* iterate over devices and allocate memory for them */
569
592
        for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
570
593
        {
 
594
                int spacenum;
 
595
 
571
596
                assert(!device->started);
572
597
                assert(device->machine == machine);
573
598
                assert(device->token == NULL);
584
609
                device->token = alloc_array_clear_or_die(UINT8, device->tokenbytes);
585
610
 
586
611
                /* fill in the remaining runtime fields */
587
 
                device->execute = (device_execute_func)device_get_info_fct(device, DEVINFO_FCT_EXECUTE);
588
 
                device->machine = machine;
589
612
                device->region = memory_region(machine, device->tag);
590
613
                device->regionbytes = memory_region_length(machine, device->tag);
 
614
                for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
 
615
                        device->space[spacenum] = memory_find_address_space(device, spacenum);
 
616
                device->execute = (device_execute_func)device_get_info_fct(device, DEVINFO_FCT_EXECUTE);
591
617
        }
592
618
 
593
619
        /* iterate until we've started everything */