Beispiel #1
0
/* Print the MAME info record for a game */
static void print_game_info(FILE* out, const game_driver* game)
{
	const char *start;
	const game_driver *clone_of;

	/* No action if not a game */
	if (game->flags & NOT_A_DRIVER)
		return;

	fprintf(out, "\t<" XML_TOP);

	fprintf(out, " name=\"%s\"", normalize_string(game->name) );

	start = strrchr(game->source_file, '/');
	if (!start)
		start = strrchr(game->source_file, '\\');
	if (!start)
		start = game->source_file - 1;
	fprintf(out, " sourcefile=\"%s\"", normalize_string(start + 1));

	clone_of = driver_get_clone(game);
	if (clone_of && !(clone_of->flags & NOT_A_DRIVER))
		fprintf(out, " cloneof=\"%s\"", normalize_string(clone_of->name));

	if (clone_of)
		fprintf(out, " romof=\"%s\"", normalize_string(clone_of->name));

	print_game_sampleof(out, game);

	fprintf(out, ">\n");

	if (game->description)
		fprintf(out, "\t\t<description>%s</description>\n", normalize_string(game->description));

	/* print the year only if is a number */
	if (game->year && strspn(game->year,"0123456789")==strlen(game->year))
		fprintf(out, "\t\t<year>%s</year>\n", normalize_string(game->year) );

	if (game->manufacturer)
		fprintf(out, "\t\t<manufacturer>%s</manufacturer>\n", normalize_string(game->manufacturer));

	print_game_bios(out, game);
	print_game_rom(out, game);
	print_game_sample(out, game);
	print_game_micro(out, game);
	print_game_video(out, game);
	print_game_sound(out, game);
	print_game_input(out, game);
	print_game_switch(out, game);
	print_game_driver(out, game);
#ifdef MESS
	print_game_device(out, game);
	print_game_ramoptions(out, game);
#endif

	fprintf(out, "\t</" XML_TOP ">\n");
}
Beispiel #2
0
static void print_game_info(FILE *out, const game_driver *game)
{
	const input_port_config *portconfig;
	const game_driver *clone_of;
	machine_config *config;
	const char *start;

	/* no action if not a game */
	if (game->flags & GAME_NO_STANDALONE)
		return;

	/* start tracking resources and allocate the machine and input configs */
	config = machine_config_alloc(game->machine_config);
#ifdef MESS
	/* temporary hook until MESS device transition is complete */
	mess_devices_setup(NULL, config, game);
#endif /* MESS */
	portconfig = input_port_config_alloc(game->ipt, NULL, 0);

	/* print the header and the game name */
	fprintf(out, "\t<" XML_TOP);
	fprintf(out, " name=\"%s\"", xml_normalize_string(game->name) );

	/* strip away any path information from the source_file and output it */
	start = strrchr(game->source_file, '/');
	if (start == NULL)
		start = strrchr(game->source_file, '\\');
	if (start == NULL)
		start = game->source_file - 1;
	fprintf(out, " sourcefile=\"%s\"", xml_normalize_string(start + 1));

	/* append bios and runnable flags */
	if (game->flags & GAME_IS_BIOS_ROOT)
		fprintf(out, " isbios=\"yes\"");
	if (game->flags & GAME_NO_STANDALONE)
		fprintf(out, " runnable=\"no\"");

	/* display clone information */
	clone_of = driver_get_clone(game);
	if (clone_of != NULL && !(clone_of->flags & GAME_IS_BIOS_ROOT))
		fprintf(out, " cloneof=\"%s\"", xml_normalize_string(clone_of->name));
	if (clone_of != NULL)
		fprintf(out, " romof=\"%s\"", xml_normalize_string(clone_of->name));

	/* display sample information and close the game tag */
	print_game_sampleof(out, game, config);
	fprintf(out, ">\n");

	/* output game description */
	if (game->description != NULL)
		fprintf(out, "\t\t<description>%s</description>\n", xml_normalize_string(game->description));

	/* print the year only if is a number */
	if (game->year != NULL && strspn(game->year, "0123456789") == strlen(game->year))
		fprintf(out, "\t\t<year>%s</year>\n", xml_normalize_string(game->year));

	/* print the manufacturer information */
	if (game->manufacturer != NULL)
		fprintf(out, "\t\t<manufacturer>%s</manufacturer>\n", xml_normalize_string(game->manufacturer));

	/* now print various additional information */
	print_game_bios(out, game);
	print_game_rom(out, game, config);
	print_game_sample(out, game, config);
	print_game_chips(out, game, config);
	print_game_display(out, game, config);
	print_game_sound(out, game, config);
	print_game_input(out, game, portconfig);
	print_game_switches(out, game, portconfig);
	print_game_configs(out, game, portconfig);
#ifdef MESS
	print_game_categories(out, game, portconfig);
#endif /* MESS */
	print_game_adjusters(out, game, portconfig);
	print_game_driver(out, game, config);
#ifdef MESS
	print_game_device(out, game, config);
	print_game_ramoptions(out, game, config);
#endif /* MESS */

	/* close the topmost tag */
	fprintf(out, "\t</" XML_TOP ">\n");

	input_port_config_free(portconfig);
	machine_config_free(config);
}