mirror of
https://github.com/libretro/RetroArch
synced 2025-02-01 00:32:46 +00:00
Refactors
This commit is contained in:
parent
68a0f98096
commit
8d6e5811f2
28
http_intf.c
28
http_intf.c
@ -23,6 +23,28 @@
|
|||||||
|
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http_get_file:
|
||||||
|
* @url : URL to file.
|
||||||
|
* @buf : Buffer.
|
||||||
|
* @len : Size of @buf.
|
||||||
|
*
|
||||||
|
* Loads the contents of a file at specified URL into
|
||||||
|
* buffer @buf. Sets length of data buffer as well.
|
||||||
|
*
|
||||||
|
* Returns: HTTP return code on success, otherwise
|
||||||
|
* negative on failure.
|
||||||
|
**/
|
||||||
|
http_retcode http_get_file(char *url, char **buf, int *len)
|
||||||
|
{
|
||||||
|
char *urlfilename = NULL;
|
||||||
|
|
||||||
|
if (!http_parse_url(url, &urlfilename))
|
||||||
|
return ERRRDDT;
|
||||||
|
|
||||||
|
return http_get(urlfilename, buf, len, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http_download_file:
|
* http_download_file:
|
||||||
* @url : URL to file.
|
* @url : URL to file.
|
||||||
@ -40,11 +62,9 @@ bool http_download_file(char *url, const char *output_dir,
|
|||||||
int len;
|
int len;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char output_path[PATH_MAX_LENGTH];
|
char output_path[PATH_MAX_LENGTH];
|
||||||
char *buf, *urlfilename = NULL;
|
char *buf;
|
||||||
|
|
||||||
http_parse_url(url, &urlfilename);
|
status = http_get_file(url, &buf, &len);
|
||||||
|
|
||||||
status = http_get(urlfilename, &buf, &len, NULL);
|
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
|
22
http_intf.h
22
http_intf.h
@ -21,6 +21,10 @@
|
|||||||
#include "netplay_compat.h"
|
#include "netplay_compat.h"
|
||||||
#include "http_lib.h"
|
#include "http_lib.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
HTTP_INTF_ERROR = 0,
|
HTTP_INTF_ERROR = 0,
|
||||||
@ -30,6 +34,20 @@ enum
|
|||||||
HTTP_INTF_HEAD
|
HTTP_INTF_HEAD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http_get_file:
|
||||||
|
* @url : URL to file.
|
||||||
|
* @buf : Buffer.
|
||||||
|
* @len : Size of @buf.
|
||||||
|
*
|
||||||
|
* Loads the contents of a file at specified URL into
|
||||||
|
* buffer @buf. Sets length of data buffer as well.
|
||||||
|
*
|
||||||
|
* Returns: HTTP return code on success, otherwise
|
||||||
|
* negative on failure.
|
||||||
|
**/
|
||||||
|
http_retcode http_get_file(char *url, char **buf, int *len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http_download_file:
|
* http_download_file:
|
||||||
* @url : URL to file.
|
* @url : URL to file.
|
||||||
@ -45,4 +63,8 @@ bool http_download_file(char *url, const char *output_dir,
|
|||||||
|
|
||||||
int http_intf_command(unsigned mode, char *url);
|
int http_intf_command(unsigned mode, char *url);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,9 @@
|
|||||||
#include "../retroarch.h"
|
#include "../retroarch.h"
|
||||||
#include "../performance.h"
|
#include "../performance.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_NETPLAY
|
||||||
#include "../http_intf.h"
|
#include "../http_intf.h"
|
||||||
|
#endif
|
||||||
#include "../input/input_remapping.h"
|
#include "../input/input_remapping.h"
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
@ -803,10 +805,12 @@ static int generic_action_ok_command(unsigned cmd)
|
|||||||
static int action_ok_core_manager_list(const char *path,
|
static int action_ok_core_manager_list(const char *path,
|
||||||
const char *label, unsigned type, size_t idx)
|
const char *label, unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_NETPLAY
|
||||||
char url[] = "http://buildbot.libretro.com/nightly/android/latest/armeabi-v7a/2048_libretro.so.zip";
|
char url[] = "http://buildbot.libretro.com/nightly/android/latest/armeabi-v7a/2048_libretro.so.zip";
|
||||||
|
|
||||||
if (!http_download_file(url, g_settings.libretro_info_path, "2048_libretro.so.zip"))
|
if (!http_download_file(url, g_settings.libretro_info_path, "2048_libretro.so.zip"))
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user