int config_userdata_get_int_array(void *userdata, const char *key_str,
      int **values, unsigned *out_num_values,
      const int *default_values, unsigned num_default_values)
{
   char key[2][256];
   struct config_file_userdata *usr = (struct config_file_userdata*)userdata;
   char *str = NULL;
   fill_pathname_join_delim(key[0], usr->prefix[0], key_str, '_', sizeof(key[0]));
   fill_pathname_join_delim(key[1], usr->prefix[1], key_str, '_', sizeof(key[1]));

   if (  config_get_string(usr->conf, key[0], &str) ||
         config_get_string(usr->conf, key[1], &str))
   {
      unsigned i;
      struct string_list *list = string_split(str, " ");
      *values = (int*)calloc(list->size, sizeof(int));
      for (i = 0; i < list->size; i++)
         (*values)[i] = (int)strtod(list->elems[i].data, NULL);
      *out_num_values = list->size;
      string_list_free(list);
      free(str);
      return true;
   }

   *values = (int*)calloc(num_default_values, sizeof(int));
   memcpy(*values, default_values, sizeof(int) * num_default_values);
   *out_num_values = num_default_values;
   return false;
}
Exemplo n.º 2
0
void input_config_parse_joy_button(config_file_t *conf, const char *prefix,
      const char *btn, struct retro_keybind *bind)
{
   char str[256]      = {0};
   char tmp[64]       = {0};
   char key[64]       = {0};
   char key_label[64] = {0};
   char *tmp_a        = NULL;

   fill_pathname_join_delim(str, prefix, btn, '_', sizeof(str));
   fill_pathname_join_delim(key, str, "btn", '_', sizeof(key));
   fill_pathname_join_delim(key_label, str, "btn_label", '_', sizeof(key_label));

   if (config_get_array(conf, key, tmp, sizeof(tmp)))
   {
      btn = tmp;
      if (string_is_equal(btn, "nul"))
         bind->joykey = NO_BTN;
      else
      {
         if (*btn == 'h')
            parse_hat(bind, btn + 1);
         else
            bind->joykey = strtoull(tmp, NULL, 0);
      }
   }

   if (config_get_string(conf, key_label, &tmp_a))
   {
      strlcpy(bind->joykey_label, tmp_a, sizeof(bind->joykey_label));
      free(tmp_a);
   }
}
Exemplo n.º 3
0
static void event_main_state(unsigned cmd)
{
   char path[PATH_MAX_LENGTH] = {0};
   char msg[PATH_MAX_LENGTH]  = {0};
   global_t *global           = global_get_ptr();
   settings_t *settings       = config_get_ptr();

   if (settings->state_slot > 0)
      snprintf(path, sizeof(path), "%s%d",
            global->savestate_name, settings->state_slot);
   else if (settings->state_slot < 0)
      fill_pathname_join_delim(path, global->savestate_name, "auto", '.', sizeof(path));
   else
      strlcpy(path, global->savestate_name, sizeof(path));

   if (pretro_serialize_size())
   {
      if (cmd == EVENT_CMD_SAVE_STATE)
         event_save_state(path, msg, sizeof(msg));
      else if (cmd == EVENT_CMD_LOAD_STATE)
         event_load_state(path, msg, sizeof(msg));
   }
   else
      strlcpy(msg, "Core does not support save states.", sizeof(msg));

   rarch_main_msg_queue_push(msg, 2, 180, true);
   RARCH_LOG("%s\n", msg);
}
Exemplo n.º 4
0
static int database_info_list_iterate_found_match(
      database_state_handle_t *db_state,
      database_info_handle_t *db,
      const char *zip_name
      )
{
   char db_crc[PATH_MAX_LENGTH]                = {0};
   char db_playlist_path[PATH_MAX_LENGTH]      = {0};
   char  db_playlist_base_str[PATH_MAX_LENGTH] = {0};
   char entry_path_str[PATH_MAX_LENGTH]        = {0};
   content_playlist_t   *playlist = NULL;
   settings_t           *settings = config_get_ptr();
   const char            *db_path = db_state->list->elems[db_state->list_index].data;
   const char         *entry_path = db ? db->list->elems[db->list_ptr].data : NULL;
   database_info_t *db_info_entry = &db_state->info->list[db_state->entry_index];

   fill_short_pathname_representation(db_playlist_base_str,
         db_path, sizeof(db_playlist_base_str));

   path_remove_extension(db_playlist_base_str);

   strlcat(db_playlist_base_str, ".lpl", sizeof(db_playlist_base_str));
   fill_pathname_join(db_playlist_path, settings->playlist_directory,
         db_playlist_base_str, sizeof(db_playlist_path));

   playlist = content_playlist_init(db_playlist_path, COLLECTION_SIZE);


   snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32);

   strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));

   if (zip_name && zip_name[0] != '\0')
      fill_pathname_join_delim(entry_path_str, entry_path_str, zip_name,
            '#', sizeof(entry_path_str));

#if 0
   RARCH_LOG("Found match in database !\n");

   RARCH_LOG("Path: %s\n", db_path);
   RARCH_LOG("CRC : %s\n", db_crc);
   RARCH_LOG("Playlist Path: %s\n", db_playlist_path);
   RARCH_LOG("Entry Path: %s\n", entry_path);
   RARCH_LOG("Playlist not NULL: %d\n", playlist != NULL);
   RARCH_LOG("ZIP entry: %s\n", zip_name);
   RARCH_LOG("entry path str: %s\n", entry_path_str);
