当前位置: 首页>>代码示例>>C++>>正文


C++ config_get_array函数代码示例

本文整理汇总了C++中config_get_array函数的典型用法代码示例。如果您正苦于以下问题:C++ config_get_array函数的具体用法?C++ config_get_array怎么用?C++ config_get_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了config_get_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: input_try_autoconfigure_joypad_from_conf

static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf, unsigned index, const char *name, const char *driver, bool block_osd_spam)
{
   if (!conf)
      return false;
         
   char ident[1024];
   char input_driver[1024];
   
   *ident = *input_driver = '\0';
   
   config_get_array(conf, "input_device", ident, sizeof(ident));
   config_get_array(conf, "input_driver", input_driver, sizeof(input_driver));

   if (!strcmp(ident, name) && !strcmp(driver, input_driver))
   {
      g_settings.input.autoconfigured[index] = true;
      input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[index]);

      char msg[512];
      snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.",
            index, name);

      if (!block_osd_spam)
         msg_queue_push(g_extern.msg_queue, msg, 0, 60);
      RARCH_LOG("%s\n", msg);

      return true;
   }

   return false;
}
开发者ID:AbelFlos,项目名称:RetroArch,代码行数:31,代码来源:input_common.c

示例2: input_try_autoconfigure_joypad_from_conf

static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
      unsigned idx, const char *name, const char *drv,
      int32_t vid, int32_t pid, bool block_osd_spam)
{
   char ident[PATH_MAX_LENGTH], ident_idx[PATH_MAX_LENGTH];
   char input_driver[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
   int input_vid = 0, input_pid = 0;
   bool cond_found_idx, cond_found_general,
        cond_found_vid = false, cond_found_pid = false;

   if (!conf)
      return false;

   *ident = *input_driver = '\0';

   config_get_array(conf, "input_device", ident, sizeof(ident));
   config_get_array(conf, "input_driver", input_driver, sizeof(input_driver));
   config_get_int(conf, "input_vendor_id", &input_vid);
   config_get_int(conf, "input_product_id", &input_pid);

   snprintf(ident_idx, sizeof(ident_idx), "%s_p%u", ident, idx);

#if 0
   RARCH_LOG("ident_idx: %s\n", ident_idx);
#endif

   cond_found_idx     = !strcmp(ident_idx, name);
   cond_found_general = !strcmp(ident, name) && !strcmp(drv, input_driver);
   if ((vid != 0) && (input_vid != 0))
      cond_found_vid     = (vid == input_vid);
   if ((pid != 0) && (input_pid != 0))
      cond_found_pid     = (pid == input_pid);

   /* If Vendor ID and Product ID matches, we've found our
    * entry. */
   if (cond_found_vid && cond_found_pid)
      goto found;

   /* Check for name match. */
   if (cond_found_idx)
      goto found;
   else if (cond_found_general)
      goto found;

   return false;

found:
   g_settings.input.autoconfigured[idx] = true;
   input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[idx]);

   snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.",
         idx, name);

   if (!block_osd_spam)
      rarch_main_msg_queue_push(msg, 0, 60, false);
   RARCH_LOG("%s\n", msg);

   return true;
}
开发者ID:CautiousAlbino,项目名称:RetroArch,代码行数:59,代码来源:input_autodetect.c

示例3: input_try_autoconfigure_joypad_from_conf

static int input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
      autoconfig_params_t *params)
{
   char ident[PATH_MAX_LENGTH]        = {0};
   char input_driver[PATH_MAX_LENGTH] = {0};
   int                      input_vid = 0;
   int                      input_pid = 0;
   int                          score = 0;

   if (!conf)
      return false;

   config_get_array(conf, "input_device", ident, sizeof(ident));
   config_get_array(conf, "input_driver", input_driver, sizeof(input_driver));
   config_get_int  (conf, "input_vendor_id", &input_vid);
   config_get_int  (conf, "input_product_id", &input_pid);

   /* Check for VID/PID */
   if (     (params->vid == input_vid)
         && (params->pid == input_pid)
         && params->vid != 0
         && params->pid != 0
         && input_vid   != 0
         && input_pid   != 0)
   {
      score += 3;
#if 0
      RARCH_LOG("Autodetect: VID/PID match score=%d\n", score);
#endif
   }

   /* Check for name match */
   if (string_is_equal(ident, params->name))
   {
      score += 2;
#if 0
      RARCH_LOG("Autodetect: exact name match score=%d\n", score);
#endif
   }
   else
   {
      if (!string_is_empty(ident) 
            && !strncmp(params->name, ident, strlen(ident)))
      {
         score += 1;
#if 0
         RARCH_LOG("Autodetect: partial name match score=%d\n", score);
#endif
      }
   }
#if 0
   RARCH_LOG("Autodetect: configuration file: %s score: %d\n",
         conf->path, score);
#endif
   return score;
}
开发者ID:GeneralFailer,项目名称:RetroArch,代码行数:56,代码来源:input_autodetect.c

