(platform_switch.c) Set retro_rating level to 11 - some minor
cleanups
This commit is contained in:
parent
58dac5c0a5
commit
247b21b151
|
@ -57,7 +57,7 @@ static uint64_t frontend_switch_get_mem_used(void);
|
|||
|
||||
#ifdef HAVE_LIBNX
|
||||
|
||||
// Splash
|
||||
/* Splash */
|
||||
static uint32_t *splashData = NULL;
|
||||
|
||||
static bool psmInitialized = false;
|
||||
|
@ -66,7 +66,7 @@ static bool psmInitialized = false;
|
|||
extern bool nxlink_connected;
|
||||
#endif
|
||||
|
||||
#endif // HAVE_LIBNX
|
||||
#endif /* HAVE_LIBNX */
|
||||
|
||||
static void get_first_valid_core(char *path_return)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ static void frontend_switch_deinit(void *data)
|
|||
socketExit();
|
||||
#endif
|
||||
|
||||
// Splash
|
||||
/* Splash */
|
||||
if (splashData)
|
||||
{
|
||||
free(splashData);
|
||||
|
@ -325,33 +325,33 @@ static void frontend_switch_exitspawn(char *s, size_t len)
|
|||
|
||||
void argb_to_rgba8(uint32_t *buff, uint32_t height, uint32_t width)
|
||||
{
|
||||
// Convert
|
||||
for (uint32_t h = 0; h < height; h++)
|
||||
uint32_t h, w;
|
||||
/* Convert */
|
||||
for (h = 0; h < height; h++)
|
||||
{
|
||||
for (uint32_t w = 0; w < width; w++)
|
||||
for (w = 0; w < width; w++)
|
||||
{
|
||||
uint32_t offset = (h * width) + w;
|
||||
uint32_t c = buff[offset];
|
||||
uint32_t c = buff[offset];
|
||||
|
||||
uint32_t a = (uint32_t)((c & 0xff000000) >> 24);
|
||||
uint32_t r = (uint32_t)((c & 0x00ff0000) >> 16);
|
||||
uint32_t g = (uint32_t)((c & 0x0000ff00) >> 8);
|
||||
uint32_t b = (uint32_t)(c & 0x000000ff);
|
||||
uint32_t a = (uint32_t)((c & 0xff000000) >> 24);
|
||||
uint32_t r = (uint32_t)((c & 0x00ff0000) >> 16);
|
||||
uint32_t g = (uint32_t)((c & 0x0000ff00) >> 8);
|
||||
uint32_t b = (uint32_t)(c & 0x000000ff);
|
||||
|
||||
buff[offset] = RGBA8(r, g, b, a);
|
||||
buff[offset] = RGBA8(r, g, b, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void frontend_switch_showsplash()
|
||||
void frontend_switch_showsplash(void)
|
||||
{
|
||||
printf("[Splash] Showing splashScreen\n");
|
||||
|
||||
if (splashData)
|
||||
{
|
||||
uint32_t width, height;
|
||||
width = height = 0;
|
||||
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
uint32_t *frambuffer = (uint32_t *)gfxGetFramebuffer(&width, &height);
|
||||
|
||||
gfx_slow_swizzling_blit(frambuffer, splashData, width, height, 0, 0, false);
|
||||
|
@ -362,15 +362,15 @@ void frontend_switch_showsplash()
|
|||
}
|
||||
}
|
||||
|
||||
// From rpng_test.c
|
||||
bool rpng_load_image_argb(const char *path, uint32_t **data, unsigned *width, unsigned *height)
|
||||
/* From rpng_test.c */
|
||||
bool rpng_load_image_argb(const char *path,
|
||||
uint32_t **data, unsigned *width, unsigned *height)
|
||||
{
|
||||
int retval;
|
||||
size_t file_len;
|
||||
bool ret = true;
|
||||
rpng_t *rpng = NULL;
|
||||
void *ptr = NULL;
|
||||
|
||||
bool ret = true;
|
||||
rpng_t *rpng = NULL;
|
||||
void *ptr = NULL;
|
||||
struct nbio_t *handle = (struct nbio_t *)nbio_open(path, NBIO_READ);
|
||||
|
||||
if (!handle)
|
||||
|
@ -463,7 +463,7 @@ ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize)
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Taken from glibc
|
||||
/* Taken from glibc */
|
||||
char *realpath(const char *name, char *resolved)
|
||||
{
|
||||
char *rpath, *dest, *extra_buf = NULL;
|
||||
|
@ -592,14 +592,14 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#endif // HAVE_LIBNX
|
||||
#endif /* HAVE_LIBNX */
|
||||
|
||||
static void frontend_switch_shutdown(bool unused)
|
||||
{
|
||||
(void)unused;
|
||||
}
|
||||
|
||||
// runloop_get_system_info isnt initialized that early..
|
||||
/* runloop_get_system_info isnt initialized that early.. */
|
||||
extern void retro_get_system_info(struct retro_system_info *info);
|
||||
|
||||
static void frontend_switch_init(void *data)
|
||||
|
@ -608,21 +608,21 @@ static void frontend_switch_init(void *data)
|
|||
|
||||
#ifdef HAVE_LIBNX
|
||||
#ifndef HAVE_OPENGL
|
||||
// Init Resolution before initDefault
|
||||
/* Init Resolution before initDefault */
|
||||
gfxInitResolution(1280, 720);
|
||||
|
||||
gfxInitDefault();
|
||||
gfxSetMode(GfxMode_TiledDouble);
|
||||
|
||||
gfxConfigureTransform(0);
|
||||
#endif // HAVE_OPENGL
|
||||
#endif /* HAVE_OPENGL */
|
||||
#ifdef NXLINK
|
||||
socketInitializeDefault();
|
||||
nxlink_connected = nxlinkStdio() != -1;
|
||||
#ifndef IS_SALAMANDER
|
||||
verbosity_enable();
|
||||
#endif // IS_SALAMANDER
|
||||
#endif // NXLINK
|
||||
#endif /* IS_SALAMANDER */
|
||||
#endif /* NXLINK */
|
||||
|
||||
Result rc;
|
||||
rc = psmInitialize();
|
||||
|
@ -642,8 +642,8 @@ static void frontend_switch_init(void *data)
|
|||
uint32_t width, height;
|
||||
width = height = 0;
|
||||
|
||||
// Load splash
|
||||
#ifndef HAVE_OPENGL
|
||||
/* Load splash */
|
||||
if (!splashData)
|
||||
{
|
||||
if (sys_info)
|
||||
|
@ -685,12 +685,12 @@ static void frontend_switch_init(void *data)
|
|||
frontend_switch_showsplash();
|
||||
}
|
||||
#endif
|
||||
#endif // HAVE_LIBNX (splash)
|
||||
#endif /* HAVE_LIBNX (splash) */
|
||||
}
|
||||
|
||||
static int frontend_switch_get_rating(void)
|
||||
{
|
||||
return 1000;
|
||||
return 11;
|
||||
}
|
||||
|
||||
enum frontend_architecture frontend_switch_get_architecture(void)
|
||||
|
@ -718,7 +718,7 @@ static int frontend_switch_parse_drive_list(void *data, bool load_content)
|
|||
static uint64_t frontend_switch_get_mem_total(void)
|
||||
{
|
||||
uint64_t memoryTotal = 0;
|
||||
svcGetInfo(&memoryTotal, 6, 0xffff8001, 0); // avaiable
|
||||
svcGetInfo(&memoryTotal, 6, 0xffff8001, 0);
|
||||
memoryTotal += frontend_switch_get_mem_used();
|
||||
|
||||
return memoryTotal;
|
||||
|
@ -727,7 +727,7 @@ static uint64_t frontend_switch_get_mem_total(void)
|
|||
static uint64_t frontend_switch_get_mem_used(void)
|
||||
{
|
||||
uint64_t memoryUsed = 0;
|
||||
svcGetInfo(&memoryUsed, 7, 0xffff8001, 0); // used
|
||||
svcGetInfo(&memoryUsed, 7, 0xffff8001, 0);
|
||||
|
||||
return memoryUsed;
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor)
|
|||
strlcpy(s, "Horizon OS", len);
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
// There is pretty sure a better way, but this will do just fine
|
||||
/* There is pretty sure a better way, but this will do just fine */
|
||||
if (kernelAbove600())
|
||||
{
|
||||
*major = 6;
|
||||
|
@ -796,18 +796,18 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor)
|
|||
}
|
||||
else
|
||||
{
|
||||
// either 1.0 or > 5.x
|
||||
/* either 1.0 or > 5.x */
|
||||
*major = 1;
|
||||
*minor = 0;
|
||||
}
|
||||
#else
|
||||
// defaults in case we error out
|
||||
/* defaults in case we error out */
|
||||
*major = 0;
|
||||
*minor = 0;
|
||||
|
||||
char firmware_version[0x100];
|
||||
|
||||
result_t r; // used by LIB_ASSERT_OK macros
|
||||
result_t r; /* used by LIB_ASSERT_OK macros */
|
||||
LIB_ASSERT_OK(fail, sm_init());
|
||||
|
||||
ipc_object_t set_sys;
|
||||
|
@ -835,7 +835,7 @@ fail:
|
|||
|
||||
static void frontend_switch_get_name(char *s, size_t len)
|
||||
{
|
||||
// TODO: Add Mariko at some point
|
||||
/* TODO: Add Mariko at some point */
|
||||
strlcpy(s, "Nintendo Switch", len);
|
||||
}
|
||||
|
||||
|
@ -853,12 +853,12 @@ frontend_ctx_driver_t frontend_ctx_switch =
|
|||
#else
|
||||
frontend_switch_set_fork,
|
||||
#endif
|
||||
#else // HAVE_LIBNX
|
||||
#else /* HAVE_LIBNX */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#endif // HAVE_LIBNX
|
||||
#endif /* HAVE_LIBNX */
|
||||
frontend_switch_shutdown,
|
||||
frontend_switch_get_name,
|
||||
frontend_switch_get_os,
|
||||
|
|
Loading…
Reference in New Issue