#endif

   content_playlist_push(playlist, entry_path_str,
         db_info_entry->name, "DETECT", "DETECT", db_crc, db_playlist_base_str);

   content_playlist_write_file(playlist);
   content_playlist_free(playlist);

   database_info_list_free(db_state->info);
   db_state->info = NULL;
   db_state->crc  = 0;

   return 0;
}
Exemplo n.º 5
0
static void event_main_state(unsigned cmd)
{
   char path[PATH_MAX_LENGTH] = {0};
   char msg[PATH_MAX_LENGTH]  = {0};
   global_t *global           = global_get_ptr();
   settings_t *settings       = config_get_ptr();

   if (settings->state_slot > 0)
      snprintf(path, sizeof(path), "%s%d",
            global->name.savestate, settings->state_slot);
   else if (settings->state_slot < 0)
      fill_pathname_join_delim(path,
            global->name.savestate, "auto", '.', sizeof(path));
   else
      strlcpy(path, global->name.savestate, sizeof(path));

   if (core.retro_serialize_size())
   {
      switch (cmd)
      {
         case EVENT_CMD_SAVE_STATE:
            event_save_state(path, msg, sizeof(msg));
            break;
         case EVENT_CMD_LOAD_STATE:
            event_load_state(path, msg, sizeof(msg));
            break;
      }
   }
   else
      strlcpy(msg, msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES), sizeof(msg));

   rarch_main_msg_queue_push(msg, 2, 180, true);
   RARCH_LOG("%s\n", msg);
}
Exemplo n.º 6
0
void fill_pathname_join_delim_concat(char *out_path, const char *dir,
                                     const char *path, const char delim, const char *concat,
                                     size_t size)
{
    fill_pathname_join_delim(out_path, dir, path, delim, size);
    strlcat(out_path, concat, size);
}
int config_userdata_get_int(void *userdata, const char *key_str,
      int *value, int default_value)
{
   bool got;
   char key[2][256];
   struct config_file_userdata *usr = (struct config_file_userdata*)userdata;

   fill_pathname_join_delim(key[0], usr->prefix[0], key_str, '_', sizeof(key[0]));
   fill_pathname_join_delim(key[1], usr->prefix[1], key_str, '_', sizeof(key[1]));

   got = config_get_int  (usr->conf, key[0], value);
   got = got || config_get_int(usr->conf, key[1], value);

   if (!got)
      *value = default_value;
   return got;
}
int config_userdata_get_string(void *userdata, const char *key_str,
      char **output, const char *default_output)
{
   char key[2][256];
   struct config_file_userdata *usr = (struct config_file_userdata*)userdata;
   char *str = NULL;
   fill_pathname_join_delim(key[0], usr->prefix[0], key_str, '_', sizeof(key[0]));
   fill_pathname_join_delim(key[1], usr->prefix[1], key_str, '_', sizeof(key[1]));

   if (  config_get_string(usr->conf, key[0], &str) ||
         config_get_string(usr->conf, key[1], &str))
   {
      *output = str;
      return true; 
   }

   *output = strdup(default_output);
   return false;
}
Exemplo n.º 9
0
void input_config_parse_joy_axis(void *data, const char *prefix,
      const char *axis, struct retro_keybind *bind)
{
   char str[256];
   char       tmp[64];
   char       key[64];
   char key_label[64];
   char        *tmp_a       = NULL;
   config_file_t *conf      = (config_file_t*)data;

   str[0] = tmp[0] = key[0] = key_label[0] = '\0';

   fill_pathname_join_delim(str, prefix, axis,
         '_', sizeof(str));
   fill_pathname_join_delim(key, str,
         "axis", '_', sizeof(key));
   fill_pathname_join_delim(key_label, str,
         "axis_label", '_', sizeof(key_label));

   if (config_get_array(conf, key, tmp, sizeof(tmp)))
   {
      if (string_is_equal(tmp, file_path_str(FILE_PATH_NUL)))
         bind->joyaxis = AXIS_NONE;
      else if (strlen(tmp) >= 2 && (*tmp == '+' || *tmp == '-'))
      {
         int i_axis = strtol(tmp + 1, NULL, 0);
         if (*tmp == '+')
            bind->joyaxis = AXIS_POS(i_axis);
         else
            bind->joyaxis = AXIS_NEG(i_axis);
      }

      /* Ensure that D-pad emulation doesn't screw this over. */
      bind->orig_joyaxis = bind->joyaxis;
   }

   if (config_get_string(conf, key_label, &tmp_a))
   {
      strlcpy(bind->joyaxis_label, tmp_a, sizeof(bind->joyaxis_label));
      free(tmp_a);
   }
}
Exemplo n.º 10
0
void input_config_parse_key(config_file_t *conf,
      const char *prefix, const char *btn,
      struct retro_keybind *bind)
{
   char tmp[64];
   char key[64];
   fill_pathname_join_delim(key, prefix, btn, '_', sizeof(key));

   if (config_get_array(conf, key, tmp, sizeof(tmp)))
      bind->key = input_config_translate_str_to_rk(tmp);
}
Exemplo n.º 11
0
static int action_ok_file_load(const char *path,
      const char *label, unsigned type, size_t idx)
{
   const char *menu_label   = NULL;
   const char *menu_path    = NULL;
   rarch_setting_t *setting = NULL;
   menu_handle_t *menu      = menu_driver_get_ptr();
   global_t *global         = global_get_ptr();

   if (!menu)
      return -1;

   menu_list_get_last(menu->menu_list->menu_stack,
         &menu_path, &menu_label, NULL);

   setting = menu_setting_find(menu_label);

   if (setting && setting->type == ST_PATH)
   {
      menu_action_setting_set_current_string_path(setting, menu_path, path);
      menu_list_pop_stack_by_needle(menu->menu_list, setting->name);
   }
   else
   {
      if (type == MENU_FILE_IN_CARCHIVE)
         fill_pathname_join_delim(global->fullpath, menu_path, path,
               '#',sizeof(global->fullpath));
      else
         fill_pathname_join(global->fullpath, menu_path, path,
               sizeof(global->fullpath));

      menu_entries_common_load_content(true);

      return -1;
   }

   return 0;
}
Exemplo n.º 12
0
static int fill_title(char *s, const char *title, const char *path, size_t len)
{
   fill_pathname_join_delim(s, title, path, ' ', len);
   return 0;
}
Exemplo n.º 13
0
static int database_info_list_iterate_found_match(
      database_state_handle_t *db_state,
      database_info_handle_t *db,
      const char *zip_name
      )
{
   char db_crc[PATH_MAX_LENGTH]                = {0};
   char db_playlist_path[PATH_MAX_LENGTH]      = {0};
   char  db_playlist_base_str[PATH_MAX_LENGTH] = {0};
   char entry_path_str[PATH_MAX_LENGTH]        = {0};
   playlist_t   *playlist                      = NULL;
   settings_t           *settings              = config_get_ptr();
   const char            *db_path              = 
      db_state->list->elems[db_state->list_index].data;
   const char         *entry_path              = db ? 
      db->list->elems[db->list_ptr].data : NULL;
   database_info_t *db_info_entry              = 
      &db_state->info->list[db_state->entry_index];

   fill_short_pathname_representation_noext(db_playlist_base_str,
         db_path, sizeof(db_playlist_base_str));

   strlcat(db_playlist_base_str,
         file_path_str(FILE_PATH_LPL_EXTENSION),
         sizeof(db_playlist_base_str));
   fill_pathname_join(db_playlist_path, settings->directory.playlist,
         db_playlist_base_str, sizeof(db_playlist_path));

   playlist = playlist_init(db_playlist_path, COLLECTION_SIZE);


   snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32);

   if (entry_path)
      strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));

   if (!string_is_empty(zip_name))
      fill_pathname_join_delim(entry_path_str, entry_path_str, zip_name,
            '#', sizeof(entry_path_str));

