* (PSP/Vita) Remove unused variables

* (Switch/libnx) remove dead code
* (Lakka/Switch/libnx) It was a mistake to include
  switch_performance_profiles.h inside lakka.h, it was creating warnings
for nearly every file. Instead, it gets optionally included for the
files that need it
This commit is contained in:
twinaphex 2021-08-12 18:51:33 +02:00
parent 148a489af5
commit 5b3942eae7
6 changed files with 18 additions and 159 deletions

View File

@ -91,11 +91,7 @@ static enum frontend_fork psp_fork_mode = FRONTEND_FORK_NONE;
static void frontend_psp_get_env_settings(int *argc, char *argv[],
void *args, void *params_data)
{
unsigned i;
struct rarch_main_wrap *params = NULL;
(void)args;
#ifdef VITA
strcpy_literal(eboot_path, "app0:/");
strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));

View File

@ -54,15 +54,9 @@
#endif
static enum frontend_fork switch_fork_mode = FRONTEND_FORK_NONE;
static const char *elf_path_cst = "/switch/retroarch_switch.nro";
bool platform_switch_has_focus = true;
#ifdef HAVE_LIBNX
/* Splash */
static uint32_t *splashData = NULL;
static bool psmInitialized = false;
static AppletHookCookie applet_hook_cookie;
@ -300,13 +294,6 @@ static void frontend_switch_deinit(void *data)
socketExit();
#endif
/* Splash */
if (splashData)
{
free(splashData);
splashData = NULL;
}
if (psmInitialized)
psmExit();
@ -407,135 +394,6 @@ static void frontend_switch_exitspawn(char *s, size_t len, char *args)
frontend_switch_exec(s, should_load_content);
}
#if 0
/* TODO/FIXME - should be refactored into something that can be used for all
* RetroArch versions, and not just Switch */
static void argb_to_rgba8(uint32_t *buff, uint32_t height, uint32_t width)
{
uint32_t h, w;
/* Convert */
for (h = 0; h < height; h++)
{
for (w = 0; w < width; w++)
{
uint32_t offset = (h * width) + w;
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);
buff[offset] = RGBA8(r, g, b, a);
}
}
}
static void frontend_switch_showsplash(void)
{
printf("[Splash] Showing splashScreen\n");
NWindow *win = nwindowGetDefault();
Framebuffer fb;
framebufferCreate(&fb, win, 1280, 720, PIXEL_FORMAT_RGBA_8888, 2);
framebufferMakeLinear(&fb);
if (splashData)
{
uint32_t width = 0;
uint32_t height = 0;
uint32_t stride;
uint32_t *frambuffer = (uint32_t *)framebufferBegin(&fb, &stride);
gfx_cpy_dsp_buf(frambuffer, splashData, width, height, stride, false);
framebufferEnd(&fb);
}
framebufferClose(&fb);
}
/* From rpng_test.c */
static 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;
struct nbio_t *handle = (struct nbio_t *)nbio_open(path, NBIO_READ);
if (!handle)
goto end;
nbio_begin_read(handle);
while (!nbio_iterate(handle))
svcSleepThread(3);
ptr = nbio_get_ptr(handle, &file_len);
if (!ptr)
{
ret = false;
goto end;
}
rpng = rpng_alloc();
if (!rpng)
{
ret = false;
goto end;
}
if (!rpng_set_buf_ptr(rpng, (uint8_t *)ptr, file_len))
{
ret = false;
goto end;
}
if (!rpng_start(rpng))
{
ret = false;
goto end;
}
while (rpng_iterate_image(rpng))
svcSleepThread(3);
if (!rpng_is_valid(rpng))
{
ret = false;
goto end;
}
do
{
retval = rpng_process_image(rpng, (void **)data, file_len, width, height);
svcSleepThread(3);
} while (retval == IMAGE_PROCESS_NEXT);
if (retval == IMAGE_PROCESS_ERROR || retval == IMAGE_PROCESS_ERROR_END)
ret = false;
end:
if (handle)
nbio_free(handle);
if (rpng)
rpng_free(rpng);
rpng = NULL;
if (!ret)
free(*data);
return ret;
}
#endif
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
svcSleepThread(rqtp->tv_nsec + (rqtp->tv_sec * 1000000000));
@ -544,11 +402,8 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
long sysconf(int name)
{
switch (name)
{
case 8:
if (name == 8)
return 0x1000;
}
return -1;
}
@ -692,6 +547,7 @@ extern void retro_get_system_info(struct retro_system_info *info);
static void frontend_switch_init(void *data)
{
#ifdef HAVE_LIBNX
Result rc;
bool recording_supported = false;
nifmInitialize(NifmServiceType_User);
@ -717,15 +573,11 @@ static void frontend_switch_init(void *data)
#endif /* IS_SALAMANDER */
#endif /* NXLINK */
Result rc;
rc = psmInitialize();
if (R_SUCCEEDED(rc))
psmInitialized = true;
else
{
RARCH_WARN("Error initializing psm\n");
}
#endif /* HAVE_LIBNX (splash) */
}

View File

@ -29,6 +29,4 @@
#define DEFAULT_TIMEZONE "UTC"
#define TIMEZONE_LENGTH 255
#include "switch_performance_profiles.h"
#endif

View File

@ -96,6 +96,10 @@
#include "../../play_feature_delivery/play_feature_delivery.h"
#endif
#if defined(HAVE_LAKKA) || defined(HAVE_LIBNX)
#include "../../switch_performance_profiles.h"
#endif
enum
{
ACTION_OK_LOAD_PRESET = 0,

View File

@ -57,6 +57,9 @@
#ifdef HAVE_LIBNX
#include <switch.h>
#endif
#if defined(HAVE_LAKKA) || defined(HAVE_LIBNX)
#include "../../switch_performance_profiles.h"
#endif

View File

@ -117,6 +117,9 @@
#ifdef HAVE_LIBNX
#include <switch.h>
#endif
#if defined(HAVE_LAKKA) || defined(HAVE_LIBNX)
#include "switch_performance_profiles.h"
#endif
@ -15239,9 +15242,12 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_AI_SERVICE_CALL:
{
#ifdef HAVE_TRANSLATE
#ifdef HAVE_ACCESSIBILITY
bool accessibility_enable = settings->bools.accessibility_enable;
unsigned accessibility_narrator_speech_speed = settings->uints.accessibility_narrator_speech_speed;
#endif
unsigned ai_service_mode = settings->uints.ai_service_mode;
if (ai_service_mode == 1 && is_ai_service_speech_running())
{
#ifdef HAVE_AUDIOMIXER