(libnx) Try to silence warnings

This commit is contained in:
twinaphex 2020-02-10 12:36:11 +01:00
parent 9dbad614a5
commit 880391d0c5
10 changed files with 83 additions and 62 deletions

View File

@ -32,7 +32,9 @@
static const int sample_rate = 48000;
static const int max_num_samples = sample_rate;
static const int num_channels = 2;
#ifndef HAVE_LIBNX
static const size_t sample_buffer_size = ((max_num_samples * num_channels * sizeof(uint16_t)) + 0xfff) & ~0xfff;
#endif
typedef struct
{
@ -98,7 +100,9 @@ static ssize_t switch_audio_write(void *data, const void *buf, size_t size)
while (!swa->current_buffer)
{
#ifndef HAVE_LIBNX
uint32_t handle_idx = 0;
#endif
num = 0;
#ifdef HAVE_LIBNX
@ -236,7 +240,9 @@ static void *switch_audio_init(const char *device,
{
unsigned i;
char names[8][0x20];
#ifndef HAVE_LIBNX
uint32_t num_names = 0;
#endif
switch_audio_t *swa = (switch_audio_t*) calloc(1, sizeof(*swa));
if (!swa)
@ -333,8 +339,9 @@ fail_audio_output:
/* TODO/FIXME - fix libnx codepath */
#ifndef HAVE_LIBNX
audio_ipc_output_close(&swa->output);
#endif
fail_audio_ipc:
#endif
/* TODO/FIXME - fix libnx codepath */
#ifndef HAVE_LIBNX
audio_ipc_finalize();

View File

@ -39,7 +39,6 @@ static const size_t thread_stack_size = 1024 * 8;
static const int thread_preferred_cpu = 2;
static const int channel_count = 2;
static const size_t sample_size = sizeof(uint16_t);
static const size_t frame_size = channel_count * sample_size;
#define AUDIO_BUFFER_COUNT 2
@ -144,8 +143,10 @@ static void *switch_thread_audio_init(const char *device, unsigned rate, unsigne
Result rc;
unsigned i;
uint32_t prio;
#ifndef HAVE_LIBNX
char names[8][0x20];
uint32_t num_names = 0;
#endif
switch_thread_audio_t *swa = (switch_thread_audio_t *)calloc(1, sizeof(*swa));
if (!swa)

View File

@ -236,7 +236,6 @@ void disk_control_get_image_label(
error:
label[0] = '\0';
return;
}
/***********/

View File

@ -94,7 +94,6 @@ void libnx_apply_overclock(void)
static void on_applet_hook(AppletHookType hook, void *param)
{
u32 performance_mode;
AppletFocusState focus_state;
/* Exit request */
@ -131,9 +130,11 @@ static void on_applet_hook(AppletHookType hook, void *param)
/* Performance mode */
case AppletHookType_OnPerformanceMode:
/* 0 == Handheld, 1 == Docked
* Since CPU doesn't change we just re-apply */
performance_mode = appletGetPerformanceMode();
{
/* 0 == Handheld, 1 == Docked
* Since CPU doesn't change we just re-apply */
u32 performance_mode = appletGetPerformanceMode();
}
libnx_apply_overclock();
break;
@ -318,17 +319,20 @@ static void frontend_switch_deinit(void *data)
static void frontend_switch_exec(const char *path, bool should_load_game)
{
char game_path[PATH_MAX-4];
#ifndef IS_SALAMANDER
const char *arg_data[3];
int args = 0;
game_path[0] = NULL;
arg_data[0] = NULL;
arg_data[args] = elf_path_cst;
arg_data[args + 1] = NULL;
args++;
#endif
game_path[0] = NULL;
RARCH_LOG("Attempt to load core: [%s].\n", path);
#ifndef IS_SALAMANDER
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
{
@ -618,8 +622,6 @@ char *realpath(const char *name, char *resolved)
for (start = end = name; *start; start = end)
{
int n;
/* Skip sequence of multiple path-separators. */
while (*start == '/')
++start;

View File

@ -580,7 +580,7 @@ static void switch_set_texture_frame(
struct scaler_ctx *sctx = NULL;
if (sw->menu_texture.pixels)
realloc(sw->menu_texture.pixels, sz);
sw->menu_texture.pixels = realloc(sw->menu_texture.pixels, sz);
else
sw->menu_texture.pixels = malloc(sz);

View File

@ -47,10 +47,8 @@ void switch_ctx_destroy(void *data)
}
static void switch_ctx_get_video_size(void *data,
unsigned *width, unsigned *height)
unsigned *width, unsigned *height)
{
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data;
switch (appletGetOperationMode())
{
default:

View File

@ -46,7 +46,7 @@ static void *switch_font_init_font(void *data, const char *font_path,
if (!font)
return NULL;
if (!font_renderer_create_default((const void **)&font->font_driver,
if (!font_renderer_create_default(&font->font_driver,
&font->font_data, font_path, font_size))
{
RARCH_WARN("Couldn't initialize font renderer.\n");
@ -250,73 +250,83 @@ static void switch_font_render_msg(
void *data, const char *msg,
const struct font_params *params)
{
float x, y, scale, drop_mod, drop_alpha;
int drop_x, drop_y;
unsigned max_glyphs;
float x, y, scale;
enum text_alignment text_align;
unsigned color, color_dark, r, g, b,
alpha, r_dark, g_dark, b_dark, alpha_dark;
unsigned color, r, g, b, alpha;
switch_font_t *font = (switch_font_t *)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
#if 0
int drop_x, drop_y;
float drop_mod, drop_alpha;
unsigned max_glyphs;
unsigned color_dark, r_dark, g_dark, b_dark, alpha_dark;
unsigned width = video_info->width;
unsigned height = video_info->height;
#endif
if (!font || !msg || msg && !*msg)
if (!font || !msg || (msg && !*msg))
return;
if (params)
{
x = params->x;
y = params->y;
scale = params->scale;
x = params->x;
y = params->y;
scale = params->scale;
text_align = params->text_align;
drop_x = params->drop_x;
drop_y = params->drop_y;
drop_mod = params->drop_mod;
#if 0
drop_x = params->drop_x;
drop_y = params->drop_y;
drop_alpha = params->drop_alpha;
drop_mod = params->drop_mod;
#endif
r = FONT_COLOR_GET_RED(params->color);
g = FONT_COLOR_GET_GREEN(params->color);
b = FONT_COLOR_GET_BLUE(params->color);
alpha = FONT_COLOR_GET_ALPHA(params->color);
r = FONT_COLOR_GET_RED(params->color);
g = FONT_COLOR_GET_GREEN(params->color);
b = FONT_COLOR_GET_BLUE(params->color);
alpha = FONT_COLOR_GET_ALPHA(params->color);
color = params->color;
color = params->color;
}
else
{
x = 0.0f;
y = 0.0f;
scale = 1.0f;
x = 0.0f;
y = 0.0f;
scale = 1.0f;
text_align = TEXT_ALIGN_LEFT;
r = (video_info->font_msg_color_r * 255);
g = (video_info->font_msg_color_g * 255);
b = (video_info->font_msg_color_b * 255);
alpha = 255;
color = COLOR_ABGR(r, g, b, alpha);
r = (video_info->font_msg_color_r * 255);
g = (video_info->font_msg_color_g * 255);
b = (video_info->font_msg_color_b * 255);
alpha = 255;
color = COLOR_ABGR(r, g, b, alpha);
drop_x = -2;
drop_y = -2;
drop_mod = 0.3f;
#if 0
drop_x = -2;
drop_y = -2;
drop_mod = 0.3f;
drop_alpha = 1.0f;
#endif
}
#if 0
max_glyphs = strlen(msg);
/*if (drop_x || drop_y)
max_glyphs *= 2;
if (drop_x || drop_y)
max_glyphs *= 2;
if (drop_x || drop_y)
{
r_dark = r * drop_mod;
g_dark = g * drop_mod;
b_dark = b * drop_mod;
alpha_dark = alpha * drop_alpha;
color_dark = COLOR_ABGR(r_dark, g_dark, b_dark, alpha_dark);
if (drop_x || drop_y)
{
r_dark = r * drop_mod;
g_dark = g * drop_mod;
b_dark = b * drop_mod;
alpha_dark = alpha * drop_alpha;
color_dark = COLOR_ABGR(r_dark, g_dark, b_dark, alpha_dark);
switch_font_render_message(video_info, font, msg, scale, color_dark,
x + scale * drop_x / width, y +
scale * drop_y / height, text_align);
}*/
switch_font_render_message(video_info, font, msg, scale, color_dark,
x + scale * drop_x / width, y +
scale * drop_y / height, text_align);
}
#endif
switch_font_render_message(video_info, font, msg, scale,
color, x, y, text_align);

View File

@ -963,6 +963,8 @@ static bool switch_input_set_sensor_state(void *data, unsigned port,
sw->sixaxis_handles_count[port] = handles_count;
}
return true;
case RETRO_SENSOR_DUMMY:
break;
}
#endif

View File

@ -3276,18 +3276,18 @@ static int action_ok_deferred_list_stub(const char *path,
static int action_ok_set_switch_cpu_profile(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char* profile_name = SWITCH_CPU_PROFILES[entry_idx];
char command[PATH_MAX_LENGTH] = {0};
#ifdef HAVE_LAKKA_SWITCH
char* profile_name = SWITCH_CPU_PROFILES[entry_idx];
snprintf(command, sizeof(command), "cpu-profile set '%s'", profile_name);
system(command);
snprintf(command, sizeof(command), "Current profile set to %s", profile_name);
#else
unsigned profile_clock = SWITCH_CPU_SPEEDS_VALUES[entry_idx];
config_get_ptr()->uints.libnx_overclock = entry_idx;
unsigned profile_clock = SWITCH_CPU_SPEEDS_VALUES[entry_idx];
if (hosversionBefore(8, 0, 0))
pcvSetClockRate(PcvModule_CpuBus, (u32)profile_clock);
else

View File

@ -7944,7 +7944,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
unsigned i;
char text[PATH_MAX_LENGTH];
char current_profile[PATH_MAX_LENGTH];
#ifdef HAVE_LAKKA_SWITCH
FILE *profile = NULL;
#endif
const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]);
runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);