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


C++ runloop_msg_queue_push函数代码示例

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


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

示例1: hangup

/**
 * hangup:
 *
 * Disconnects an active Netplay connection due to an error
 **/
static void hangup(netplay_t *netplay)
{
   if (!netplay)
      return;
   if (!netplay->has_connection)
      return;

   RARCH_WARN("Netplay has disconnected. Will continue without connection ...\n");
   runloop_msg_queue_push("Netplay has disconnected. Will continue without connection.", 0, 480, false);

   socket_close(netplay->fd);
   netplay->fd = -1;

   if (netplay->is_server && !netplay->spectate.enabled)
   {
      /* In server mode, make the socket listen for a new connection */
      if (!init_socket(netplay, NULL, netplay->tcp_port))
      {
         RARCH_WARN("Failed to reinitialize Netplay.\n");
         runloop_msg_queue_push("Failed to reinitialize Netplay.", 0, 480, false);
      }
   }

   netplay->has_connection = false;

   /* Reset things that will behave oddly if we get a new connection */
   netplay->remote_paused  = false;
   netplay->flip           = false;
   netplay->flip_frame     = 0;
   netplay->stall          = 0;
}
开发者ID:KitoHo,项目名称:RetroArch,代码行数:36,代码来源:netplay.c

示例2: input_autoconfigure_joypad_add

static void input_autoconfigure_joypad_add(config_file_t *conf, autoconfig_params_t *params)
{
   bool block_osd_spam;
   static bool remote_is_bound        = false;
   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 (!string_is_empty(display_name) || strcmp(display_name, ""))
         snprintf(msg, sizeof(msg), "%s configured",
            display_name);
      else
         snprintf(msg, sizeof(msg), "%s configured",
            params->name);

      if(!remote_is_bound)
         runloop_msg_queue_push(msg, 0, 60, false);
      remote_is_bound = true;
   }
   else
   {
      if (!string_is_empty(display_name) || 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)
          runloop_msg_queue_push(msg, 0, 60, false);
   }
   input_reindex_devices();
#if 0
   RARCH_LOG("Autodetect: %s\n", msg);
#endif
}
开发者ID:matthijsberk,项目名称:RetroArch,代码行数:53,代码来源:input_autodetect.c

示例3: netplay_command

/**
 * netplay_command:
 * @netplay                : pointer to netplay object
 * @cmd                    : command to send
 * @data                   : data to send as argument
 * @sz                     : size of data
 * @flags                  : flags of CMD_OPT_*
 * @command_str            : name of action
 * @success_msg            : message to display upon success
 *
 * Sends a single netplay command and waits for response.
 */
bool netplay_command(netplay_t* netplay, enum netplay_cmd cmd,
                     void* data, size_t sz,
                     uint32_t flags,
                     const char* command_str,
                     const char* success_msg)
{
    char m[256];
    const char* msg         = NULL;
    bool allowed_spectate   = !!(flags & CMD_OPT_ALLOWED_IN_SPECTATE_MODE);
    bool host_only          = !!(flags & CMD_OPT_HOST_ONLY);
    bool require_sync       = !!(flags & CMD_OPT_REQUIRE_SYNC);

    assert(netplay);

    if (netplay->spectate.enabled && !allowed_spectate)
    {
        msg = "Cannot %s in spectate mode.";
        goto error;
    }

    if (host_only && netplay->port == 0)
    {
        msg = "Cannot %s as a client.";
        goto error;
    }

    if(require_sync && check_netplay_synched(netplay))
    {
        msg = "Cannot %s while host and client are not in sync.";
        goto error;
    }

    if(netplay_send_raw_cmd(netplay, cmd, data, sz)) {
        if(netplay_get_response(netplay))
            runloop_msg_queue_push(success_msg, 1, 180, false);
        else
        {
            msg = "Failed to send command \"%s\"";
            goto error;
        }
    }
    return true;

error:
    snprintf(m, sizeof(m), msg, command_str);
    RARCH_WARN("%s\n", m);
    runloop_msg_queue_push(m, 1, 180, false);
    return false;
}
开发者ID:carriercomm,项目名称:RetroArch,代码行数:61,代码来源:netplay.c

