コード例 #1
0
static int action_start_remap_file_load(unsigned type, const char *label,
      unsigned action)
{
   settings_t *settings = config_get_ptr();

   settings->input.remapping_path[0] = '\0';
   input_remapping_set_defaults();
   return 0;
}
コード例 #2
0
ファイル: menu_cbs_start.c プロジェクト: jwarby/RetroArch
static int action_start_remap_file_load(unsigned type, const char *label)
{
   global_t *global = global_get_ptr();

   if (!global)
      return -1;

   global->name.remapfile[0] = '\0';
   input_remapping_set_defaults();
   return 0;
}
コード例 #3
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;
}
コード例 #4
0
ファイル: menu_cbs_start.c プロジェクト: netux79/RetroArch
static int action_start_remap_file_load(unsigned type, const char *label)
{
   input_remapping_set_defaults(true);
   return 0;
}