Exemplo n.º 1
0
/* Return TiLP version number */
int rcfile_get_version(char *version)
{
	FILE *txt;
	char buffer[256];
	int i = 0;
	char *p;

	strcpy(version, "");
	if (rcfile_exist() == 0) {
		return -1;
	}

	rcfile_get_path(&rc_file);

	txt = fopen(rc_file, "rt");
	g_free(rc_file);
	if (txt == NULL)
		return -1;

	for (i = 0; i < 5; i++)
		if (!fgets(buffer, 256, txt))
		{
			fclose(txt);
			return -1;
		}

	p = strchr(buffer, '=');
	if (p == NULL)
	{
		fclose(txt);
		return -1;
	}

	strcpy(version, ++p);

	p = strchr(version, '\r');
	if (p)
		*p = '\0';

	p = strchr(version, '\n');
	if (p)
		*p = '\0';

	if (fclose(txt))
		return -1;

	return 0;
}
Exemplo n.º 2
0
gint display_save_state_dbox(void)
{
    const gchar *filename;
	int err;
	gchar *file_basename;
	gchar *dot;
	gchar *pattern;

    // get filename
	file_basename = g_path_get_basename(params.rom_file);
	dot = strrchr(file_basename, '.');
	if(dot != NULL)
		*dot = '\0';
	pattern = g_strconcat(file_basename, ".sav", NULL);
	g_free(file_basename);

	filename = create_fsel(inst_paths.img_dir, pattern, (char *)"*.sav", TRUE);
	g_free(pattern);
	if (!filename)
		return 0;

    g_free(params.sav_file);
    params.sav_file = g_strdup(filename);
    err = ti68k_state_save(params.sav_file);
	handle_error();
    
    if(!rcfile_exist())
    {
        rcfile_write();
   
#ifdef __WIN32__
        msg_box1(_("Information"), 
	      _("You do not seem to have saved your settings. Configuration file saved (in tiemu.ini)."));
#else
		msg_box1(_("Information"), 
	      _("You do not seem to have saved your settings. Configuration file saved (in ~/.tiemu)."));
#endif
    }

	return 0;
}