示例4: runloop_check_movie_init

static bool runloop_check_movie_init(void)
{
   char msg[128]              = {0};
   char path[PATH_MAX_LENGTH] = {0};
   settings_t *settings       = config_get_ptr();

   if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
      return false;

   settings->rewind_granularity = 1;

   if (settings->state_slot > 0)
      snprintf(path, sizeof(path), "%s%d",
            bsv_movie_get_path(), settings->state_slot);
   else
      strlcpy(path, bsv_movie_get_path(), sizeof(path));

   strlcat(path,
         file_path_str(FILE_PATH_BSV_EXTENSION),
         sizeof(path));

   snprintf(msg, sizeof(msg), "%s \"%s\".",
         msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
         path);

   bsv_movie_init_handle(path, RARCH_MOVIE_RECORD);

   if (!bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
      return false;

   if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
   {
      runloop_msg_queue_push(msg, 2, 180, true);
      RARCH_LOG("%s \"%s\".\n",
            msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
            path);
   }
   else
   {
      runloop_msg_queue_push(
            msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
            2, 180, true);
      RARCH_ERR("%s\n",
            msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
   }

   return true;
}
开发者ID:tarcisiogc,项目名称:RetroArch,代码行数:48,代码来源:runloop.c

示例5: netplay_spectate_post_frame

/**
 * netplay_post_frame_spectate:   
 * @netplay              : pointer to netplay object
 *
 * Post-frame for Netplay (spectate mode version).
 * We check if we have new input and replay from recorded input.
 **/
static void netplay_spectate_post_frame(netplay_t *netplay)
{
   unsigned i;

   if (!np_is_server(netplay))
      return;

   for (i = 0; i < MAX_SPECTATORS; i++)
   {
      char msg[128];

      if (netplay->spectate.fds[i] == -1)
         continue;

      if (socket_send_all_blocking(netplay->spectate.fds[i],
               netplay->spectate.input,
               netplay->spectate.input_ptr * sizeof(int16_t)))
         continue;

      RARCH_LOG("Client (#%u) disconnected ...\n", i);

      snprintf(msg, sizeof(msg), "Client (#%u) disconnected.", i);
      runloop_msg_queue_push(msg, 1, 180, false);

      socket_close(netplay->spectate.fds[i]);
      netplay->spectate.fds[i] = -1;
      break;
   }

   netplay->spectate.input_ptr = 0;
}
开发者ID:Sotsukun,项目名称:RetroArch,代码行数:38,代码来源:netplay_spectate.c

示例6: gfx_ctx_d3d_update_title

static void gfx_ctx_d3d_update_title(void *data)
{
   char buf[128]        = {0};
   char buffer_fps[128] = {0};
   settings_t *settings = config_get_ptr();
   HWND         window  = win32_get_window();

   if (video_monitor_get_fps(buf, sizeof(buf),
            buffer_fps, sizeof(buffer_fps)))
   {
#ifndef _XBOX
      SetWindowText(window, buf);
#endif
   }

   if (settings->fps_show)
   {
#ifdef _XBOX
      MEMORYSTATUS stat;
      char mem[128] = {0};

      GlobalMemoryStatus(&stat);
      snprintf(mem, sizeof(mem), "|| MEM: %.2f/%.2fMB",
            stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
      strlcat(buffer_fps, mem, sizeof(buffer_fps));
#endif
      runloop_msg_queue_push(buffer_fps, 1, 1, false);
   }
}
开发者ID:AlexFolland,项目名称:RetroArch,代码行数:29,代码来源:d3d_ctx.cpp

示例7: task_database_iterate_start

static int task_database_iterate_start(database_info_handle_t *db,
      const char *name)
{
   char msg[511];

   msg[0] = msg[510] = '\0';

   snprintf(msg, sizeof(msg),
         STRING_REP_USIZE "/" STRING_REP_USIZE ": %s %s...\n",
         (size_t)db->list_ptr,
         (size_t)db->list->size,
         msg_hash_to_str(MSG_SCANNING),
         name);

   if (!string_is_empty(msg))
   {
#ifdef RARCH_INTERNAL
      runloop_msg_queue_push(msg, 1, 180, true);
#else
      fprintf(stderr, "msg: %s\n", msg);
#endif
   }

   db->status = DATABASE_STATUS_ITERATE;

   return 0;
}
开发者ID:DoctorGoat,项目名称:RetroArch_LibNX,代码行数:27,代码来源:task_database.c

示例8: task_database_iterate_start

static int task_database_iterate_start(database_info_handle_t *db,
      const char *name)
{
   char msg[128] = {0};

   snprintf(msg, sizeof(msg),
         STRING_REP_ULONG "/" STRING_REP_ULONG ": %s %s...\n",
#if defined(_WIN32) || defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
         db->list_ptr,
         db->list->size,
#else
         (unsigned long)db->list_ptr,
         (unsigned long)db->list->size,
#endif
         msg_hash_to_str(MSG_SCANNING),
         name);

   if (!string_is_empty(msg))
      runloop_msg_queue_push(msg, 1, 180, true);

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


   db->status = DATABASE_STATUS_ITERATE;

   return 0;
}
开发者ID:Rodriguez012,项目名称:RetroArch,代码行数:29,代码来源:task_database.c

示例9: event_load_auto_state

static void event_load_auto_state(void)
{
   bool ret;
   char msg[128]                             = {0};
   char savestate_name_auto[PATH_MAX_LENGTH] = {0};
   settings_t *settings = config_get_ptr();
   global_t   *global   = global_get_ptr();

#ifdef HAVE_NETPLAY
   if (global->netplay.enable && !global->netplay.is_spectate)
      return;
#endif

   if (!settings->savestate_auto_load)
      return;

   fill_pathname_noext(savestate_name_auto, global->name.savestate,
         ".auto", sizeof(savestate_name_auto));

   if (!path_file_exists(savestate_name_auto))
      return;

   ret = load_state(savestate_name_auto);

   RARCH_LOG("Found auto savestate in: %s\n", savestate_name_auto);

   snprintf(msg, sizeof(msg), "Auto-loading savestate from \"%s\" %s.",
         savestate_name_auto, ret ? "succeeded" : "failed");
   runloop_msg_queue_push(msg, 1, 180, false);
   RARCH_LOG("%s\n", msg);
}
开发者ID:Sotsukun,项目名称:RetroArch,代码行数:31,代码来源:command_event.c

示例10: input_config_autoconfigure_joypad

bool input_config_autoconfigure_joypad(autoconfig_params_t *params)
{
   char msg[PATH_MAX_LENGTH];

   if (!input_config_autoconfigure_joypad_init(params))
      goto error;

   if (!*params->name)
      goto error;

   if (input_autoconfigure_joypad_from_conf_dir(params))
      return true;
#if defined(HAVE_BUILTIN_AUTOCONFIG)
   if (input_autoconfigure_joypad_from_conf_internal(params))
      return true;
#endif

   RARCH_LOG("Autodetect: no profiles found for %s (%d/%d)\n",
         params->name, params->vid, params->pid);
   snprintf(msg, sizeof(msg), "%s (%ld/%ld) not configured",
         params->name, (long)params->vid, (long)params->pid);
   runloop_msg_queue_push(msg, 0, 60, false);

error:
   return false;
}
开发者ID:GeneralFailer,项目名称:RetroArch,代码行数:26,代码来源:input_autodetect.c

示例11: connmanctl_scan

static void connmanctl_scan(void)
{
   char line[512];
   union string_list_elem_attr attr;
   FILE *serv_file                  = NULL;

   attr.i = RARCH_FILETYPE_UNSET;
   if (lines)
      free(lines);
   lines = string_list_new();

   pclose(popen("connmanctl enable wifi", "r"));

   pclose(popen("connmanctl scan wifi", "r"));

   runloop_msg_queue_push("Wi-Fi scan complete.", 1, 180, true);

   serv_file = popen("connmanctl services", "r");
   while (fgets (line, 512, serv_file) != NULL)
   {
      size_t len = strlen(line);
      if (len > 0 && line[len-1] == '\n')
         line[--len] = '\0';

      string_list_append(lines, line, attr);
   }
   pclose(serv_file);
}
开发者ID:Ezio-PS,项目名称:RetroArch,代码行数:28,代码来源:connmanctl.c

示例12: event_main_state

static void event_main_state(unsigned cmd)
{
   char path[PATH_MAX_LENGTH] = {0};
   char msg[128]              = {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));

   runloop_msg_queue_push(msg, 2, 180, true);
   RARCH_LOG("%s\n", msg);
}
开发者ID:Sotsukun,项目名称:RetroArch,代码行数:34,代码来源:command_event.c

示例13: driver_update_system_av_info

/**
 * driver_update_system_av_info:
 * @data               : pointer to new A/V info
 *
 * Update the system Audio/Video information.
 * Will reinitialize audio/video drivers.
 * Used by RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO.
 *
 * Returns: true (1) if successful, otherwise false (0).
 **/
static bool driver_update_system_av_info(const struct retro_system_av_info *info)
{
   struct retro_system_av_info *av_info    = video_viewport_get_system_av_info();
   settings_t *settings = config_get_ptr();

   memcpy(av_info, info, sizeof(*av_info));
   command_event(CMD_EVENT_REINIT, NULL);

   /* Cannot continue recording with different parameters.
    * Take the easiest route out and just restart the recording. */
   if (recording_driver_get_data_ptr())
   {
      runloop_msg_queue_push(
            msg_hash_to_str(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT),
            2, 180, false);
      command_event(CMD_EVENT_RECORD_DEINIT, NULL);
      command_event(CMD_EVENT_RECORD_INIT, NULL);
   }

   /* Hide mouse cursor in fullscreen after 
    * a RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO call. */
   if (settings->bools.video_fullscreen)
      video_driver_hide_mouse();

   return true;
}
开发者ID:gouchi,项目名称:RetroArch,代码行数:36,代码来源:driver.c

示例14: menu_content_load

static bool menu_content_load(void)
{
   content_ctx_info_t content_info;
   char name[PATH_MAX_LENGTH];
   char msg[PATH_MAX_LENGTH];
   bool msg_force       = true;
   char *fullpath       = NULL;

   runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
   /* redraw menu frame */
   menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
   menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);

   if (*fullpath)
      fill_pathname_base(name, fullpath, sizeof(name));

   content_info.argc        = 0;
   content_info.argv        = NULL;
   content_info.args        = NULL;
   content_info.environ_get = menu_content_environment_get;

   if (!content_ctl(CONTENT_CTL_LOAD, &content_info))
      goto error;

   if (*fullpath)
   {
      snprintf(msg, sizeof(msg), "INFO - Loading %s ...", name);
      runloop_msg_queue_push(msg, 1, 1, false);
   }

   if (*fullpath || 
         menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
   {
      struct retro_system_info *info = NULL;
      menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
            &info);
      content_push_to_history_playlist(true, fullpath, info);
      content_playlist_write_file(g_defaults.history);
   }

   return true;

error:
   snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
   runloop_msg_queue_push(msg, 1, 90, false);
   return false;
}
开发者ID:spielvan,项目名称:RetroArch,代码行数:47,代码来源:menu_content.c

示例15: input_config_autoconfigure_disconnect

void input_config_autoconfigure_disconnect(unsigned i, const char *ident)
{
   char msg[PATH_MAX_LENGTH];

   snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", i, ident);
   runloop_msg_queue_push(msg, 0, 60, false);
   RARCH_LOG("Autodetect: %s\n", msg);
}
开发者ID:GeneralFailer,项目名称:RetroArch,代码行数:8,代码来源:input_autodetect.c


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