예제 #1
0
void config_save_settings(void)
{
    mame_file_error filerr;
    config_type *type;
    mame_file *file;
    char *fname;

    /* loop over all registrants and call their init function */
    for (type = typelist; type; type = type->next)
        (*type->save)(CONFIG_TYPE_INIT, NULL);

    /* save the defaults file */
    filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
    if (filerr == FILERR_NONE)
    {
        config_save_xml(file, CONFIG_TYPE_DEFAULT);
        mame_fclose(file);
    }

    /* finally, save the game-specific file */
    fname = assemble_2_strings(Machine->basename, ".cfg");
    filerr = mame_fopen(SEARCHPATH_CONFIG, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
    free(fname);

    if (filerr == FILERR_NONE)
    {
        config_save_xml(file, CONFIG_TYPE_GAME);
        mame_fclose(file);
    }

    /* loop over all registrants and call their final function */
    for (type = typelist; type; type = type->next)
        (*type->save)(CONFIG_TYPE_FINAL, NULL);
}
예제 #2
0
파일: config.c 프로젝트: crazii/mameplus
void config_save_settings(running_machine &machine)
{
	config_type *type;

	/* loop over all registrants and call their init function */
	for (type = typelist; type; type = type->next)
		type->save(CONFIG_TYPE_INIT, NULL);

	/* save the defaults file */
	emu_file file(machine.options().cfg_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
	file_error filerr = file.open("default.cfg");
	if (filerr == FILERR_NONE)
		config_save_xml(machine, file, CONFIG_TYPE_DEFAULT);

	/* finally, save the game-specific file */
	filerr = file.open(machine.basename(), ".cfg");
	if (filerr == FILERR_NONE)
		config_save_xml(machine, file, CONFIG_TYPE_GAME);

	/* loop over all registrants and call their final function */
	for (type = typelist; type; type = type->next)
		type->save(CONFIG_TYPE_FINAL, NULL);
}