Create frontend get_architecture function callback

This commit is contained in:
twinaphex 2015-04-18 20:03:59 +02:00
parent b83a03bad6
commit a2195e8cdf
11 changed files with 113 additions and 29 deletions

View File

@ -464,6 +464,11 @@ end:
return ret;
}
enum frontend_architecture frontend_apple_get_architecture(void)
{
/* stub */
return FRONTEND_ARCH_NONE;
}
const frontend_ctx_driver_t frontend_ctx_apple = {
frontend_apple_get_environment_settings,
@ -478,6 +483,7 @@ const frontend_ctx_driver_t frontend_ctx_apple = {
frontend_apple_get_os,
frontend_apple_get_rating,
frontend_apple_load_content,
frontend_apple_get_architecture,
frontend_apple_get_powerstate,
"apple",
};

View File

@ -195,19 +195,25 @@ void wait_for_input(void)
}
}
enum frontend_architecture frontend_ctr_get_architecture(void)
{
return FRONTEND_ARCH_ARM;
}
const frontend_ctx_driver_t frontend_ctx_ctr = {
frontend_ctr_get_environment_settings, /* get_environment_settings */
frontend_ctr_init, /* init */
frontend_ctr_deinit, /* deinit */
frontend_ctr_get_environment_settings,
frontend_ctr_init,
frontend_ctr_deinit,
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* exec */
NULL, /* set_fork */
frontend_ctr_shutdown, /* shutdown */
frontend_ctr_shutdown,
NULL, /* get_name */
NULL, /* get_os */
frontend_ctr_get_rating, /* get_rating */
frontend_ctr_get_rating,
NULL, /* load_content */
frontend_ctr_get_architecture,
NULL, /* get_powerstate */
"ctr",
};

View File

@ -376,19 +376,25 @@ static int frontend_gx_get_rating(void)
#endif
}
static enum frontend_architecture frontend_gx_get_architecture(void)
{
return FRONTEND_ARCH_PPC;
}
const frontend_ctx_driver_t frontend_ctx_gx = {
frontend_gx_get_environment_settings, /* get_environment_settings */
frontend_gx_init, /* init */
frontend_gx_get_environment_settings,
frontend_gx_init,
NULL, /* deinit */
frontend_gx_exitspawn, /* exitspawn */
frontend_gx_process_args, /* process_args */
frontend_gx_exec, /* exec */
frontend_gx_set_fork, /* set_fork */
frontend_gx_exitspawn,
frontend_gx_process_args,
frontend_gx_exec,
frontend_gx_set_fork,
NULL, /* shutdown */
NULL, /* get_name */
NULL, /* get_os */
frontend_gx_get_rating, /* get_rating */
frontend_gx_get_rating,
NULL, /* load_content */
frontend_gx_get_architecture,
NULL, /* get_powerstate */
"gx",
};

View File

@ -26,6 +26,7 @@
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/utsname.h>
static const char *proc_apm_path = "/proc/apm";
static const char *proc_acpi_battery_path = "/proc/acpi/battery";
@ -385,6 +386,21 @@ frontend_linux_get_powerstate(int *seconds, int *percent)
return FRONTEND_POWERSTATE_NONE;
}
enum frontend_architecture frontend_linux_get_architecture(void)
{
struct utsname buffer;
if (uname(&buffer) != 0)
return FRONTEND_ARCH_NONE;
if (!strcmp(buffer.machine, "x86_64"))
return FRONTEND_ARCH_X86_64;
if (!strcmp(buffer.machine, "x86"))
return FRONTEND_ARCH_X86;
return FRONTEND_ARCH_NONE;
}
const frontend_ctx_driver_t frontend_ctx_linux = {
NULL, /* environment_get */
NULL, /* init */
@ -398,6 +414,7 @@ const frontend_ctx_driver_t frontend_ctx_linux = {
NULL, /* get_os */
NULL, /* get_rating */
NULL, /* load_content */
frontend_linux_get_architecture,
frontend_linux_get_powerstate,
"linux",
};

View File

@ -34,6 +34,7 @@ const frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* get_os */
NULL, /* get_rating */
NULL, /* load_content */
NULL, /* get_architecture */
NULL, /* get_powerstate */
"null",
};

View File

@ -439,19 +439,25 @@ static int frontend_ps3_get_rating(void)
return 10;
}
enum frontend_architecture frontend_ps3_get_architecture(void)
{
return FRONTEND_ARCH_PPC;
}
const frontend_ctx_driver_t frontend_ctx_ps3 = {
frontend_ps3_get_environment_settings, /* get_environment_settings */
frontend_ps3_init, /* init */
frontend_ps3_deinit, /* deinit */
frontend_ps3_exitspawn, /* exitspawn */
frontend_ps3_get_environment_settings,
frontend_ps3_init,
frontend_ps3_deinit,
frontend_ps3_exitspawn,
NULL, /* process_args */
frontend_ps3_exec, /* exec */
frontend_ps3_set_fork, /* set_fork */
frontend_ps3_exec,
frontend_ps3_set_fork,
NULL, /* shutdown */
NULL, /* get_name */
NULL, /* get_os */
frontend_ps3_get_rating, /* get_rating */
frontend_ps3_get_rating,
NULL, /* load_content */
frontend_ps3_get_architecture,
NULL, /* get_powerstate */
"ps3",
};