#if 0
   RARCH_LOG("Found match in database !\n");

   RARCH_LOG("Path: %s\n", db_path);
   RARCH_LOG("CRC : %s\n", db_crc);
   RARCH_LOG("Playlist Path: %s\n", db_playlist_path);
   RARCH_LOG("Entry Path: %s\n", entry_path);
   RARCH_LOG("Playlist not NULL: %d\n", playlist != NULL);
   RARCH_LOG("ZIP entry: %s\n", zip_name);
   RARCH_LOG("entry path str: %s\n", entry_path_str);
#endif

   if(!playlist_entry_exists(playlist, entry_path_str, db_crc))
   {
      playlist_push(playlist, entry_path_str,
            db_info_entry->name,
            file_path_str(FILE_PATH_DETECT),
            file_path_str(FILE_PATH_DETECT),
            db_crc, db_playlist_base_str);
   }

   playlist_write_file(playlist);
   playlist_free(playlist);

   database_info_list_free(db_state->info);

   db_state->info = NULL;
   db_state->crc  = 0;

   return 0;
}
Exemplo n.º 14
0
static int database_info_list_iterate_found_match(
      db_handle_t *_db,
      database_state_handle_t *db_state,
      database_info_handle_t *db,
      const char *archive_name
      )
{
   char *db_crc                   = (char*)malloc(128 * sizeof(char));
   char *db_playlist_base_str     = (char*)malloc(128 * sizeof(char));
   char *db_playlist_path         = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   char *entry_path_str           = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   playlist_t   *playlist         = NULL;
   const char         *db_path    =
      database_info_get_current_name(db_state);
   const char         *entry_path =
      database_info_get_current_element_name(db);
   database_info_t *db_info_entry =
      &db_state->info->list[db_state->entry_index];

   db_crc[0] = '\0';
   db_playlist_path[0] = '\0';
   db_playlist_base_str[0] = '\0';
   entry_path_str[0] = '\0';

   fill_short_pathname_representation_noext(db_playlist_base_str,
         db_path, 128 * sizeof(char));

   strlcat(db_playlist_base_str,
         file_path_str(FILE_PATH_LPL_EXTENSION),
         128 * sizeof(char));
   fill_pathname_join(db_playlist_path, _db->playlist_directory,
         db_playlist_base_str, PATH_MAX_LENGTH * sizeof(char));

   playlist = playlist_init(db_playlist_path, COLLECTION_SIZE);

   snprintf(db_crc, 128 * sizeof(char),
         "%08X|crc", db_info_entry->crc32);

   if (entry_path)
      strlcpy(entry_path_str, entry_path, 128 * sizeof(char));

   if (!string_is_empty(archive_name))
      fill_pathname_join_delim(entry_path_str,
            entry_path_str, archive_name,
            '#', 128 * sizeof(char));

#if 0
   RARCH_LOG("Found match in database !\n");

   RARCH_LOG("Path: %s\n", db_path);
   RARCH_LOG("CRC : %s\n", db_crc);
   RARCH_LOG("Playlist Path: %s\n", db_playlist_path);
   RARCH_LOG("Entry Path: %s\n", entry_path);
   RARCH_LOG("Playlist not NULL: %d\n", playlist != NULL);
   RARCH_LOG("ZIP entry: %s\n", archive_name);
   RARCH_LOG("entry path str: %s\n", entry_path_str);
#endif

   if(!playlist_entry_exists(playlist, entry_path_str, db_crc))
   {
      playlist_push(playlist, entry_path_str,
            db_info_entry->name,
            file_path_str(FILE_PATH_DETECT),
            file_path_str(FILE_PATH_DETECT),
            db_crc, db_playlist_base_str);
   }

   playlist_write_file(playlist);
   playlist_free(playlist);

   database_info_list_free(db_state->info);
   free(db_state->info);

   db_state->info = NULL;
   db_state->crc  = 0;

   free(entry_path_str);
   free(db_playlist_path);
   free(db_playlist_base_str);
   free(db_crc);

   return 0;
}
Exemplo n.º 15
0
static int action_get_title_video_shader_directory(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "SHADER DIR", path, ' ', len);
   return 0;
}
Exemplo n.º 16
0
static int action_get_title_video_filter(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "VIDEO FILTER", path, ' ', len);
   return 0;
}
Exemplo n.º 17
0
/**
 * input_remapping_save_file:
 * @path                     : Path to remapping file (relative path).
 *
 * Saves remapping values to file.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
bool input_remapping_save_file(const char *path)
{
   bool ret;
   unsigned i, j;
   char buf[PATH_MAX_LENGTH]         = {0};
   char remap_file[PATH_MAX_LENGTH]  = {0};
   config_file_t               *conf = NULL;
   settings_t              *settings = config_get_ptr();

   fill_pathname_join(buf, settings->directory.input_remapping,
         path, sizeof(buf));

   fill_pathname_noext(remap_file, buf, ".rmp", sizeof(remap_file));

   conf = config_file_new(remap_file);

   if (!conf)
   {
      conf = config_file_new(NULL);
      if (!conf)
         return false;
   }

   for (i = 0; i < settings->input.max_users; i++)
   {
      char buf[64] = {0};
      char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128]   = {{0}};
      char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] = {
         "b", "y", "select", "start",
         "up", "down", "left", "right",
         "a", "x", "l", "r", "l2", "r2",
         "l3", "r3", "l_x", "l_y", "r_x", "r_y" };

      snprintf(buf, sizeof(buf), "input_player%u", i + 1);

      for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 4; j++)
      {
         fill_pathname_join_delim(key_ident[j], buf,
               key_strings[j], '_', sizeof(key_ident[j]));

         /* only save values that have been modified */
         if(j < RARCH_FIRST_CUSTOM_BIND)
         {
            if(settings->input.remap_ids[i][j] != j)
               config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]);
            else
               config_unset(conf,key_ident[j]);
         }
         else
         {
            if(settings->input.remap_ids[i][j] != j - RARCH_FIRST_CUSTOM_BIND)
               config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]);
            else
               config_unset(conf,key_ident[j]);
         }
      }


      snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1);
      config_set_int(conf, buf, settings->input.libretro_device[i]);
      snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1);
      config_set_int(conf, buf, settings->input.analog_dpad_mode[i]);
   }

   ret = config_file_write(conf, remap_file);
   config_file_free(conf);

   return ret;
}
Exemplo n.º 18
0
static int action_get_title_recording_output_directory(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "RECORDING OUTPUT DIR", path, ' ', len);
   return 0;
}
Exemplo n.º 19
0
static int action_get_title_audio_filter_directory(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "AUDIO FILTER DIR", path, ' ', len);
   return 0;
}
Exemplo n.º 20
0
static int action_get_title_remap_file_load(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "REMAP FILE", path, ' ', len);
   return 0;
}
Exemplo n.º 21
0
void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
{
   unsigned i;
   const char *title;
   char title_noext[255];
   char *chr;
   bool hyphen_found;

   size_t list_size  = ozone_list_get_size(ozone, MENU_LIST_HORIZONTAL);

   for (i = 0; i < list_size; i++)
   {
      const char *path     = NULL;
      ozone_node_t *node   = (ozone_node_t*)file_list_get_userdata_at_offset(ozone->horizontal_list, i);

      if (!node)
      {
         node = ozone_alloc_node();
         if (!node)
            continue;
      }

      file_list_get_at_offset(ozone->horizontal_list, i,
            &path, NULL, NULL, NULL);

      if (!path)
         continue;

      if (!strstr(path, file_path_str(FILE_PATH_LPL_EXTENSION)))
         continue;

      {
         struct texture_image ti;
         char *sysname             = (char*)
            malloc(PATH_MAX_LENGTH * sizeof(char));
         char *texturepath         = (char*)
            malloc(PATH_MAX_LENGTH * sizeof(char));
         char *content_texturepath = (char*)
            malloc(PATH_MAX_LENGTH * sizeof(char));
         char *icons_path          = (char*)
            malloc(PATH_MAX_LENGTH * sizeof(char));

         strlcpy(icons_path, ozone->icons_path, PATH_MAX_LENGTH * sizeof(char));

         sysname[0] = texturepath[0] = content_texturepath[0] = '\0';

         fill_pathname_base_noext(sysname, path,
               PATH_MAX_LENGTH * sizeof(char));

         fill_pathname_join_concat(texturepath, icons_path, sysname,
               file_path_str(FILE_PATH_PNG_EXTENSION),
               PATH_MAX_LENGTH * sizeof(char));

         /* If the playlist icon doesn't exist return default */

         if (!filestream_exists(texturepath))
               fill_pathname_join_concat(texturepath, icons_path, "default",
               file_path_str(FILE_PATH_PNG_EXTENSION),
               PATH_MAX_LENGTH * sizeof(char));

         ti.width         = 0;
         ti.height        = 0;
         ti.pixels        = NULL;
         ti.supports_rgba = video_driver_supports_rgba();

         if (image_texture_load(&ti, texturepath))
         {
            if(ti.pixels)
            {
               video_driver_texture_unload(&node->icon);
               video_driver_texture_load(&ti,
                     TEXTURE_FILTER_MIPMAP_LINEAR, &node->icon);
            }

            image_texture_free(&ti);
         }

         fill_pathname_join_delim(sysname, sysname,
               file_path_str(FILE_PATH_CONTENT_BASENAME), '-',
               PATH_MAX_LENGTH * sizeof(char));
         strlcat(content_texturepath, icons_path, PATH_MAX_LENGTH * sizeof(char));

         strlcat(content_texturepath, path_default_slash(), PATH_MAX_LENGTH * sizeof(char));
         strlcat(content_texturepath, sysname, PATH_MAX_LENGTH * sizeof(char));

         /* If the content icon doesn't exist return default-content */
         if (!filestream_exists(content_texturepath))
         {
            strlcat(icons_path, path_default_slash(), PATH_MAX_LENGTH * sizeof(char));
            strlcat(icons_path, "default", PATH_MAX_LENGTH * sizeof(char));
            fill_pathname_join_delim(content_texturepath, icons_path,
                  file_path_str(FILE_PATH_CONTENT_BASENAME), '-',
                  PATH_MAX_LENGTH * sizeof(char));
         }

         if (image_texture_load(&ti, content_texturepath))
         {
            if(ti.pixels)
            {
               video_driver_texture_unload(&node->content_icon);
               video_driver_texture_load(&ti,
                     TEXTURE_FILTER_MIPMAP_LINEAR, &node->content_icon);
            }

            image_texture_free(&ti);
         }

         /* Console name */
         menu_entries_get_at_offset(
            ozone->horizontal_list,
            i,
            &title, NULL, NULL, NULL, NULL);

         fill_pathname_base_noext(title_noext, title, sizeof(title_noext));

         /* Format : "Vendor - Console"
            Remove everything before the hyphen
            and the subsequent space */
         chr          = title_noext;
         hyphen_found = false;

         while (true)
         {
            if (*chr == '-')
            {
               hyphen_found = true;
               break;
            }
            else if (*chr == '\0')
               break;

            chr++;
         }

         if (hyphen_found)
            chr += 2;
         else
            chr = title_noext;

         if (node->console_name)
            free(node->console_name);

         node->console_name = strdup(chr);

         free(sysname);
         free(texturepath);
         free(content_texturepath);
         free(icons_path);
      }
   }
}
Exemplo n.º 22
0
static int menu_action_ok(const char *menu_path,
      const char *menu_label, unsigned menu_type)
{
   const char *label = NULL;
   const char *path = NULL;
   unsigned type = 0;
   rarch_setting_t *setting_data = (rarch_setting_t *)driver.menu->list_settings;
   rarch_setting_t *setting = (rarch_setting_t*)
      setting_data_find_setting(setting_data, menu_label);

   (void)hack_shader_pass;

   if (file_list_get_size(driver.menu->selection_buf) == 0)
      return 0;

   file_list_get_at_offset(driver.menu->selection_buf,
         driver.menu->selection_ptr, &path, &label, &type);

#if 0
   RARCH_LOG("menu label: %s\n", menu_label);
   RARCH_LOG("type     : %d\n", type == MENU_FILE_USE_DIRECTORY);
   RARCH_LOG("type id  : %d\n", type);
#endif
   while (true)
   {
      switch (type)
      {
      case MENU_FILE_PLAYLIST_ENTRY:

         rarch_playlist_load_content(g_defaults.history,
               driver.menu->selection_ptr);
         menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
         return -1;

#ifdef HAVE_COMPRESSION
      case MENU_FILE_IN_CARCHIVE:
#endif
      case MENU_FILE_PLAIN:

         if (!strcmp(menu_label, "detect_core_list"))
         {
            int ret = rarch_defer_core(g_extern.core_info,
                  menu_path, path, driver.menu->deferred_path,
                  sizeof(driver.menu->deferred_path));

            if (ret == -1)
            {

               rarch_main_command(RARCH_CMD_LOAD_CORE);

               menu_common_load_content();

               return -1;
            }
            else if (ret == 0)
               menu_entries_push(driver.menu->menu_stack,
                     g_settings.libretro_directory, "deferred_core_list",
                     0, driver.menu->selection_ptr);
         }
         else if ((setting && setting->type == ST_PATH))
         {
            menu_action_setting_set_current_string_path(setting, menu_path, path);
            menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
         }
         else if (!strcmp(menu_label, "disk_image_append"))
         {
            char image[PATH_MAX];

            fill_pathname_join(image, menu_path, path, sizeof(image));
            rarch_disk_control_append_image(image);

            rarch_main_command(RARCH_CMD_RESUME);

            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
            return -1;
         }
         else
         {
            if (type == MENU_FILE_IN_CARCHIVE)
            {
               fill_pathname_join_delim(g_extern.fullpath, menu_path, path,
                     '#',sizeof(g_extern.fullpath));
            }
            else
            {
               fill_pathname_join(g_extern.fullpath, menu_path, path,
                     sizeof(g_extern.fullpath));
            }

            menu_common_load_content();
            rarch_main_command(RARCH_CMD_LOAD_CONTENT_PERSIST);
            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
            driver.menu->msg_force = true;

            return -1;
         }

         return 0;

      case MENU_FILE_CONFIG:

         {
            char config[PATH_MAX];

            fill_pathname_join(config, menu_path, path, sizeof(config));
            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
            driver.menu->msg_force = true;
            if (rarch_replace_config(config))
            {
               menu_clear_navigation(driver.menu);
               return -1;
            }
         }

         return 0;

      case MENU_FILE_FONT:
      case MENU_FILE_OVERLAY:
      case MENU_FILE_AUDIOFILTER:
      case MENU_FILE_VIDEOFILTER:

         menu_action_setting_set_current_string_path(setting, menu_path, path);
         menu_entries_pop_stack(driver.menu->menu_stack, setting->name);

         return 0;

      case MENU_FILE_SHADER_PRESET:
#ifdef HAVE_SHADER_MANAGER
         {
            char shader_path[PATH_MAX];
            fill_pathname_join(shader_path, menu_path, path, sizeof(shader_path));
            menu_shader_manager_set_preset(driver.menu->shader,
                  gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
                  shader_path);
            menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
         }
#endif
         return 0;
      case MENU_FILE_SHADER:
#ifdef HAVE_SHADER_MANAGER
         fill_pathname_join(driver.menu->shader->pass[hack_shader_pass].source.path,
               menu_path, path,
               sizeof(driver.menu->shader->pass[hack_shader_pass].source.path));

         /* This will reset any changed parameters. */
         gfx_shader_resolve_parameters(NULL, driver.menu->shader);
         menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
#endif

         return 0;

      case MENU_FILE_CORE:

         if (!strcmp(menu_label, "deferred_core_list"))
         {
            strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro));
            strlcpy(g_extern.fullpath, driver.menu->deferred_path,
                  sizeof(g_extern.fullpath));

            menu_common_load_content();

            return -1;
         }
         else if (!strcmp(menu_label, "core_list"))
         {
            fill_pathname_join(g_settings.libretro, menu_path, path,
                  sizeof(g_settings.libretro));
            rarch_main_command(RARCH_CMD_LOAD_CORE);
            menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
#if defined(HAVE_DYNAMIC)
            /* No content needed for this core, load core immediately. */
            if (driver.menu->load_no_content)
            {
               *g_extern.fullpath = '\0';
               menu_common_load_content();
               return -1;
            }

            /* Core selection on non-console just updates directory listing.
             * Will take effect on new content load. */
#elif defined(RARCH_CONSOLE)
            rarch_main_command(RARCH_CMD_RESTART_RETROARCH);
            return -1;
#endif
         }

         return 0;

      case MENU_FILE_USE_DIRECTORY:

         if (setting && setting->type == ST_DIR)
         {
            menu_action_setting_set_current_string(setting, menu_path);
            menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
         }

         return 0;

      case MENU_FILE_DIRECTORY:
      case MENU_FILE_CARCHIVE:

         {
            char cat_path[PATH_MAX];

            if (type == MENU_FILE_CARCHIVE && !strcmp(menu_label, "detect_core_list"))
            {
               file_list_push(driver.menu->menu_stack, path, "load_open_zip",
                     0, driver.menu->selection_ptr);
               return 0;
            }

            fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
            menu_entries_push(driver.menu->menu_stack,
                  cat_path, menu_label, type, driver.menu->selection_ptr);
         }

         return 0;

      }
      break;
   }

   if (menu_parse_check(label, type) == 0)
   {
      char cat_path[PATH_MAX];
      fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));

      menu_entries_push(driver.menu->menu_stack,
            cat_path, menu_label, type, driver.menu->selection_ptr);
   }

   return 0;
}
Exemplo n.º 23
0
static int action_get_title_core_directory(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "CORE DIR", path, ' ', len);
   return 0;
}
Exemplo n.º 24
0
void rarch_main_data_msg_queue_push(unsigned type,
      const char *msg, const char *msg2,
      unsigned prio, unsigned duration, bool flush)
{
   char new_msg[PATH_MAX_LENGTH];
   msg_queue_t *queue            = NULL;
   settings_t     *settings      = config_get_ptr();

   (void)settings;

   switch(type)
   {
      case DATA_TYPE_NONE:
         break;
      case DATA_TYPE_FILE:
         queue = rarch_main_data_nbio_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
      case DATA_TYPE_IMAGE:
         queue = rarch_main_data_nbio_image_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#ifdef HAVE_NETWORKING
      case DATA_TYPE_HTTP:
         queue = rarch_main_data_http_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#endif
#ifdef HAVE_OVERLAY
      case DATA_TYPE_OVERLAY:
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#endif
#ifdef HAVE_LIBRETRODB
      case DATA_TYPE_DB:
         queue = rarch_main_data_db_get_msg_queue_ptr();
         fill_pathname_join_delim(new_msg, msg, msg2, '|', sizeof(new_msg));
         break;
#endif
   }

   if (!queue)
      return;

   if (flush)
      msg_queue_clear(queue);
   msg_queue_push(queue, new_msg, prio, duration);

#ifdef HAVE_THREADS
   if (settings->threaded_data_runloop_enable)
   {
      if (!g_data_runloop.thread_inited)
         rarch_main_data_thread_init();
      else
      {
         slock_lock(g_data_runloop.cond_lock);
         scond_signal(g_data_runloop.cond);
         slock_unlock(g_data_runloop.cond_lock);
      }
   }
#endif
}
Exemplo n.º 25
0
static int action_get_title_disk_image_append(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "DISK APPEND", path, ' ', len);
   return 0;
}
Exemplo n.º 26
0
/**
 * input_remapping_save_file:
 * @path                     : Path to remapping file (relative path).
 *
 * Saves remapping values to file.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
bool input_remapping_save_file(const char *path)
{
   bool ret;
   unsigned i, j, k;
   size_t path_size                  = PATH_MAX_LENGTH * sizeof(char);
   char *buf                         = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   char *remap_file                  = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   config_file_t               *conf = NULL;
   unsigned max_users                = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
   settings_t              *settings = config_get_ptr();

   buf[0] = remap_file[0]            = '\0';

   fill_pathname_join(buf, settings->paths.directory_input_remapping,
         path, path_size);

   fill_pathname_noext(remap_file, buf, ".rmp", path_size);

   free(buf);

   conf = config_file_new(remap_file);

   if (!conf)
   {
      conf = config_file_new(NULL);
      if (!conf)
      {
         free(remap_file);
         return false;
      }
   }

   for (i = 0; i < max_users; i++)
   {
      char s1[64], s2[64], s3[64];
      char btn_ident[RARCH_FIRST_CUSTOM_BIND][128]       = {{0}};
      char key_ident[RARCH_FIRST_CUSTOM_BIND][128]       = {{0}};
      char stk_ident[8][128]                             = {{0}};

      char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][128] = {
         "b", "y", "select", "start",
         "up", "down", "left", "right",
         "a", "x", "l", "r", "l2", "r2",
         "l3", "r3", "l_x+", "l_x-", "l_y+", "l_y-", "r_x+", "r_x-", "r_y+", "r_y-" };

      s1[0] = '\0';
      s2[0] = '\0';

      snprintf(s1, sizeof(s1), "input_player%u_btn", i + 1);
      snprintf(s2, sizeof(s2), "input_player%u_key", i + 1);
      snprintf(s3, sizeof(s1), "input_player%u_stk", i + 1);

      for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 8; j++)
      {

         if(j < RARCH_FIRST_CUSTOM_BIND)
         {
            fill_pathname_join_delim(btn_ident[j], s1,
               key_strings[j], '_', sizeof(btn_ident[j]));
            fill_pathname_join_delim(key_ident[j], s2,
               key_strings[j], '_', sizeof(btn_ident[j]));

            /* only save values that have been modified */
            if(settings->uints.input_remap_ids[i][j] != j && 
               settings->uints.input_remap_ids[i][j] != RARCH_UNMAPPED)
               config_set_int(conf, btn_ident[j], settings->uints.input_remap_ids[i][j]);
            else if (settings->uints.input_remap_ids[i][j] != j && 
                     settings->uints.input_remap_ids[i][j] == RARCH_UNMAPPED)
               config_set_int(conf, btn_ident[j], -1);
            else
               config_unset(conf,btn_ident[j]);

            if (settings->uints.input_keymapper_ids[i][j] != RETROK_UNKNOWN)
               config_set_int(conf, key_ident[j], 
                  settings->uints.input_keymapper_ids[i][j]);
         }
         else
         {
            k = j - RARCH_FIRST_CUSTOM_BIND;
            fill_pathname_join_delim(stk_ident[k], s3,
               key_strings[j], '_', sizeof(stk_ident[k]));
            if(settings->uints.input_remap_ids[i][j] != j && 
               settings->uints.input_remap_ids[i][j] != RARCH_UNMAPPED)
               config_set_int(conf, stk_ident[k], 
                  settings->uints.input_remap_ids[i][j]);
            else if(settings->uints.input_remap_ids[i][j] != j && 
               settings->uints.input_remap_ids[i][j] == RARCH_UNMAPPED)
               config_set_int(conf, stk_ident[k], 
                  -1);
            else
               config_unset(conf, stk_ident[k]);
         }
      }
      snprintf(s1, sizeof(s1), "input_libretro_device_p%u", i + 1);
      config_set_int(conf, s1, input_config_get_device(i));
      snprintf(s1, sizeof(s1), "input_player%u_analog_dpad_mode", i + 1);
      config_set_int(conf, s1, settings->uints.input_analog_dpad_mode[i]);
   }

   ret = config_file_write(conf, remap_file);
   config_file_free(conf);

   free(remap_file);
   return ret;
}
Exemplo n.º 27
0
static int database_info_list_iterate_found_match(
      db_handle_t *_db,
      database_state_handle_t *db_state,
      database_info_handle_t *db,
      const char *archive_name
      )
{
   char *db_crc                   = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   char *db_playlist_base_str     = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   char *db_playlist_path         = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   char *entry_path_str           = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
   playlist_t   *playlist         = NULL;
   const char         *db_path    =
      database_info_get_current_name(db_state);
   const char         *entry_path =
      database_info_get_current_element_name(db);
   database_info_t *db_info_entry =
      &db_state->info->list[db_state->entry_index];
   char *hash;

   db_crc[0]                      = '\0';
   db_playlist_path[0]            = '\0';
   db_playlist_base_str[0]        = '\0';
   entry_path_str[0]              = '\0';

   fill_short_pathname_representation_noext(db_playlist_base_str,
         db_path, PATH_MAX_LENGTH * sizeof(char));

   strlcat(db_playlist_base_str,
         file_path_str(FILE_PATH_LPL_EXTENSION),
         PATH_MAX_LENGTH * sizeof(char));

   if (!string_is_empty(_db->playlist_directory))
      fill_pathname_join(db_playlist_path, _db->playlist_directory,
            db_playlist_base_str, PATH_MAX_LENGTH * sizeof(char));

   playlist = playlist_init(db_playlist_path, COLLECTION_SIZE);

   snprintf(db_crc, PATH_MAX_LENGTH * sizeof(char),
         "%08X|crc", db_info_entry->crc32);

   if (entry_path)
      strlcpy(entry_path_str, entry_path, PATH_MAX_LENGTH * sizeof(char));

   if (!string_is_empty(archive_name))
      fill_pathname_join_delim(entry_path_str,
            entry_path_str, archive_name,
            '#', PATH_MAX_LENGTH * sizeof(char));

   if (core_info_database_match_archive_member(
         db_state->list->elems[db_state->list_index].data) &&
       (hash = strchr(entry_path_str, '#')))
       *hash = '\0';

#if defined(RARCH_INTERNAL)
#if 0
   RARCH_LOG("Found match in database !\n");

   RARCH_LOG("Path: %s\n", db_path);
   RARCH_LOG("CRC : %s\n", db_crc);
   RARCH_LOG("Playlist Path: %s\n", db_playlist_path);
   RARCH_LOG("Entry Path: %s\n", entry_path);
   RARCH_LOG("Playlist not NULL: %d\n", playlist != NULL);
   RARCH_LOG("ZIP entry: %s\n", archive_name);
   RARCH_LOG("entry path str: %s\n", entry_path_str);
#endif
#else
   fprintf(stderr, "Found match in database !\n");

   fprintf(stderr, "Path: %s\n", db_path);
   fprintf(stderr, "CRC : %s\n", db_crc);
   fprintf(stderr, "Playlist Path: %s\n", db_playlist_path);
   fprintf(stderr, "Entry Path: %s\n", entry_path);
   fprintf(stderr, "Playlist not NULL: %d\n", playlist != NULL);
   fprintf(stderr, "ZIP entry: %s\n", archive_name);
   fprintf(stderr, "entry path str: %s\n", entry_path_str);
#endif

   if(!playlist_entry_exists(playlist, entry_path_str, db_crc))
   {
      playlist_push(playlist, entry_path_str,
            db_info_entry->name,
            file_path_str(FILE_PATH_DETECT),
            file_path_str(FILE_PATH_DETECT),
            db_crc, db_playlist_base_str);
   }

   playlist_write_file(playlist);
   playlist_free(playlist);

   database_info_list_free(db_state->info);
   free(db_state->info);

   db_state->info = NULL;
   db_state->crc  = 0;

   free(entry_path_str);
   free(db_playlist_path);
   free(db_playlist_base_str);
   free(db_crc);

   /* Move database to start since we are likely to match against it
      again */
   if (db_state->list_index != 0)
   {
      struct string_list_elem entry = db_state->list->elems[db_state->list_index];
      memmove(&db_state->list->elems[1],
              &db_state->list->elems[0],
              sizeof(entry) * db_state->list_index);
      db_state->list->elems[0] = entry;
   }

   return 0;
}
Exemplo n.º 28
0
/**
 * input_remapping_load_file:
 * @data                     : Path to config file.
 *
 * Loads a remap file from disk to memory.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
bool input_remapping_load_file(void *data, const char *path)
{
   unsigned i, j, k;
   config_file_t *conf  = (config_file_t*)data;
   settings_t *settings = config_get_ptr();
   global_t *global     = global_get_ptr();

   if (!conf ||  string_is_empty(path))
      return false;

   if (!string_is_empty(global->name.remapfile))
      input_remapping_set_defaults(true);
   global->name.remapfile = strdup(path);

   for (i = 0; i < MAX_USERS; i++)
   {
      char s1[64], s2[64], s3[64];
      char btn_ident[RARCH_FIRST_CUSTOM_BIND][128]       = {{0}};
      char key_ident[RARCH_FIRST_CUSTOM_BIND][128]       = {{0}};
      char stk_ident[8][128]                             = {{0}};

      char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][128] = {
         "b", "y", "select", "start",
         "up", "down", "left", "right",
         "a", "x", "l", "r", "l2", "r2",
         "l3", "r3", "l_x+", "l_x-", "l_y+", "l_y-", "r_x+", "r_x-", "r_y+", "r_y-" };

      old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i];
      old_libretro_device[i] = settings->uints.input_libretro_device[i];

      s1[0] = '\0';
      s2[0] = '\0';
      s3[0] = '\0';

      snprintf(s1, sizeof(s1), "input_player%u_btn", i + 1);
      snprintf(s2, sizeof(s2), "input_player%u_key", i + 1);
      snprintf(s3, sizeof(s3), "input_player%u_stk", i + 1);

      for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 8; j++)
      {
         if (j < RARCH_FIRST_CUSTOM_BIND)
         {
            int btn_remap = -1;
            int key_remap = -1;

            fill_pathname_join_delim(btn_ident[j], s1,
                  key_strings[j], '_', sizeof(btn_ident[j]));
            fill_pathname_join_delim(key_ident[j], s2,
                  key_strings[j], '_', sizeof(btn_ident[j]));

            if (config_get_int(conf, btn_ident[j], &btn_remap)
                  && btn_remap != -1)
               settings->uints.input_remap_ids[i][j] = btn_remap;
            else if (config_get_int(conf, btn_ident[j], &btn_remap)
                  && btn_remap == -1)
               settings->uints.input_remap_ids[i][j] = RARCH_UNMAPPED;
            /* else do nothing, important */

            if (config_get_int(conf, key_ident[j], &key_remap))
               settings->uints.input_keymapper_ids[i][j] = key_remap;
            else
               settings->uints.input_keymapper_ids[i][j] = RETROK_UNKNOWN;
         }
         else
         {
            int stk_remap = -1;
            k = j - RARCH_FIRST_CUSTOM_BIND;

            fill_pathname_join_delim(stk_ident[k], s3,
               key_strings[j], '$', sizeof(stk_ident[k]));

            snprintf(stk_ident[k],
                  sizeof(stk_ident[k]),
                  "%s_%s",
                  s3,
                  key_strings[j]);

            /* RARCH_LOG("pre_ident: %s:%d\n", stk_ident[j], settings->uints.input_remap_ids[i][j]); */

            if (config_get_int(conf, stk_ident[k], &stk_remap) && stk_remap != -1)
               settings->uints.input_remap_ids[i][j] = stk_remap;
            else if (config_get_int(conf, stk_ident[k], &stk_remap) && stk_remap == -1)
               settings->uints.input_remap_ids[i][j] = RARCH_UNMAPPED;
            /* else do nothing, important */

            /*RARCH_LOG("stk_ident: %s:%d\n", stk_ident[j], settings->uints.input_remap_ids[i][j]);*/
         }
      }

      snprintf(s1, sizeof(s1), "input_player%u_analog_dpad_mode", i + 1);
      CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], s1);

      snprintf(s1, sizeof(s1), "input_libretro_device_p%u", i + 1);
      CONFIG_GET_INT_BASE(conf, settings, uints.input_libretro_device[i], s1);
   }

   config_file_free(conf);

   return true;
}
Exemplo n.º 29
0
/**
 * input_remapping_load_file:
 * @data                     : Path to config file.
 *
 * Loads a remap file from disk to memory.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
bool input_remapping_load_file(void *data, const char *path)
{
   unsigned i, j;
   config_file_t *conf  = (config_file_t*)data;
   settings_t *settings = config_get_ptr();
   global_t *global     = global_get_ptr();

   if (!conf ||  string_is_empty(path))
      return false;

   strlcpy(global->name.remapfile, path,
         sizeof(global->name.remapfile));

   for (i = 0; i < MAX_USERS; i++)
   {
      char buf[64];
      char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128]   = {{0}};
      char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] =
      { "b", "y", "select", "start",
         "up", "down", "left", "right",
         "a", "x", "l", "r", "l2", "r2",
         "l3", "r3", "l_x", "l_y", "r_x", "r_y" };

      snprintf(buf, sizeof(buf), "input_player%u", i + 1);

      for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 4; j++)
      {
         int key_remap = -1;

         fill_pathname_join_delim(key_ident[j], buf,
               key_strings[j], '_', sizeof(key_ident[j]));
         if (config_get_int(conf, key_ident[j], &key_remap)
               && key_remap < RARCH_FIRST_CUSTOM_BIND)
            settings->input.remap_ids[i][j] = key_remap;
      }

      for (j = 0; j < 4; j++)
      {
         int key_remap = -1;

         snprintf(key_ident[RARCH_FIRST_CUSTOM_BIND + j],
               sizeof(key_ident[RARCH_FIRST_CUSTOM_BIND + j]),
               "%s_%s",
               buf,
               key_strings[RARCH_FIRST_CUSTOM_BIND + j]);

         if (config_get_int(conf, key_ident[RARCH_FIRST_CUSTOM_BIND + j],
                  &key_remap) && (key_remap < 4))
            settings->input.remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] =
               key_remap;
      }

      snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i + 1);
      CONFIG_GET_INT_BASE(conf, settings, input.joypad_map[i], buf);

      snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1);
      CONFIG_GET_INT_BASE(conf, settings, input.analog_dpad_mode[i], buf);

      if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &i))
      {
         snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1);
         CONFIG_GET_INT_BASE(conf, settings, input.libretro_device[i], buf);
      }
   }

   config_file_free(conf);

   return true;
}
Exemplo n.º 30
0
static int action_get_title_overlay(const char *path, const char *label, 
      unsigned menu_type, char *s, size_t len)
{
   fill_pathname_join_delim(s, "OVERLAY", path, ' ', len);
   return 0;
}