Exemple #1
0
void print_game_device(FILE* out, const game_driver* game)
{
	const struct IODevice* dev;
	const char *name;
	const char *shortname;
	int id;

	begin_resource_tracking();

	dev = devices_allocate(game);
	if (dev)
	{
		while(dev->type < IO_COUNT)
		{
			/* print out device type */
			fprintf(out, "\t\t<device type=\"%s\"", normalize_string(device_typename(dev->type)));

			/* does this device have a tag? */
			if (dev->tag)
				fprintf(out, " tag=\"%s\"", normalize_string(dev->tag));

			/* is this device mandatory? */
			if (dev->must_be_loaded)
				fprintf(out, " mandatory=\"1\"");

			/* close the XML tag */
			fprintf(out, ">\n");

			for (id = 0; id < dev->count; id++)
			{
				name = device_instancename(&dev->devclass, id);
				shortname = device_briefinstancename(&dev->devclass, id);

				fprintf(out, "\t\t\t<instance");
				fprintf(out, " name=\"%s\"", normalize_string(name));
				fprintf(out, " briefname=\"%s\"", normalize_string(shortname));
				fprintf(out, "/>\n");
			}

			if (dev->file_extensions)
			{
				const char* ext = dev->file_extensions;
				while (*ext)
				{
					fprintf(out, "\t\t\t<extension");
					fprintf(out, " name=\"%s\"", normalize_string(ext));
					fprintf(out, "/>\n");
					ext += strlen(ext) + 1;
				}
			}

			fprintf(out, "\t\t</device>\n");

			dev++;
		}
	}
	end_resource_tracking();
}
Exemple #2
0
int frontend_listdevices(FILE *output)
{
	int i, dev, id;
	const struct IODevice *devices;
	const char *src;
	const char *driver_name;
	const char *name;
	const char *shortname;
	char paren_shortname[16];
	const char *gamename = "*";

	i = 0;

	fprintf(output, " SYSTEM      DEVICE NAME (brief)   IMAGE FILE EXTENSIONS SUPPORTED    \n");
	fprintf(output, "----------  --------------------  ------------------------------------\n");

	while (drivers[i])
	{
		if (!strwildcmp(gamename, drivers[i]->name))
		{
			begin_resource_tracking();
			devices = devices_allocate(drivers[i]);

			driver_name = drivers[i]->name;

			for (dev = 0; devices[dev].type < IO_COUNT; dev++)
			{
				src = devices[dev].file_extensions;

				for (id = 0; id < devices[dev].count; id++)
				{
					name = device_instancename(&devices[dev].devclass, id);
					shortname = device_briefinstancename(&devices[dev].devclass, id);

					sprintf(paren_shortname, "(%s)", shortname);

					fprintf(output, "%-13s%-12s%-8s   ", driver_name, name, paren_shortname);
					driver_name = " ";

					if (id == 0)
					{
						while (src && *src)
						{
							fprintf(output, ".%-5s", src);
							src += strlen(src) + 1;
						}
					}
					fprintf(output, "\n");
				}
			}
			end_resource_tracking();
		}
		i++;
	}
	return 0;
}
Exemple #3
0
int mess_validitychecks(void)
{
    int i, j;
    int error = 0;
    iodevice_t devtype;
    struct IODevice *devices;
    const char *name;
    input_port_entry *inputports = NULL;
    extern int device_valididtychecks(void);
    extern const char *mess_default_text[];
    struct SystemConfigurationParamBlock cfg;
    device_getinfo_handler handlers[64];
    int count_overrides[sizeof(handlers) / sizeof(handlers[0])];
    device_class devclass;

    /* make sure that all of the UI_* strings are set for all devices */
    for (devtype = 0; devtype < IO_COUNT; devtype++)
    {
        name = mess_default_text[UI_cartridge - IO_CARTSLOT - UI_last_mame_entry + devtype];
        if (!name || !name[0])
        {
            printf("Device type %d does not have an associated UI string\n", devtype);
            error = 1;
        }
    }

    /* MESS specific driver validity checks */
    for (i = 0; drivers[i]; i++)
    {
        devices = devices_allocate(drivers[i]);

        /* make sure that there are no clones that reference nonexistant drivers */
        if (driver_get_clone(drivers[i]))
        {
            if (drivers[i]->compatible_with && !(drivers[i]->compatible_with->flags & NOT_A_DRIVER))
            {
                printf("%s: both compatbile_with and clone_of are specified\n", drivers[i]->name);
                error = 1;
            }

            for (j = 0; drivers[j]; j++)
            {
                if (driver_get_clone(drivers[i]) == drivers[j])
                    break;
            }
            if (!drivers[j])
            {
                printf("%s: is a clone of %s, which is not in drivers[]\n", drivers[i]->name, driver_get_clone(drivers[i])->name);
                error = 1;
            }
        }

        /* make sure that there are no clones that reference nonexistant drivers */
        if (drivers[i]->compatible_with && !(drivers[i]->compatible_with->flags & NOT_A_DRIVER))
        {
            for (j = 0; drivers[j]; j++)
            {
                if (drivers[i]->compatible_with == drivers[j])
                    break;
            }
            if (!drivers[j])
            {
                printf("%s: is compatible with %s, which is not in drivers[]\n", drivers[i]->name, drivers[i]->compatible_with->name);
                error = 1;
            }
        }

        /* check devices */
        if (drivers[i]->sysconfig_ctor)
        {
            memset(&cfg, 0, sizeof(cfg));
            memset(handlers, 0, sizeof(handlers));
            cfg.device_slotcount = sizeof(handlers) / sizeof(handlers[0]);
            cfg.device_handlers = handlers;
            cfg.device_countoverrides = count_overrides;
            drivers[i]->sysconfig_ctor(&cfg);

            for (j = 0; handlers[j]; j++)
            {
                devclass.gamedrv = drivers[i];
                devclass.get_info = handlers[j];

                if (validate_device(&devclass))
                    error = 1;
            }
        }

        /* check system config */
        ram_option_count(drivers[i]);

        /* make sure that our input system likes this driver */
        if (inputx_validitycheck(drivers[i], &inputports))
            error = 1;

        devices = NULL;
    }

    /* call other validity checks */
    if (inputx_validitycheck(NULL, &inputports))
        error = 1;
    if (device_valididtychecks())
        error = 1;

    /* now that we are completed, re-expand the actual driver to compensate
     * for the tms9928a hack */
    if (Machine && Machine->gamedrv)
    {
        machine_config drv;
        expand_machine_driver(Machine->gamedrv->drv, &drv);
    }

    return error;
}