示例4: input_autoconfigure_joypad_add

static void input_autoconfigure_joypad_add(
      config_file_t *conf,
      autoconfig_params_t *params)
{
   bool block_osd_spam;
   char msg[PATH_MAX_LENGTH] = {0};
   char display_name[PATH_MAX_LENGTH] = {0};
   char device_type[PATH_MAX_LENGTH] = {0};
   settings_t      *settings = config_get_ptr();

   config_get_array(conf, "input_device_display_name", display_name, sizeof(display_name));
   config_get_array(conf, "input_device_type", device_type, sizeof(device_type));

   if (!settings)
      return;

   /* This will be the case if input driver is reinitialized.
    * No reason to spam autoconfigure messages every time. */
   block_osd_spam = settings->input.autoconfigured[params->idx]
      && *params->name;

   settings->input.autoconfigured[params->idx] = true;
   input_autoconfigure_joypad_conf(conf,
         settings->input.autoconf_binds[params->idx]);

   if (!strcmp(device_type,"remote"))
   {
      if (display_name[0] != '\0' || strcmp(display_name, ""))
         snprintf(msg, sizeof(msg), "%s configured",
            display_name);
      else
         snprintf(msg, sizeof(msg), "%s configured",
            params->name);

      if(!remote_is_bound)
         rarch_main_msg_queue_push(msg, 0, 60, false);
      remote_is_bound = true;
   }
   else
   {
      if (display_name[0] != '\0' || strcmp(display_name, ""))
         snprintf(msg, sizeof(msg), "%s configured in port #%u.",
               display_name, params->idx);
      else
         snprintf(msg, sizeof(msg), "%s configured in port #%u.",
               params->name, params->idx);
      if (!block_osd_spam)
          rarch_main_msg_queue_push(msg, 0, 60, false);
   }

#if 0
   RARCH_LOG("Autodetect: %s\n", msg);
#endif
}
开发者ID:ioev,项目名称:RetroArch,代码行数:54,代码来源:input_autodetect.c

示例5: input_autoconfigure_joypad_try_from_conf

static int input_autoconfigure_joypad_try_from_conf(config_file_t *conf,
      autoconfig_params_t *params)
{
   char ident[256];
   char input_driver[32];
   int tmp_int                = 0;
   int              input_vid = 0;
   int              input_pid = 0;
   int                  score = 0;

   ident[0] = input_driver[0] = '\0';

   config_get_array(conf, "input_device", ident, sizeof(ident));
   config_get_array(conf, "input_driver", input_driver, sizeof(input_driver));

   if (config_get_int  (conf, "input_vendor_id", &tmp_int))
      input_vid = tmp_int;

   if (config_get_int  (conf, "input_product_id", &tmp_int))
      input_pid = tmp_int;

   if (params->vid == BLISSBOX_VID)
      input_pid = BLISSBOX_PID;

   /* Check for VID/PID */
   if (     (params->vid == input_vid)
         && (params->pid == input_pid)
         && (params->vid != 0)
         && (params->pid != 0)
         && (params->vid != BLISSBOX_VID)
         && (params->pid != BLISSBOX_PID))
      score += 3;

   /* Check for name match */
   if (!string_is_empty(params->name)
         && !string_is_empty(ident)
         && string_is_equal(ident, params->name))
      score += 2;
#if 0
   else
   {
      if (string_is_empty(params->name))
         RARCH_LOG("[Autoconf]: failed match because params->name was empty\n");
      else if (string_is_empty(ident))
         RARCH_LOG("[Autoconf]: failed match because ident was empty\n");
      else
         RARCH_LOG("[Autoconf]: failed match because ident '%s' != param->name '%s'\n",
               ident, params->name);
   }
#endif

   return score;
}
开发者ID:libretro,项目名称:RetroArch,代码行数:53,代码来源:task_autodetect.c

示例6: video_shader_parse_textures