View File

@ -262,6 +262,11 @@ static enum frontend_powerstate frontend_psp_get_powerstate(int *seconds, int *p
return ret;
}
enum frontend_architecture frontend_psp_get_architecture(void)
{
return FRONTEND_ARCH_MIPS;
}
const frontend_ctx_driver_t frontend_ctx_psp = {
frontend_psp_get_environment_settings,
frontend_psp_init,
@ -275,6 +280,7 @@ const frontend_ctx_driver_t frontend_ctx_psp = {
NULL, /* get_os */
frontend_psp_get_rating,
NULL, /* load_content */
frontend_psp_get_architecture,
frontend_psp_get_powerstate,
"psp",
};

View File

@ -59,19 +59,25 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
"playlists", sizeof(g_defaults.playlist_dir));
}
enum frontend_architecture frontend_qnx_get_architecture(void)
{
return FRONTEND_ARCH_ARM;
}
const frontend_ctx_driver_t frontend_ctx_qnx = {
frontend_qnx_get_environment_settings, /* get_environment_settings */
frontend_qnx_init, /* init */
frontend_qnx_get_environment_settings,
frontend_qnx_init,
NULL, /* deinit */
NULL, /* exitspawn */
NULL, /* process_args */
NULL, /* exec */
NULL, /* set_fork */
frontend_qnx_shutdown, /* shutdown */
frontend_qnx_shutdown,
NULL, /* get_name */
NULL, /* get_os */
frontend_qnx_get_rating, /* get_rating */
frontend_qnx_get_rating,
NULL, /* load_content */
frontend_qnx_get_architecture,
NULL, /* get_powerstate */
"qnx",
};

View File

@ -150,6 +150,12 @@ enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percen
return ret;
}
enum frontend_architecture frontend_win32_get_architecture(void)
{
/* stub */
return FRONTEND_ARCH_NONE;
}
const frontend_ctx_driver_t frontend_ctx_win32 = {
NULL, /* environment_get */
frontend_win32_init,
@ -163,6 +169,7 @@ const frontend_ctx_driver_t frontend_ctx_win32 = {
frontend_win32_get_os,
NULL, /* get_rating */
NULL, /* load_content */
frontend_win32_get_architecture,
frontend_win32_get_powerstate,
"win32",
};

View File

@ -367,19 +367,31 @@ static int frontend_xdk_get_rating(void)
#endif
}
enum frontend_architecture frontend_xdk_get_architecture(void)
{
#if defined(_XBOX360)
return FRONTEND_ARCH_PPC;
#elif defined(_XBOX1)
return FRONTEND_ARCH_X86;
#else
return FRONTEND_ARCH_NONE;
#endif
}
const frontend_ctx_driver_t frontend_ctx_xdk = {
frontend_xdk_get_environment_settings, /* get_environment_settings */
frontend_xdk_init, /* init */
frontend_xdk_get_environment_settings,
frontend_xdk_init,
NULL, /* deinit */
frontend_xdk_exitspawn, /* exitspawn */
frontend_xdk_exitspawn,
NULL, /* process_args */
frontend_xdk_exec, /* exec */
frontend_xdk_set_fork, /* set_fork */
frontend_xdk_exec,
frontend_xdk_set_fork,
NULL, /* shutdown */
NULL, /* get_name */
NULL, /* get_os */
frontend_xdk_get_rating, /* get_rating */
frontend_xdk_get_rating,
NULL, /* load_content */
frontend_xdk_get_architecture,
NULL, /* get_powerstate */
"xdk",
};

View File

@ -37,6 +37,16 @@ enum frontend_powerstate
FRONTEND_POWERSTATE_ON_POWER_SOURCE,
};
enum frontend_architecture
{
FRONTEND_ARCH_NONE = 0,
FRONTEND_ARCH_X86,
FRONTEND_ARCH_X86_64,
FRONTEND_ARCH_PPC,
FRONTEND_ARCH_ARM,
FRONTEND_ARCH_MIPS,
};
typedef void (*environment_get_t)(int *argc, char *argv[], void *args,
void *params_data);
typedef void (*process_args_t)(int *argc, char *argv[]);
@ -56,6 +66,7 @@ typedef struct frontend_ctx_driver
void (*get_os)(char *, size_t, int *major, int *minor);
int (*get_rating)(void);
void (*content_loaded)(void);
enum frontend_architecture (*get_architecture)(void);
enum frontend_powerstate (*get_powerstate)(int *seconds, int *percent);
const char *ident;