mirror of
https://github.com/libretro/RetroArch
synced 2025-04-24 15:02:35 +00:00
Style / indent nits
This commit is contained in:
parent
b423408005
commit
aade2b45ef
@ -14,7 +14,8 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Prefix header for all source files of the 'RetroArch' target in the 'RetroArch' project
|
/* Prefix header for all source files of the 'RetroArch'
|
||||||
|
* target in the 'RetroArch' project. */
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
#import <Availability.h>
|
#import <Availability.h>
|
||||||
|
@ -80,8 +80,8 @@ static int parse_short(const char *optstring, char * const *argv)
|
|||||||
bool extra_opt = argv[0][2];
|
bool extra_opt = argv[0][2];
|
||||||
bool takes_arg = opt[1] == ':';
|
bool takes_arg = opt[1] == ':';
|
||||||
|
|
||||||
// If we take an argument, and we see additional characters,
|
/* If we take an argument, and we see additional characters,
|
||||||
// this is in fact the argument (i.e. -cfoo is same as -c foo).
|
* this is in fact the argument (i.e. -cfoo is same as -c foo). */
|
||||||
bool embedded_arg = extra_opt && takes_arg;
|
bool embedded_arg = extra_opt && takes_arg;
|
||||||
|
|
||||||
if (takes_arg)
|
if (takes_arg)
|
||||||
@ -99,8 +99,11 @@ static int parse_short(const char *optstring, char * const *argv)
|
|||||||
|
|
||||||
return optarg ? opt[0] : '?';
|
return optarg ? opt[0] : '?';
|
||||||
}
|
}
|
||||||
else if (embedded_arg) // If we see additional characters, and they don't take arguments, this means we have multiple flags in one.
|
else if (embedded_arg)
|
||||||
{
|
{
|
||||||
|
/* If we see additional characters,
|
||||||
|
* and they don't take arguments, this
|
||||||
|
* means we have multiple flags in one. */
|
||||||
memmove(&argv[0][1], &argv[0][2], strlen(&argv[0][2]) + 1);
|
memmove(&argv[0][1], &argv[0][2], strlen(&argv[0][2]) + 1);
|
||||||
return opt[0];
|
return opt[0];
|
||||||
}
|
}
|
||||||
@ -127,7 +130,7 @@ static int parse_long(const struct option *longopts, char * const *argv)
|
|||||||
if (!opt)
|
if (!opt)
|
||||||
return '?';
|
return '?';
|
||||||
|
|
||||||
// getopt_long has an "optional" arg, but we don't bother with that.
|
/* getopt_long has an "optional" arg, but we don't bother with that. */
|
||||||
if (opt->has_arg && !argv[1])
|
if (opt->has_arg && !argv[1])
|
||||||
return '?';
|
return '?';
|
||||||
|
|
||||||
@ -144,8 +147,8 @@ static int parse_long(const struct option *longopts, char * const *argv)
|
|||||||
*opt->flag = opt->val;
|
*opt->flag = opt->val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return opt->val;
|
return opt->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shuffle_block(char **begin, char **last, char **end)
|
static void shuffle_block(char **begin, char **last, char **end)
|
||||||
@ -175,18 +178,19 @@ int getopt_long(int argc, char *argv[],
|
|||||||
int short_index = find_short_index(&argv[optind]);
|
int short_index = find_short_index(&argv[optind]);
|
||||||
int long_index = find_long_index(&argv[optind]);
|
int long_index = find_long_index(&argv[optind]);
|
||||||
|
|
||||||
// We're done here.
|
/* We're done here. */
|
||||||
if (short_index == -1 && long_index == -1)
|
if (short_index == -1 && long_index == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Reorder argv so that non-options come last.
|
/* Reorder argv so that non-options come last.
|
||||||
// Non-POSIXy, but that's what getopt does by default.
|
* Non-POSIXy, but that's what getopt does by default. */
|
||||||
if ((short_index > 0) && ((short_index < long_index) || (long_index == -1)))
|
if ((short_index > 0) && ((short_index < long_index) || (long_index == -1)))
|
||||||
{
|
{
|
||||||
shuffle_block(&argv[optind], &argv[optind + short_index], &argv[argc]);
|
shuffle_block(&argv[optind], &argv[optind + short_index], &argv[argc]);
|
||||||
short_index = 0;
|
short_index = 0;
|
||||||
}
|
}
|
||||||
else if ((long_index > 0) && ((long_index < short_index) || (short_index == -1)))
|
else if ((long_index > 0) && ((long_index < short_index)
|
||||||
|
|| (short_index == -1)))
|
||||||
{
|
{
|
||||||
shuffle_block(&argv[optind], &argv[optind + long_index], &argv[argc]);
|
shuffle_block(&argv[optind], &argv[optind + long_index], &argv[argc]);
|
||||||
long_index = 0;
|
long_index = 0;
|
||||||
@ -205,7 +209,7 @@ int getopt_long(int argc, char *argv[],
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRCASESTR
|
#ifndef HAVE_STRCASESTR
|
||||||
// Pretty much strncasecmp.
|
/* Pretty much strncasecmp. */
|
||||||
static int casencmp(const char *a, const char *b, size_t n)
|
static int casencmp(const char *a, const char *b, size_t n)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -239,7 +243,7 @@ char *strcasestr_rarch__(const char *haystack, const char *needle)
|
|||||||
|
|
||||||
#ifndef HAVE_STRL
|
#ifndef HAVE_STRL
|
||||||
|
|
||||||
// Implementation of strlcpy()/strlcat() based on OpenBSD.
|
/* Implementation of strlcpy()/strlcat() based on OpenBSD. */
|
||||||
|
|
||||||
size_t strlcpy(char *dest, const char *source, size_t size)
|
size_t strlcpy(char *dest, const char *source, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -21,8 +21,11 @@
|
|||||||
|
|
||||||
#include "fnmatch_rarch.h"
|
#include "fnmatch_rarch.h"
|
||||||
|
|
||||||
// Implemnentation of fnmatch(3) so it can be distributed to non *nix platforms
|
/* Implemnentation of fnmatch(3) so it can be
|
||||||
// No flags are implemented ATM. We don't use them. Add flags as needed.
|
* distributed to non *nix platforms.
|
||||||
|
*
|
||||||
|
* No flags are implemented ATM.
|
||||||
|
* We don't use them. Add flags as needed. */
|
||||||
|
|
||||||
int rl_fnmatch(const char *pattern, const char *string, int flags)
|
int rl_fnmatch(const char *pattern, const char *string, int flags)
|
||||||
{
|
{
|
||||||
@ -31,30 +34,32 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
|
|||||||
int rv;
|
int rv;
|
||||||
for (c = pattern; *c != '\0'; c++)
|
for (c = pattern; *c != '\0'; c++)
|
||||||
{
|
{
|
||||||
// String ended before pattern
|
/* String ended before pattern */
|
||||||
if ((*c != '*') && (*string == '\0'))
|
if ((*c != '*') && (*string == '\0'))
|
||||||
return FNM_NOMATCH;
|
return FNM_NOMATCH;
|
||||||
|
|
||||||
switch (*c)
|
switch (*c)
|
||||||
{
|
{
|
||||||
// Match any number of unknown chars
|
/* Match any number of unknown chars */
|
||||||
case '*':
|
case '*':
|
||||||
// Find next node in the pattern ignoring multiple
|
/* Find next node in the pattern
|
||||||
// asterixes
|
* ignoring multiple asterixes
|
||||||
|
*/
|
||||||
do {
|
do {
|
||||||
c++;
|
c++;
|
||||||
if (*c == '\0')
|
if (*c == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
} while (*c == '*');
|
} while (*c == '*');
|
||||||
|
|
||||||
// Match the remaining pattern ingnoring more and more
|
/* Match the remaining pattern
|
||||||
// chars.
|
* ignoring more and more characters. */
|
||||||
do {
|
do {
|
||||||
// We reached the end of the string without a
|
/* We reached the end of the string without a
|
||||||
// match. There is a way to optimize this by
|
* match. There is a way to optimize this by
|
||||||
// calculating the minimum chars needed to
|
* calculating the minimum chars needed to
|
||||||
// match the remaining pattern but I don't
|
* match the remaining pattern but I don't
|
||||||
// think it is worth the work ATM.
|
* think it is worth the work ATM.
|
||||||
|
*/
|
||||||
if (*string == '\0')
|
if (*string == '\0')
|
||||||
return FNM_NOMATCH;
|
return FNM_NOMATCH;
|
||||||
|
|
||||||
@ -63,16 +68,16 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
|
|||||||
} while (rv != 0);
|
} while (rv != 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
// Match char from list
|
/* Match char from list */
|
||||||
case '[':
|
case '[':
|
||||||
charmatch = 0;
|
charmatch = 0;
|
||||||
for (c++; *c != ']'; c++)
|
for (c++; *c != ']'; c++)
|
||||||
{
|
{
|
||||||
// Bad formath
|
/* Bad format */
|
||||||
if (*c == '\0')
|
if (*c == '\0')
|
||||||
return FNM_NOMATCH;
|
return FNM_NOMATCH;
|
||||||
|
|
||||||
// Match already found
|
/* Match already found */
|
||||||
if (charmatch)
|
if (charmatch)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -80,21 +85,21 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
|
|||||||
charmatch = 1;
|
charmatch = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No match in list
|
/* No match in list */
|
||||||
if (!charmatch)
|
if (!charmatch)
|
||||||
return FNM_NOMATCH;
|
return FNM_NOMATCH;
|
||||||
|
|
||||||
string++;
|
string++;
|
||||||
break;
|
break;
|
||||||
// Has any char
|
/* Has any character */
|
||||||
case '?':
|
case '?':
|
||||||
string++;
|
string++;
|
||||||
break;
|
break;
|
||||||
// Match following char verbatim
|
/* Match following character verbatim */
|
||||||
case '\\':
|
case '\\':
|
||||||
c++;
|
c++;
|
||||||
// Dangling escape at end of pattern
|
/* Dangling escape at end of pattern */
|
||||||
if (*c == '\0') // FIXME: Was c == '\0' (makes no sense). Not sure if c == NULL or *c == '\0' is intended. Assuming *c due to c++ right before.
|
if (*c == '\0') /* FIXME: Was c == '\0' (makes no sense). Not sure if c == NULL or *c == '\0' is intended. Assuming *c due to c++ right before. */
|
||||||
return FNM_NOMATCH;
|
return FNM_NOMATCH;
|
||||||
default:
|
default:
|
||||||
if (*c != *string)
|
if (*c != *string)
|
||||||
@ -103,7 +108,7 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of string and end of pattend
|
/* End of string and end of pattend */
|
||||||
if (*string == '\0')
|
if (*string == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
return FNM_NOMATCH;
|
return FNM_NOMATCH;
|
||||||
|
@ -20,14 +20,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Custom implementation of the GNU getopt_long for portability.
|
/* Custom implementation of the GNU getopt_long for portability.
|
||||||
// Not designed to be fully compatible,
|
* Not designed to be fully compatible, but compatible with
|
||||||
// but compatible with the features RetroArch uses.
|
* the features RetroArch uses. */
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#else
|
#else
|
||||||
// Avoid possible naming collisions during link since we prefer to use the actual name.
|
/* Avoid possible naming collisions during link since we
|
||||||
|
* prefer to use the actual name. */
|
||||||
#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_rarch(argc, argv, optstring, longopts, longindex)
|
#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_rarch(argc, argv, optstring, longopts, longindex)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -42,8 +43,9 @@ struct option
|
|||||||
int val;
|
int val;
|
||||||
};
|
};
|
||||||
|
|
||||||
// argv[] is declared with char * const argv[] in GNU,
|
/* argv[] is declared with char * const argv[] in GNU,
|
||||||
// but this makes no sense, as non-POSIX getopt_long mutates argv (non-opts are moved to the end).
|
* but this makes no sense, as non-POSIX getopt_long
|
||||||
|
* mutates argv (non-opts are moved to the end). */
|
||||||
int getopt_long(int argc, char *argv[],
|
int getopt_long(int argc, char *argv[],
|
||||||
const char *optstring, const struct option *longopts, int *longindex);
|
const char *optstring, const struct option *longopts, int *longindex);
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
@ -72,12 +72,11 @@ static bool validate_header(const char **ptr)
|
|||||||
if (!eol)
|
if (!eol)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Always use UTF-8. Don't really care to check.
|
/* Always use UTF-8. Don't really care to check. */
|
||||||
*ptr = eol + 3;
|
*ptr = eol + 3;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool range_is_space(const char *begin, const char *end)
|
static bool range_is_space(const char *begin, const char *end)
|
||||||
@ -113,7 +112,8 @@ static char *strdup_range(const char *begin, const char *end)
|
|||||||
|
|
||||||
static char *strdup_range_escape(const char *begin, const char *end)
|
static char *strdup_range_escape(const char *begin, const char *end)
|
||||||
{
|
{
|
||||||
return strdup_range(begin, end); // Escaping is ignored. Assume we don't deal with that.
|
/* Escaping is ignored. Assume we don't deal with that. */
|
||||||
|
return strdup_range(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
|
static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
|
||||||
@ -148,7 +148,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
|
|||||||
if (!attrib || !value)
|
if (!attrib || !value)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
struct rxml_attrib_node *new_node = (struct rxml_attrib_node*)calloc(1, sizeof(*new_node));
|
struct rxml_attrib_node *new_node =
|
||||||
|
(struct rxml_attrib_node*)calloc(1, sizeof(*new_node));
|
||||||
if (!new_node)
|
if (!new_node)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
@ -233,9 +234,10 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
|
|||||||
if (!rxml_parse_tag(node, str))
|
if (!rxml_parse_tag(node, str))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
is_closing = strstr(ptr, "/>") + 1 == closing; // Are spaces between / and > allowed?
|
/* Are spaces between / and > allowed? */
|
||||||
|
is_closing = strstr(ptr, "/>") + 1 == closing;
|
||||||
|
|
||||||
// Look for more data. Either child nodes or data.
|
/* Look for more data. Either child nodes or data. */
|
||||||
if (!is_closing)
|
if (!is_closing)
|
||||||
{
|
{
|
||||||
size_t closing_tag_size = strlen(node->name) + 4;
|
size_t closing_tag_size = strlen(node->name) + 4;
|
||||||
@ -262,8 +264,9 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cdata_start && range_is_space(closing + 1, cdata_start)) // CDATA section
|
if (cdata_start && range_is_space(closing + 1, cdata_start))
|
||||||
{
|
{
|
||||||
|
/* CDATA section */
|
||||||
const char *cdata_end = strstr(cdata_start, "]]>");
|
const char *cdata_end = strstr(cdata_start, "]]>");
|
||||||
if (!cdata_end)
|
if (!cdata_end)
|
||||||
{
|
{
|
||||||
@ -273,10 +276,11 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
|
|||||||
|
|
||||||
node->data = strdup_range(cdata_start + strlen("<![CDATA["), cdata_end);
|
node->data = strdup_range(cdata_start + strlen("<![CDATA["), cdata_end);
|
||||||
}
|
}
|
||||||
else if (closing_start && closing_start == child_start) // Simple Data
|
else if (closing_start && closing_start == child_start) /* Simple Data */
|
||||||
node->data = strdup_range(closing + 1, closing_start);
|
node->data = strdup_range(closing + 1, closing_start);
|
||||||
else // Parse all child nodes.
|
else
|
||||||
{
|
{
|
||||||
|
/* Parse all child nodes. */
|
||||||
struct rxml_node *list = NULL;
|
struct rxml_node *list = NULL;
|
||||||
struct rxml_node *tail = NULL;
|
struct rxml_node *tail = NULL;
|
||||||
|
|
||||||
@ -356,7 +360,8 @@ static char *purge_xml_comments(const char *str)
|
|||||||
copy_src = comment_end + strlen("-->");
|
copy_src = comment_end + strlen("-->");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid strcpy() as OpenBSD is anal and hates you for using it even when it's perfectly safe.
|
/* Avoid strcpy() as OpenBSD is anal and hates you
|
||||||
|
* for using it even when it's perfectly safe. */
|
||||||
len = strlen(copy_src);
|
len = strlen(copy_src);
|
||||||
memcpy(copy_dest, copy_src, len);
|
memcpy(copy_dest, copy_src, len);
|
||||||
copy_dest[len] = '\0';
|
copy_dest[len] = '\0';
|
||||||
|
@ -20,14 +20,16 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Total NIH. Very trivial "XML" implementation for use in RetroArch.
|
/* Total NIH. Very trivial "XML" implementation for use in RetroArch.
|
||||||
// Error checking is minimal. Invalid documents may lead to very buggy behavior, but
|
* Error checking is minimal. Invalid documents may lead to very
|
||||||
// memory corruption should never happen.
|
* buggy behavior, but memory corruption should never happen.
|
||||||
//
|
*
|
||||||
// Only parts of standard that RetroArch cares about is supported.
|
* Only parts of standard that RetroArch cares about is supported.
|
||||||
// Nothing more, nothing less. "Clever" XML documents will probably break the implementation.
|
* Nothing more, nothing less. "Clever" XML documents will
|
||||||
//
|
* probably break the implementation.
|
||||||
// Do *NOT* try to use this for anything else. You have been warned.
|
*
|
||||||
|
* Do *NOT* try to use this for anything else. You have been warned.
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct rxml_document rxml_document_t;
|
typedef struct rxml_document rxml_document_t;
|
||||||
|
|
||||||
@ -47,7 +49,9 @@ struct rxml_node
|
|||||||
struct rxml_node *children;
|
struct rxml_node *children;
|
||||||
struct rxml_node *next;
|
struct rxml_node *next;
|
||||||
|
|
||||||
int type; // Dummy. Used by libxml2 compat. Is always set to 0, so XML_ELEMENT_NODE check goes through.
|
/* Dummy. Used by libxml2 compat.
|
||||||
|
* Is always set to 0, so XML_ELEMENT_NODE check goes through. */
|
||||||
|
int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
rxml_document_t *rxml_load_document(const char *path);
|
rxml_document_t *rxml_load_document(const char *path);
|
||||||
@ -55,14 +59,16 @@ void rxml_free_document(rxml_document_t *doc);
|
|||||||
|
|
||||||
struct rxml_node *rxml_root_node(rxml_document_t *doc);
|
struct rxml_node *rxml_root_node(rxml_document_t *doc);
|
||||||
|
|
||||||
// Drop const-correctness here to avoid warnings when used as libxml2 compat.
|
/* Drop const-correctness here to avoid warnings
|
||||||
// xmlGetProp() returns xmlChar*, which is supposed to be passed to xmlFree().
|
* when used as libxml2 compat.
|
||||||
|
* xmlGetProp() returns xmlChar*, which is supposed
|
||||||
|
* to be passed to xmlFree(). */
|
||||||
char *rxml_node_attrib(struct rxml_node *node, const char *attrib);
|
char *rxml_node_attrib(struct rxml_node *node, const char *attrib);
|
||||||
|
|
||||||
#ifdef RXML_LIBXML2_COMPAT
|
#ifdef RXML_LIBXML2_COMPAT
|
||||||
// Compat for part of libxml2 that RetroArch uses.
|
/* Compat for part of libxml2 that RetroArch uses. */
|
||||||
#define LIBXML_TEST_VERSION ((void)0)
|
#define LIBXML_TEST_VERSION ((void)0)
|
||||||
typedef char xmlChar; // It's really unsigned char, but it doesn't matter.
|
typedef char xmlChar; /* It's really unsigned char, but it doesn't matter. */
|
||||||
typedef struct rxml_node *xmlNodePtr;
|
typedef struct rxml_node *xmlNodePtr;
|
||||||
typedef void *xmlParserCtxtPtr;
|
typedef void *xmlParserCtxtPtr;
|
||||||
typedef rxml_document_t *xmlDocPtr;
|
typedef rxml_document_t *xmlDocPtr;
|
||||||
|
@ -22,8 +22,10 @@ static void print_siblings(struct rxml_node *node, unsigned level)
|
|||||||
if (node->data)
|
if (node->data)
|
||||||
fprintf(stderr, "%*sData: %s\n", level * 4, "", node->data);
|
fprintf(stderr, "%*sData: %s\n", level * 4, "", node->data);
|
||||||
|
|
||||||
for (const struct rxml_attrib_node *attrib = node->attrib; attrib; attrib = attrib->next)
|
for (const struct rxml_attrib_node *attrib =
|
||||||
fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", attrib->attrib, attrib->value);
|
node->attrib; attrib; attrib = attrib->next)
|
||||||
|
fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "",
|
||||||
|
attrib->attrib, attrib->value);
|
||||||
|
|
||||||
if (node->children)
|
if (node->children)
|
||||||
print_siblings(node->children, level + 1);
|
print_siblings(node->children, level + 1);
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Avoid possible naming collisions during link since we prefer to use the actual name.
|
/* Avoid possible naming collisions during link
|
||||||
|
* since we prefer to use the actual name. */
|
||||||
#define strcasestr(haystack, needle) strcasestr_rarch__(haystack, needle)
|
#define strcasestr(haystack, needle) strcasestr_rarch__(haystack, needle)
|
||||||
char *strcasestr(const char *haystack, const char *needle);
|
char *strcasestr(const char *haystack, const char *needle);
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
// Avoid possible naming collisions during link since we prefer to use the actual name.
|
/* Avoid possible naming collisions during link since
|
||||||
|
* we prefer to use the actual name. */
|
||||||
#define strlcpy(dst, src, size) strlcpy_rarch__(dst, src, size)
|
#define strlcpy(dst, src, size) strlcpy_rarch__(dst, src, size)
|
||||||
#define strlcat(dst, src, size) strlcat_rarch__(dst, src, size)
|
#define strlcat(dst, src, size) strlcat_rarch__(dst, src, size)
|
||||||
|
|
||||||
|
30
driver.h
30
driver.h
@ -231,17 +231,20 @@ typedef struct input_driver
|
|||||||
{
|
{
|
||||||
void *(*init)(void);
|
void *(*init)(void);
|
||||||
void (*poll)(void *data);
|
void (*poll)(void *data);
|
||||||
int16_t (*input_state)(void *data, const struct retro_keybind **retro_keybinds,
|
int16_t (*input_state)(void *data,
|
||||||
|
const struct retro_keybind **retro_keybinds,
|
||||||
unsigned port, unsigned device, unsigned index, unsigned id);
|
unsigned port, unsigned device, unsigned index, unsigned id);
|
||||||
bool (*key_pressed)(void *data, int key);
|
bool (*key_pressed)(void *data, int key);
|
||||||
void (*free)(void *data);
|
void (*free)(void *data);
|
||||||
bool (*set_sensor_state)(void *data, unsigned port, enum retro_sensor_action action, unsigned rate);
|
bool (*set_sensor_state)(void *data, unsigned port,
|
||||||
|
enum retro_sensor_action action, unsigned rate);
|
||||||
float (*get_sensor_input)(void *data, unsigned port, unsigned id);
|
float (*get_sensor_input)(void *data, unsigned port, unsigned id);
|
||||||
uint64_t (*get_capabilities)(void *data);
|
uint64_t (*get_capabilities)(void *data);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
|
|
||||||
void (*grab_mouse)(void *data, bool state);
|
void (*grab_mouse)(void *data, bool state);
|
||||||
bool (*set_rumble)(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t state);
|
bool (*set_rumble)(void *data, unsigned port,
|
||||||
|
enum retro_rumble_effect effect, uint16_t state);
|
||||||
const rarch_joypad_driver_t *(*get_joypad_driver)(void *data);
|
const rarch_joypad_driver_t *(*get_joypad_driver)(void *data);
|
||||||
} input_driver_t;
|
} input_driver_t;
|
||||||
|
|
||||||
@ -263,7 +266,8 @@ typedef struct camera_driver
|
|||||||
{
|
{
|
||||||
/* FIXME: params for initialization - queries for resolution,
|
/* FIXME: params for initialization - queries for resolution,
|
||||||
* framerate, color format which might or might not be honored. */
|
* framerate, color format which might or might not be honored. */
|
||||||
void *(*init)(const char *device, uint64_t buffer_types, unsigned width, unsigned height);
|
void *(*init)(const char *device, uint64_t buffer_types,
|
||||||
|
unsigned width, unsigned height);
|
||||||
|
|
||||||
void (*free)(void *data);
|
void (*free)(void *data);
|
||||||
|
|
||||||
@ -288,8 +292,10 @@ typedef struct location_driver
|
|||||||
bool (*start)(void *data);
|
bool (*start)(void *data);
|
||||||
void (*stop)(void *data);
|
void (*stop)(void *data);
|
||||||
|
|
||||||
bool (*get_position)(void *data, double *lat, double *lon, double *horiz_accuracy, double *vert_accuracy);
|
bool (*get_position)(void *data, double *lat, double *lon,
|
||||||
void (*set_interval)(void *data, unsigned interval_msecs, unsigned interval_distance);
|
double *horiz_accuracy, double *vert_accuracy);
|
||||||
|
void (*set_interval)(void *data, unsigned interval_msecs,
|
||||||
|
unsigned interval_distance);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} location_driver_t;
|
} location_driver_t;
|
||||||
|
|
||||||
@ -299,9 +305,12 @@ struct rarch_viewport;
|
|||||||
typedef struct video_overlay_interface
|
typedef struct video_overlay_interface
|
||||||
{
|
{
|
||||||
void (*enable)(void *data, bool state);
|
void (*enable)(void *data, bool state);
|
||||||
bool (*load)(void *data, const struct texture_image *images, unsigned num_images);
|
bool (*load)(void *data,
|
||||||
void (*tex_geom)(void *data, unsigned image, float x, float y, float w, float h);
|
const struct texture_image *images, unsigned num_images);
|
||||||
void (*vertex_geom)(void *data, unsigned image, float x, float y, float w, float h);
|
void (*tex_geom)(void *data, unsigned image,
|
||||||
|
float x, float y, float w, float h);
|
||||||
|
void (*vertex_geom)(void *data, unsigned image,
|
||||||
|
float x, float y, float w, float h);
|
||||||
void (*full_screen)(void *data, bool enable);
|
void (*full_screen)(void *data, bool enable);
|
||||||
void (*set_alpha)(void *data, unsigned image, float mod);
|
void (*set_alpha)(void *data, unsigned image, float mod);
|
||||||
} video_overlay_interface_t;
|
} video_overlay_interface_t;
|
||||||
@ -348,7 +357,8 @@ typedef struct video_poke_interface
|
|||||||
/* Enable or disable rendering. */
|
/* Enable or disable rendering. */
|
||||||
void (*set_texture_enable)(void *data, bool enable, bool full_screen);
|
void (*set_texture_enable)(void *data, bool enable, bool full_screen);
|
||||||
#endif
|
#endif
|
||||||
void (*set_osd_msg)(void *data, const char *msg, const struct font_params *params);
|
void (*set_osd_msg)(void *data, const char *msg,
|
||||||
|
const struct font_params *params);
|
||||||
|
|
||||||
void (*show_mouse)(void *data, bool state);
|
void (*show_mouse)(void *data, bool state);
|
||||||
void (*grab_mouse_toggle)(void *data);
|
void (*grab_mouse_toggle)(void *data);
|
||||||
|
@ -123,7 +123,7 @@ void libretro_get_environment_info(void (*func)(retro_environment_t),
|
|||||||
{
|
{
|
||||||
load_no_content_hook = load_no_content;
|
load_no_content_hook = load_no_content;
|
||||||
|
|
||||||
// load_no_content gets set in this callback.
|
/* load_no_content gets set in this callback. */
|
||||||
func(environ_cb_get_system_info);
|
func(environ_cb_get_system_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test module to check re-entrancy of libretro implementations.
|
/* Test module to check re-entrancy of libretro implementations.
|
||||||
// Reruns RetroArch main loop with all content defined on command-line
|
* Reruns RetroArch main loop with all content defined on command-line
|
||||||
// to check if libretro can load multiple content after each other.
|
* to check if libretro can load multiple content after each other.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "../getopt_rarch.h"
|
#include "../getopt_rarch.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
@ -31,7 +32,8 @@ int main(int argc, char *argv[])
|
|||||||
if (optind + 1 >= argc)
|
if (optind + 1 >= argc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memmove(&argv[optind], &argv[optind + 1], (argc - optind - 1) * sizeof(char*));
|
memmove(&argv[optind], &argv[optind + 1],
|
||||||
|
(argc - optind - 1) * sizeof(char*));
|
||||||
argc--;
|
argc--;
|
||||||
|
|
||||||
rarch_main_clear_state();
|
rarch_main_clear_state();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user