/** 
 * video_shader_parse_textures:
 * @conf              : Preset file to read from.
 * @shader            : Shader pass handle.
 *
 * Parses shader textures.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
static bool video_shader_parse_textures(config_file_t *conf,
      struct video_shader *shader)
{
   const char *id       = NULL;
   char *save           = NULL;
   char textures[1024]  = {0};

   if (!config_get_array(conf, "textures", textures, sizeof(textures)))
      return true;

   for (id = strtok_r(textures, ";", &save);
         id && shader->luts < GFX_MAX_TEXTURES;
         shader->luts++, id = strtok_r(NULL, ";", &save))
   {
      char id_filter[64]  = {0};
      char id_wrap[64]    = {0};
      char wrap_mode[64]  = {0};
      char id_mipmap[64]  = {0};
      bool mipmap         = false;
      bool smooth         = false;

      if (!config_get_array(conf, id, shader->lut[shader->luts].path,
               sizeof(shader->lut[shader->luts].path)))
      {
         RARCH_ERR("Cannot find path to texture \"%s\" ...\n", id);
         return false;
      }

      strlcpy(shader->lut[shader->luts].id, id,
            sizeof(shader->lut[shader->luts].id));

      snprintf(id_filter, sizeof(id_filter), "%s_linear", id);
      if (config_get_bool(conf, id_filter, &smooth))
         shader->lut[shader->luts].filter = smooth ? 
            RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST;
      else
         shader->lut[shader->luts].filter = RARCH_FILTER_UNSPEC;

      snprintf(id_wrap, sizeof(id_wrap), "%s_wrap_mode", id);
      if (config_get_array(conf, id_wrap, wrap_mode, sizeof(wrap_mode)))
         shader->lut[shader->luts].wrap = wrap_str_to_mode(wrap_mode);

      snprintf(id_mipmap, sizeof(id_mipmap), "%s_mipmap", id);
      if (config_get_bool(conf, id_mipmap, &mipmap))
         shader->lut[shader->luts].mipmap = mipmap;
      else
         shader->lut[shader->luts].mipmap = false;
   }

   return true;
}
开发者ID:ioev,项目名称:RetroArch,代码行数:60,代码来源:video_shader_parse.c

示例7: input_autoconfigure_joypad_add

static void input_autoconfigure_joypad_add(
      config_file_t *conf,
      autoconfig_params_t *params)
{
   char msg[PATH_MAX_LENGTH] = {0};
   char buf[PATH_MAX_LENGTH] = {0};
   settings_t      *settings = config_get_ptr();

   config_get_array(conf, "input_display_name", buf, sizeof(buf));

   /* This will be the case if input driver is reinitialized.
    * No reason to spam autoconfigure messages every time. */
   bool block_osd_spam = settings &&
     settings->input.autoconfigured[params->idx] && *params->name;

   if (!settings)
      return;

   settings->input.autoconfigured[params->idx] = true;
   input_autoconfigure_joypad_conf(conf,
         settings->input.autoconf_binds[params->idx]);

   if (buf[0] != '\0' || strcmp(buf, ""))
      snprintf(msg, sizeof(msg), "%s configured in port #%u.",
            buf, params->idx);
   else
      snprintf(msg, sizeof(msg), "%s configured in port #%u.",
            params->name, params->idx);

      if (!block_osd_spam)
         rarch_main_msg_queue_push(msg, 0, 60, false);

   RARCH_LOG("%s\n", msg);
}
开发者ID:PS3emulators,项目名称:RetroArch,代码行数:34,代码来源:input_autodetect.c

示例8: video_shader_resolve_current_parameters

/** 
 * video_shader_set_current_parameters:
 * @conf              : Preset file to read from.
 * @shader            : Shader passes handle.
 *
 * Reads the current value for all parameters from config file.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
bool video_shader_resolve_current_parameters(config_file_t *conf,
      struct video_shader *shader)
{
   char parameters[4096];
   const char *id        = NULL;
   char *save            = NULL;

   if (!conf)
      return false;

   parameters[0] = '\0';

   /* Read in parameters which override the defaults. */
   if (!config_get_array(conf, "parameters",
            parameters, sizeof(parameters)))
      return true;

   for (id = strtok_r(parameters, ";", &save); id; 
         id = strtok_r(NULL, ";", &save))
   {
      struct video_shader_parameter *parameter = (struct video_shader_parameter*)
         video_shader_parse_find_parameter(shader->parameters, shader->num_parameters, id);

      if (!parameter)
      {
         RARCH_WARN("[CGP/GLSLP]: Parameter %s is set in the preset, but no shader uses this parameter, ignoring.\n", id);
         continue;
      }

      if (!config_get_float(conf, id, &parameter->current))
         RARCH_WARN("[CGP/GLSLP]: Parameter %s is not set in preset.\n", id);
   }
   return true;
}
开发者ID:dankcushions,项目名称:RetroArch,代码行数:43,代码来源:video_shader_parse.c

示例9: input_config_parse_joy_axis

