Exemplo n.º 1
0
/* Sets 's' to the name of the current core
 * (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
{
   struct retro_system_info    *system = runloop_get_libretro_system_info();
   const char *core_name               = system ? system->library_name    : NULL;
   const char *core_version            = system ? system->library_version : NULL;
#if _MSC_VER == 1200
   const char *extra_version = " msvc6";
#elif _MSC_VER == 1300
   const char *extra_version = " msvc2002";
#elif _MSC_VER == 1310
   const char *extra_version = " msvc2003";
#elif _MSC_VER == 1400
   const char *extra_version = " msvc2005";
#elif _MSC_VER == 1500
   const char *extra_version = " msvc2008";
#elif _MSC_VER == 1600
   const char *extra_version = " msvc2010";
#elif _MSC_VER == 1700
   const char *extra_version = " msvc2012";
#elif _MSC_VER == 1800
   const char *extra_version = " msvc2013";
#elif _MSC_VER == 1900
   const char *extra_version = " msvc2015";
#elif _MSC_VER >= 1910 && _MSC_VER < 2000
   const char *extra_version = " msvc2017";
#else
   const char *extra_version = "";
#endif

   if (string_is_empty(core_name))
      core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
   if (!core_version)
      core_version = "";

   snprintf(s, len, "%s%s - %s %s", PACKAGE_VERSION, extra_version,
         core_name, core_version);

   return 0;
}
Exemplo n.º 2
0
void ShaderParamsDialog::saveShaderPreset(const char *path, unsigned action_type)
{
   char directory[PATH_MAX_LENGTH];
   char file[PATH_MAX_LENGTH];
   char tmp[PATH_MAX_LENGTH];
   settings_t *settings             = config_get_ptr();
   struct retro_system_info *system = runloop_get_libretro_system_info();
   const char *core_name            = system ? system->library_name : NULL;

   directory[0] = file[0] = tmp[0] = '\0';

   if (!string_is_empty(core_name))
   {
      fill_pathname_join(
            tmp,
            settings->paths.directory_video_shader,
            "presets",
            sizeof(tmp));
      fill_pathname_join(
            directory,
            tmp,
            core_name,
            sizeof(directory));
   }

   if (!filestream_exists(directory))
       path_mkdir(directory);

   switch (action_type)
   {
      case SHADER_PRESET_SAVE_CORE:
         if (!string_is_empty(core_name))
            fill_pathname_join(file, directory, core_name, sizeof(file));
         break;
      case SHADER_PRESET_SAVE_GAME:
         {
            const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME));
            fill_pathname_join(file, directory, game_name, sizeof(file));
            break;
         }
      case SHADER_PRESET_SAVE_PARENT:
         fill_pathname_parent_dir_name(tmp, path_get(RARCH_PATH_BASENAME), sizeof(tmp));
         fill_pathname_join(file, directory, tmp, sizeof(file));
         break;
      case SHADER_PRESET_SAVE_NORMAL:
      default:
         if (!string_is_empty(path))
            strlcpy(file, path, sizeof(file));
         break;
   }

   if (menu_shader_manager_save_preset(file, false, true))
      runloop_msg_queue_push(
            msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY),
            1, 100, true, NULL,
            MESSAGE_QUEUE_ICON_DEFAULT,
            MESSAGE_QUEUE_CATEGORY_INFO
            );
   else
      runloop_msg_queue_push(
            msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET),
            1, 100, true, NULL,
            MESSAGE_QUEUE_ICON_DEFAULT,
            MESSAGE_QUEUE_CATEGORY_ERROR
            );
}