Add get_name function to frontend context

This commit is contained in:
twinaphex 2014-06-12 16:26:33 +02:00
parent febdd2bc8a
commit 0b076883d6
9 changed files with 18 additions and 14 deletions

View File

@ -41,6 +41,7 @@ typedef struct frontend_ctx_driver
int (*process_events)(void *data);
void (*exec)(const char *, bool);
void (*shutdown)(bool);
int (*get_name)(char *, size_t);
int (*get_rating)(void);
// Human readable string.

View File

@ -701,13 +701,16 @@ static void frontend_android_shutdown(bool unused)
exit(0);
}
static void frontend_android_get_name(char *name, size_t sizeof_name)
{
int len = __system_property_get("ro.product.model", name);
(void)len;
}
static int frontend_android_get_rating(void)
{
char model_id[PROP_VALUE_MAX];
int len;
len = __system_property_get("ro.product.model", model_id);
(void)len;
frontend_android_get_name(&model_id, sizeof(model_id));
RARCH_LOG("ro.product.model: (%s).\n", model_id);
@ -729,6 +732,7 @@ const frontend_ctx_driver_t frontend_ctx_android = {
frontend_android_process_events, /* process_events */
NULL, /* exec */
frontend_android_shutdown, /* shutdown */
frontend_android_get_name, /* get_name */
frontend_android_get_rating, /* get_rating */
"android",
};

View File

@ -131,6 +131,7 @@ const frontend_ctx_driver_t frontend_ctx_apple = {
NULL, /* process_events */
NULL, /* exec */
NULL, /* shutdown */
NULL, /* get_name */
frontend_apple_get_rating, /* get_rating */
"apple",
};

View File

@ -339,6 +339,7 @@ const frontend_ctx_driver_t frontend_ctx_gx = {
NULL, /* process_events */
frontend_gx_exec, /* exec */
NULL, /* shutdown */
frontend_gx_get_rating, /* get_rating */
NULL, /* get_name */
frontend_gx_get_rating, /* get_rating */
"gx",
};

View File

@ -21,12 +21,6 @@
#include <stddef.h>
#include <string.h>
static int frontend_null_get_rating(void)
{
/* TODO/FIXME: Determine rating */
return -1;
}
const frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* environment_get */
NULL, /* init */
@ -36,6 +30,7 @@ const frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* process_events */
NULL, /* exec */
NULL, /* shutdown */
frontend_null_get_rating, /* get_rating */
NULL, /* get_name */
NULL, /* get_rating */
"null",
};

View File

@ -440,6 +440,7 @@ const frontend_ctx_driver_t frontend_ctx_ps3 = {
NULL, /* process_events */
frontend_ps3_exec, /* exec */
NULL, /* shutdown */
NULL, /* get_name */
frontend_ps3_get_rating, /* get_rating */
"ps3",
};

View File

@ -217,6 +217,7 @@ const frontend_ctx_driver_t frontend_ctx_psp = {
NULL, /* process_events */
frontend_psp_exec, /* exec */
frontend_psp_shutdown, /* shutdown */
NULL, /* get_name */
frontend_psp_get_rating, /* get_rating */
"psp",
};

View File

@ -51,6 +51,7 @@ const frontend_ctx_driver_t frontend_ctx_qnx = {
NULL, /* process_events */
NULL, /* exec */
frontend_qnx_shutdown, /* shutdown */
NULL, /* get_name */
frontend_qnx_get_rating, /* get_rating */
"qnx",
};

View File

@ -302,8 +302,6 @@ static int frontend_xdk_get_rating(void)
return 11;
#elif defined(_XBOX1)
return 7;
#else
return -1;
#endif
}
@ -316,6 +314,7 @@ const frontend_ctx_driver_t frontend_ctx_xdk = {
NULL, /* process_events */
frontend_xdk_exec, /* exec */
NULL, /* shutdown */
NULL, /* get_name */
frontend_xdk_get_rating, /* get_rating */
"xdk",
};