Esempio n. 1
0
/**
 * rarch_main_data_http_iterate_transfer:
 *
 * Resumes HTTP transfer update.
 *
 * Returns: 0 when finished, -1 when we should continue
 * with the transfer on the next frame.
 **/
static int rarch_main_data_http_iterate_transfer(void *data)
{
   http_handle_t *http = (http_handle_t*)data;
   size_t pos  = 0, tot = 0;
   int percent = 0;

   if (!net_http_update(http->handle, &pos, &tot))
   {
      if(tot != 0)
         percent = (unsigned long long)pos * 100
            / (unsigned long long)tot;

      if (percent > 0)
      {
         char tmp[PATH_MAX_LENGTH];
         snprintf(tmp, sizeof(tmp), "%s: %d%%",
               msg_hash_to_str(MSG_DOWNLOAD_PROGRESS),
               percent);
         data_runloop_osd_msg(tmp, sizeof(tmp));
      }

      return -1;
   }

   return 0;
}
Esempio n. 2
0
/**
 * rarch_main_data_http_iterate_transfer:
 *
 * Resumes HTTP transfer update.
 *
 * Returns: 0 when finished, -1 when we should continue
 * with the transfer on the next frame.
 **/
static int rarch_main_data_http_iterate_transfer(void *data)
{
    http_handle_t *http = (http_handle_t*)data;
    size_t pos = 0, tot = 0;
    int percent = 0;
    if (!net_http_update(http->handle, &pos, &tot))
    {
        if(tot != 0)
            percent=(unsigned long long)pos*100/(unsigned long long)tot;
        else
            percent=0;
        
        if (percent > 0)
        {
            char tmp[PATH_MAX_LENGTH] = {0};
            snprintf(tmp, sizeof(tmp), "Download progress: %d%%", percent);
            data_runloop_osd_msg(tmp, sizeof(tmp));
        }
        
        return -1;
    }
    
    return 0;
}