Exemplo n.º 1
0
void Config_LoadConfig(void)
{
   FILE *f;
   char line[4096];

   // default configuration
   Config_SetDefault();

   // __LIBRETRO__: Get screen size
   config.screen.width = screen_width;
   config.screen.height = screen_height;


   // read configuration
   const char *filename = ConfigGetSharedDataFilepath("gles2n64.conf");
   f = fopen(filename, "r");
   if (!f)
   {
      if (log_cb)
      {
         log_cb(RETRO_LOG_WARN, "[gles2N64]: Couldn't open config file '%s' for reading: %s\n", filename, strerror( errno ) );
         log_cb(RETRO_LOG_WARN, "[gles2N64]: Attempting to write new Config \n");
      }
      Config_WriteConfig(filename);
   }
   else
   {
      if (log_cb)
         log_cb(RETRO_LOG_INFO, "[gles2n64]: Loading Config from %s \n", filename);

      while (!feof( f ))
      {
         char *val;
         fgets( line, 4096, f );

         if (line[0] == '#' || line[0] == '\n')
            continue;

         val = strchr( line, '=' );
         if (!val) continue;

         *val++ = '\0';

         Config_SetOption(line,val);
      }

      if (config.version < CONFIG_VERSION)
      {
         if (log_cb)
            log_cb(RETRO_LOG_WARN, "[gles2N64]: Wrong config version, rewriting config with defaults\n");
         Config_SetDefault();
         Config_WriteConfig(filename);
      }

      fclose(f);
   }
}
Exemplo n.º 2
0
void Config_LoadConfig()
{
    FILE *f;
    char line[4096];

    // default configuration
    Config_SetDefault();

    // read configuration
    char filename[PATH_MAX];
    snprintf(filename, PATH_MAX, "%s/gles2n64.conf", GetPluginDir());
    f = fopen(filename, "r");
    if (!f)
    {
        LOG(LOG_MINIMAL, "[gles2N64]: Couldn't open config file '%s' for reading: %s\n", filename, strerror( errno ) );
        LOG(LOG_MINIMAL, "[gles2N64]: Attempting to write new Config \n");
        Config_WriteConfig(filename);
    }
    else
    {
        LOG(LOG_MINIMAL, "[gles2n64]: Loading Config from %s \n", filename);

        while (!feof( f ))
        {
            char *val;
            fgets( line, 4096, f );

            if (line[0] == '#' || line[0] == '\n')
                continue;

            val = strchr( line, '=' );
            if (!val) continue;

            *val++ = '\0';

             Config_SetOption(line,val);
        }

        if (config.version < CONFIG_VERSION)
        {
            LOG(LOG_WARNING, "[gles2N64]: Wrong config version, rewriting config with defaults\n");
            Config_SetDefault();
            Config_WriteConfig(filename);
        }

        fclose(f);
    }
}
Exemplo n.º 3
0
void Config_DoConfig(HWND)
{
    FILE *f = fopen("./config/gles2n64.conf", "r" );
    if (!f)
    {
        Config_SetDefault();
        Config_WriteConfig("./config/gles2n64.conf");
    }
    else
        fclose(f);

    system("mousepad ./config/gles2n64.conf");
}