void input_config_parse_joy_axis(config_file_t *conf, const char *prefix,
      const char *axis, struct retro_keybind *bind)
{
   char       tmp[64] = {0};
   char       key[64] = {0};
   char key_label[64] = {0};
   char        *tmp_a = NULL;

   snprintf(key, sizeof(key), "%s_%s_axis", prefix, axis);
   snprintf(key_label, sizeof(key_label), "%s_%s_axis_label", prefix, axis);

   if (config_get_array(conf, key, tmp, sizeof(tmp)))
   {
      if (!strcmp(tmp, "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));
}
开发者ID:luiseduardohdbackup,项目名称:RetroArch,代码行数:31,代码来源:input_common.c

示例10: config_get_path

bool config_get_path(config_file_t *conf, const char *key, char *buf, size_t size)
{
#if defined(_WIN32) || defined(RARCH_CONSOLE)
   return config_get_array(conf, key, buf, size);
#else
   struct entry_list *list = conf->entries;

   while (list)
   {
      if (strcmp(key, list->key) == 0)
      {
         const char *value = list->value;
         if (*value == '~')
         {
            const char *home = getenv("HOME");
            if (home)
            {
               size_t src_size = strlcpy(buf, home, size);
               if (src_size >= size)
                  return false;

               buf  += src_size;
               size -= src_size;
               value++;
            }
         }

         return strlcpy(buf, value, size) < size;
      }
      list = list->next;
   }
   return false;
#endif
}
开发者ID:mmodahl,项目名称:RetroArch,代码行数:34,代码来源:config_file.c

示例11: salamander_init

static void salamander_init(void)
{
   CellPadData pad_data;
   cellPadInit(7);

   cellPadGetData(0, &pad_data);

   if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE)
   {
      //override path, boot first executable in cores directory
      RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n");
      find_and_set_first_file();
   }
   else
   {
      //normal executable loading path
      char tmp_str[PATH_MAX];
      bool config_file_exists = false;

      if (path_file_exists(config_path))
         config_file_exists = true;

      //try to find CORE executable
      char core_executable[1024];
      fill_pathname_join(core_executable, default_paths.core_dir, "CORE.SELF", sizeof(core_executable));

      if(path_file_exists(core_executable))
      {
         //Start CORE executable
         strlcpy(libretro_path, core_executable, sizeof(libretro_path));
         RARCH_LOG("Start [%s].\n", libretro_path);
      }
      else
      {
         if (config_file_exists)
         {
            config_file_t * conf = config_file_new(config_path);
            config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
            config_file_free(conf);
            strlcpy(libretro_path, tmp_str, sizeof(libretro_path));
         }

         if (!config_file_exists || !strcmp(libretro_path, ""))
            find_and_set_first_file();
         else
            RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);

         if (!config_file_exists)
         {
            config_file_t *new_conf = config_file_new(NULL);
            config_set_string(new_conf, "libretro_path", libretro_path);
            config_file_write(new_conf, config_path);
            config_file_free(new_conf);
         }
      }
   }

   cellPadEnd();

}
开发者ID:AampApps,项目名称:RetroArch,代码行数:60,代码来源:platform_ps3.c

示例12: input_config_parse_joy_button

void input_config_parse_joy_button(config_file_t *conf, const char *prefix,
      const char *btn, struct retro_keybind *bind)
{
   char tmp[64]       = {0};
   char key[64]       = {0};
   char key_label[64] = {0};
   char *tmp_a        = NULL;

   snprintf(key, sizeof(key), "%s_%s_btn", prefix, btn);
   snprintf(key_label, sizeof(key_label), "%s_%s_btn_label", prefix, btn);

   if (config_get_array(conf, key, tmp, sizeof(tmp)))
   {
      btn = tmp;
      if (!strcmp(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));
}
开发者ID:luiseduardohdbackup,项目名称:RetroArch,代码行数:28,代码来源:input_common.c

示例13: input_config_parse_joy_button

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);
   }
}
开发者ID:AkimanBengus,项目名称:RetroArch,代码行数:33,代码来源:input_config.c

示例14: input_config_parse_key

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];
   snprintf(key, sizeof(key), "%s_%s", prefix, btn);

   if (config_get_array(conf, key, tmp, sizeof(tmp)))
      bind->key = find_sk_key(tmp);
}
开发者ID:AbelFlos,项目名称:RetroArch,代码行数:10,代码来源:input_common.c

示例15: input_config_parse_key

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);
}
开发者ID:AkimanBengus,项目名称:RetroArch,代码行数:11,代码来源:input_config.c


注:本文中的config_get_array函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。