diff --git a/bluetooth/bluetooth_driver.c b/bluetooth/bluetooth_driver.c
index e7bede8089..9fbd34a21e 100644
--- a/bluetooth/bluetooth_driver.c
+++ b/bluetooth/bluetooth_driver.c
@@ -1,206 +1,206 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2021 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-
-#ifdef HAVE_CONFIG_H
-#include "../config.h"
-#endif
-
-#include "../driver.h"
-#include "../list_special.h"
-#include "../retroarch.h"
-#include "../runloop.h"
-#include "../verbosity.h"
-
-#include "bluetooth_driver.h"
-
-static bluetooth_driver_t bluetooth_null = {
- NULL, /* init */
- NULL, /* free */
- NULL, /* scan */
- NULL, /* get_devices */
- NULL, /* device_is_connected */
- NULL, /* device_get_sublabel */
- NULL, /* connect_device */
- NULL, /* remove_device */
- "null",
-};
-
-const bluetooth_driver_t *bluetooth_drivers[] = {
-#ifdef HAVE_BLUETOOTH
- &bluetooth_bluetoothctl,
-#ifdef HAVE_DBUS
- &bluetooth_bluez,
-#endif
-#endif
- &bluetooth_null,
- NULL,
-};
-
-static bluetooth_driver_state_t bluetooth_driver_st;
-
-bluetooth_driver_state_t *bluetooth_state_get_ptr(void)
-{
- return &bluetooth_driver_st;
-}
-
-/**
- * config_get_bluetooth_driver_options:
- *
- * Get an enumerated list of all bluetooth driver names,
- * separated by '|'.
- *
- * Returns: string listing of all bluetooth driver names,
- * separated by '|'.
- **/
-const char* config_get_bluetooth_driver_options(void)
-{
- return char_list_new_special(STRING_LIST_BLUETOOTH_DRIVERS, NULL);
-}
-
-void driver_bluetooth_scan(void)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- if ( bt_st
- && bt_st->active
- && bt_st->drv->scan )
- bt_st->drv->scan(bt_st->data);
-}
-
-void driver_bluetooth_get_devices(struct string_list* devices)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- if ( bt_st
- && bt_st->active
- && bt_st->drv->get_devices )
- bt_st->drv->get_devices(bt_st->data, devices);
-}
-
-bool driver_bluetooth_device_is_connected(unsigned i)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- if ( bt_st
- && bt_st->active
- && bt_st->drv->device_is_connected )
- return bt_st->drv->device_is_connected(bt_st->data, i);
- return false;
-}
-
-void driver_bluetooth_device_get_sublabel(char *s, unsigned i, size_t len)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- if ( bt_st
- && bt_st->active
- && bt_st->drv->device_get_sublabel )
- bt_st->drv->device_get_sublabel(bt_st->data, s, i, len);
-}
-
-bool driver_bluetooth_connect_device(unsigned i)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- if (bt_st->active)
- return bt_st->drv->connect_device(bt_st->data, i);
- return false;
-}
-
-bool driver_bluetooth_remove_device(unsigned i)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- if (bt_st->active)
- return bt_st->drv->remove_device(bt_st->data, i);
- return false;
-}
-
-bool bluetooth_driver_ctl(enum rarch_bluetooth_ctl_state state, void *data)
-{
- bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
- settings_t *settings = config_get_ptr();
-
- switch (state)
- {
- case RARCH_BLUETOOTH_CTL_DESTROY:
- bt_st->drv = NULL;
- bt_st->data = NULL;
- bt_st->active = false;
- break;
- case RARCH_BLUETOOTH_CTL_FIND_DRIVER:
- {
- const char *prefix = "bluetooth driver";
- int i = (int)driver_find_index(
- "bluetooth_driver",
- settings->arrays.bluetooth_driver);
-
- if (i >= 0)
- bt_st->drv = (const bluetooth_driver_t*)bluetooth_drivers[i];
- else
- {
- if (verbosity_is_enabled())
- {
- unsigned d;
- RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
- settings->arrays.bluetooth_driver);
- RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
- for (d = 0; bluetooth_drivers[d]; d++)
- RARCH_LOG_OUTPUT("\t%s\n", bluetooth_drivers[d]->ident);
-
- RARCH_WARN("Going to default to first %s...\n", prefix);
- }
-
- bt_st->drv = (const bluetooth_driver_t*)bluetooth_drivers[0];
-
- if (!bt_st->drv)
- retroarch_fail(1, "find_bluetooth_driver()");
- }
- }
- break;
- case RARCH_BLUETOOTH_CTL_DEINIT:
- if (bt_st->data && bt_st->drv)
- {
- if (bt_st->drv->free)
- bt_st->drv->free(bt_st->data);
- }
-
- bt_st->data = NULL;
- bt_st->active = false;
- break;
- case RARCH_BLUETOOTH_CTL_INIT:
- /* Resource leaks will follow if bluetooth is initialized twice. */
- if (bt_st->data)
- return false;
-
- bluetooth_driver_ctl(RARCH_BLUETOOTH_CTL_FIND_DRIVER, NULL);
-
- if (bt_st->drv && bt_st->drv->init)
- {
- bt_st->active = true;
- bt_st->data = bt_st->drv->init();
-
- if (!bt_st->data)
- {
- RARCH_ERR("Failed to initialize bluetooth driver. Will continue without bluetooth.\n");
- bt_st->active = false;
- }
- }
- else
- bt_st->active = false;
- break;
- default:
- break;
- }
-
- return false;
-}
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2021 - Daniel De Matteis
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+#include
+
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#include "../driver.h"
+#include "../list_special.h"
+#include "../retroarch.h"
+#include "../runloop.h"
+#include "../verbosity.h"
+
+#include "bluetooth_driver.h"
+
+static bluetooth_driver_t bluetooth_null = {
+ NULL, /* init */
+ NULL, /* free */
+ NULL, /* scan */
+ NULL, /* get_devices */
+ NULL, /* device_is_connected */
+ NULL, /* device_get_sublabel */
+ NULL, /* connect_device */
+ NULL, /* remove_device */
+ "null",
+};
+
+const bluetooth_driver_t *bluetooth_drivers[] = {
+#ifdef HAVE_BLUETOOTH
+ &bluetooth_bluetoothctl,
+#ifdef HAVE_DBUS
+ &bluetooth_bluez,
+#endif
+#endif
+ &bluetooth_null,
+ NULL,
+};
+
+static bluetooth_driver_state_t bluetooth_driver_st = {0};
+
+bluetooth_driver_state_t *bluetooth_state_get_ptr(void)
+{
+ return &bluetooth_driver_st;
+}
+
+/**
+ * config_get_bluetooth_driver_options:
+ *
+ * Get an enumerated list of all bluetooth driver names,
+ * separated by '|'.
+ *
+ * Returns: string listing of all bluetooth driver names,
+ * separated by '|'.
+ **/
+const char* config_get_bluetooth_driver_options(void)
+{
+ return char_list_new_special(STRING_LIST_BLUETOOTH_DRIVERS, NULL);
+}
+
+void driver_bluetooth_scan(void)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ if ( bt_st
+ && bt_st->active
+ && bt_st->drv->scan )
+ bt_st->drv->scan(bt_st->data);
+}
+
+void driver_bluetooth_get_devices(struct string_list* devices)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ if ( bt_st
+ && bt_st->active
+ && bt_st->drv->get_devices )
+ bt_st->drv->get_devices(bt_st->data, devices);
+}
+
+bool driver_bluetooth_device_is_connected(unsigned i)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ if ( bt_st
+ && bt_st->active
+ && bt_st->drv->device_is_connected )
+ return bt_st->drv->device_is_connected(bt_st->data, i);
+ return false;
+}
+
+void driver_bluetooth_device_get_sublabel(char *s, unsigned i, size_t len)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ if ( bt_st
+ && bt_st->active
+ && bt_st->drv->device_get_sublabel )
+ bt_st->drv->device_get_sublabel(bt_st->data, s, i, len);
+}
+
+bool driver_bluetooth_connect_device(unsigned i)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ if (bt_st->active)
+ return bt_st->drv->connect_device(bt_st->data, i);
+ return false;
+}
+
+bool driver_bluetooth_remove_device(unsigned i)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ if (bt_st->active)
+ return bt_st->drv->remove_device(bt_st->data, i);
+ return false;
+}
+
+bool bluetooth_driver_ctl(enum rarch_bluetooth_ctl_state state, void *data)
+{
+ bluetooth_driver_state_t *bt_st = &bluetooth_driver_st;
+ settings_t *settings = config_get_ptr();
+
+ switch (state)
+ {
+ case RARCH_BLUETOOTH_CTL_DESTROY:
+ bt_st->drv = NULL;
+ bt_st->data = NULL;
+ bt_st->active = false;
+ break;
+ case RARCH_BLUETOOTH_CTL_FIND_DRIVER:
+ {
+ const char *prefix = "bluetooth driver";
+ int i = (int)driver_find_index(
+ "bluetooth_driver",
+ settings->arrays.bluetooth_driver);
+
+ if (i >= 0)
+ bt_st->drv = (const bluetooth_driver_t*)bluetooth_drivers[i];
+ else
+ {
+ if (verbosity_is_enabled())
+ {
+ unsigned d;
+ RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
+ settings->arrays.bluetooth_driver);
+ RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
+ for (d = 0; bluetooth_drivers[d]; d++)
+ RARCH_LOG_OUTPUT("\t%s\n", bluetooth_drivers[d]->ident);
+
+ RARCH_WARN("Going to default to first %s...\n", prefix);
+ }
+
+ bt_st->drv = (const bluetooth_driver_t*)bluetooth_drivers[0];
+
+ if (!bt_st->drv)
+ retroarch_fail(1, "find_bluetooth_driver()");
+ }
+ }
+ break;
+ case RARCH_BLUETOOTH_CTL_DEINIT:
+ if (bt_st->data && bt_st->drv)
+ {
+ if (bt_st->drv->free)
+ bt_st->drv->free(bt_st->data);
+ }
+
+ bt_st->data = NULL;
+ bt_st->active = false;
+ break;
+ case RARCH_BLUETOOTH_CTL_INIT:
+ /* Resource leaks will follow if bluetooth is initialized twice. */
+ if (bt_st->data)
+ return false;
+
+ bluetooth_driver_ctl(RARCH_BLUETOOTH_CTL_FIND_DRIVER, NULL);
+
+ if (bt_st->drv && bt_st->drv->init)
+ {
+ bt_st->active = true;
+ bt_st->data = bt_st->drv->init();
+
+ if (!bt_st->data)
+ {
+ RARCH_ERR("Failed to initialize bluetooth driver. Will continue without bluetooth.\n");
+ bt_st->active = false;
+ }
+ }
+ else
+ bt_st->active = false;
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
diff --git a/camera/camera_driver.c b/camera/camera_driver.c
index 2d8d226a9a..8609ef4621 100644
--- a/camera/camera_driver.c
+++ b/camera/camera_driver.c
@@ -1,146 +1,146 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2021 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-
-#include
-
-#include "../configuration.h"
-#include "../driver.h"
-#include "../list_special.h"
-#include "../runloop.h"
-#include "../verbosity.h"
-
-#include "camera_driver.h"
-
-static void *nullcamera_init(const char *device, uint64_t caps,
- unsigned width, unsigned height) { return (void*)-1; }
-static void nullcamera_free(void *data) { }
-static void nullcamera_stop(void *data) { }
-static bool nullcamera_start(void *data) { return true; }
-static bool nullcamera_poll(void *a,
- retro_camera_frame_raw_framebuffer_t b,
- retro_camera_frame_opengl_texture_t c) { return true; }
-
-static camera_driver_t camera_null = {
- nullcamera_init,
- nullcamera_free,
- nullcamera_start,
- nullcamera_stop,
- nullcamera_poll,
- "null",
-};
-
-const camera_driver_t *camera_drivers[] = {
-#ifdef HAVE_V4L2
- &camera_v4l2,
-#endif
-#ifdef EMSCRIPTEN
- &camera_rwebcam,
-#endif
-#ifdef ANDROID
- &camera_android,
-#endif
- &camera_null,
- NULL,
-};
-
-static camera_driver_state_t camera_driver_st;
-
-camera_driver_state_t *camera_state_get_ptr(void)
-{
- return &camera_driver_st;
-}
-
-/**
- * config_get_camera_driver_options:
- *
- * Get an enumerated list of all camera driver names,
- * separated by '|'.
- *
- * Returns: string listing of all camera driver names,
- * separated by '|'.
- **/
-const char *config_get_camera_driver_options(void)
-{
- return char_list_new_special(STRING_LIST_CAMERA_DRIVERS, NULL);
-}
-
-bool driver_camera_start(void)
-{
- camera_driver_state_t *camera_st = &camera_driver_st;
- if ( camera_st
- && camera_st->data
- && camera_st->driver
- && camera_st->driver->start)
- {
- settings_t *settings = config_get_ptr();
- bool camera_allow = settings->bools.camera_allow;
- if (camera_allow)
- return camera_st->driver->start(camera_st->data);
-
- runloop_msg_queue_push(
- "Camera is explicitly disabled.\n", 1, 180, false,
- NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
- }
- return true;
-}
-
-void driver_camera_stop(void)
-{
- camera_driver_state_t *camera_st = &camera_driver_st;
- if ( camera_st->driver
- && camera_st->driver->stop
- && camera_st->data)
- camera_st->driver->stop(camera_st->data);
-}
-
-bool camera_driver_find_driver(const char *prefix,
- bool verbosity_enabled)
-{
- settings_t *settings = config_get_ptr();
- camera_driver_state_t
- *camera_st = &camera_driver_st;
- int i = (int)driver_find_index(
- "camera_driver",
- settings->arrays.camera_driver);
-
- if (i >= 0)
- camera_st->driver = (const camera_driver_t*)camera_drivers[i];
- else
- {
- if (verbosity_enabled)
- {
- unsigned d;
- RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
- settings->arrays.camera_driver);
- RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
- for (d = 0; camera_drivers[d]; d++)
- {
- if (camera_drivers[d])
- {
- RARCH_LOG_OUTPUT("\t%s\n", camera_drivers[d]->ident);
- }
- }
-
- RARCH_WARN("Going to default to first %s...\n", prefix);
- }
-
- if (!(camera_st->driver = (const camera_driver_t*)camera_drivers[0]))
- return false;
- }
- return true;
-}
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2021 - Daniel De Matteis
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+#include
+
+#include
+
+#include "../configuration.h"
+#include "../driver.h"
+#include "../list_special.h"
+#include "../runloop.h"
+#include "../verbosity.h"
+
+#include "camera_driver.h"
+
+static void *nullcamera_init(const char *device, uint64_t caps,
+ unsigned width, unsigned height) { return (void*)-1; }
+static void nullcamera_free(void *data) { }
+static void nullcamera_stop(void *data) { }
+static bool nullcamera_start(void *data) { return true; }
+static bool nullcamera_poll(void *a,
+ retro_camera_frame_raw_framebuffer_t b,
+ retro_camera_frame_opengl_texture_t c) { return true; }
+
+static camera_driver_t camera_null = {
+ nullcamera_init,
+ nullcamera_free,
+ nullcamera_start,
+ nullcamera_stop,
+ nullcamera_poll,
+ "null",
+};
+
+const camera_driver_t *camera_drivers[] = {
+#ifdef HAVE_V4L2
+ &camera_v4l2,
+#endif
+#ifdef EMSCRIPTEN
+ &camera_rwebcam,
+#endif
+#ifdef ANDROID
+ &camera_android,
+#endif
+ &camera_null,
+ NULL,
+};
+
+static camera_driver_state_t camera_driver_st = {0};
+
+camera_driver_state_t *camera_state_get_ptr(void)
+{
+ return &camera_driver_st;
+}
+
+/**
+ * config_get_camera_driver_options:
+ *
+ * Get an enumerated list of all camera driver names,
+ * separated by '|'.
+ *
+ * Returns: string listing of all camera driver names,
+ * separated by '|'.
+ **/
+const char *config_get_camera_driver_options(void)
+{
+ return char_list_new_special(STRING_LIST_CAMERA_DRIVERS, NULL);
+}
+
+bool driver_camera_start(void)
+{
+ camera_driver_state_t *camera_st = &camera_driver_st;
+ if ( camera_st
+ && camera_st->data
+ && camera_st->driver
+ && camera_st->driver->start)
+ {
+ settings_t *settings = config_get_ptr();
+ bool camera_allow = settings->bools.camera_allow;
+ if (camera_allow)
+ return camera_st->driver->start(camera_st->data);
+
+ runloop_msg_queue_push(
+ "Camera is explicitly disabled.\n", 1, 180, false,
+ NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
+ }
+ return true;
+}
+
+void driver_camera_stop(void)
+{
+ camera_driver_state_t *camera_st = &camera_driver_st;
+ if ( camera_st->driver
+ && camera_st->driver->stop
+ && camera_st->data)
+ camera_st->driver->stop(camera_st->data);
+}
+
+bool camera_driver_find_driver(const char *prefix,
+ bool verbosity_enabled)
+{
+ settings_t *settings = config_get_ptr();
+ camera_driver_state_t
+ *camera_st = &camera_driver_st;
+ int i = (int)driver_find_index(
+ "camera_driver",
+ settings->arrays.camera_driver);
+
+ if (i >= 0)
+ camera_st->driver = (const camera_driver_t*)camera_drivers[i];
+ else
+ {
+ if (verbosity_enabled)
+ {
+ unsigned d;
+ RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
+ settings->arrays.camera_driver);
+ RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
+ for (d = 0; camera_drivers[d]; d++)
+ {
+ if (camera_drivers[d])
+ {
+ RARCH_LOG_OUTPUT("\t%s\n", camera_drivers[d]->ident);
+ }
+ }
+
+ RARCH_WARN("Going to default to first %s...\n", prefix);
+ }
+
+ if (!(camera_st->driver = (const camera_driver_t*)camera_drivers[0]))
+ return false;
+ }
+ return true;
+}
diff --git a/cores/libretro-net-retropad/net_retropad_core.c b/cores/libretro-net-retropad/net_retropad_core.c
index 15f7c4b05b..aa38e18c7e 100644
--- a/cores/libretro-net-retropad/net_retropad_core.c
+++ b/cores/libretro-net-retropad/net_retropad_core.c
@@ -87,13 +87,13 @@ struct remote_joypad_message
uint16_t state;
};
-static float tilt_sensor_values[3];
-static float gyro_sensor_values[3];
static bool keyboard_state[RETROK_LAST];
static bool keyboard_state_validated[RETROK_LAST];
static bool tilt_sensor_enabled = false;
static bool gyro_sensor_enabled = false;
static bool lux_sensor_enabled = false;
+static float tilt_sensor_values[3] = {0};
+static float gyro_sensor_values[3] = {0};
static float lux_sensor_value = 0.0f;
static unsigned mouse_type = 0;
static int pointer_x = 0;
@@ -727,7 +727,7 @@ static void retropad_update_input(void)
pointer_y = (int16_t)state;
}
}
-
+
/* Do not send extra descriptor state - RA side is not prepared to receive it */
if (i>1)
continue;
@@ -1034,7 +1034,7 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
sensor_item_colors[median_index] = (uint16_t)(fabsf(32*4*value)) << 11;
}
}
-
+
/* Button values for sensor test screen, since they do not follow any pattern, it is *
* provided as a direct list. */
if (mouse_type == NETRETROPAD_MOUSE)
@@ -1061,7 +1061,7 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP);
sensor_item_colors[86] = mouse.value[offset] ? 0xA000 : 0x0000;
-
+
offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_BUTTON_4);
sensor_item_colors[88] = mouse.value[offset] ? 0xA000 : 0x0000;
@@ -1093,7 +1093,7 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
offset = DESC_OFFSET(&lightgun, 0, 0, RETRO_DEVICE_ID_LIGHTGUN_SELECT);
sensor_item_colors[76] = lightgun.value[offset] ? 0xA000 : 0x0000;
-
+
offset = DESC_OFFSET(&lightgun, 0, 0, RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN);
sensor_item_colors[77] = lightgun.value[offset] ? 0xA000 : 0x0000;
@@ -1386,7 +1386,7 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
pointer_prev_y = pointer_y_coord;
}
}
-
+
NETRETROPAD_CORE_PREFIX(video_cb)(frame_buf, 320, 240, 640);
retro_sleep(4);
}
diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m
index ee33178ed1..aa64e6c58d 100644
--- a/frontend/drivers/platform_darwin.m
+++ b/frontend/drivers/platform_darwin.m
@@ -112,10 +112,10 @@ typedef enum
} CFDomainMask;
#if (defined(OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200))
-static int speak_pid = 0;
+static int speak_pid = 0;
#endif
-static char darwin_cpu_model_name[64];
+static char darwin_cpu_model_name[64] = {0};
static void CFSearchPathForDirectoriesInDomains(
char *s, size_t len)
diff --git a/frontend/drivers/platform_orbis.c b/frontend/drivers/platform_orbis.c
index a2e7cdd1d4..19571dfdd5 100644
--- a/frontend/drivers/platform_orbis.c
+++ b/frontend/drivers/platform_orbis.c
@@ -81,7 +81,7 @@
#define MODULE_PATH "/data/self/system/common/lib/"
#define MODULE_PATH_EXT "/app0/sce_module/"
-static char eboot_path[512];
+static char eboot_path[512] = {0};
SceKernelModule s_piglet_module;
SceKernelModule s_shacc_module;
@@ -160,7 +160,7 @@ static void frontend_orbis_get_env(int *argc, char *argv[],
if (!string_is_empty(argv[CONTENT_PATH_ARG_INDEX]))
{
- static char path[PATH_MAX_LENGTH];
+ static char path[PATH_MAX_LENGTH] = {0};
struct rarch_main_wrap *args =
(struct rarch_main_wrap*)params_data;
diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c
index d33116573f..3e2b242ab0 100644
--- a/frontend/drivers/platform_ps2.c
+++ b/frontend/drivers/platform_ps2.c
@@ -50,10 +50,10 @@
#define DEFAULT_PARTITION "hdd0:__common:pfs"
#endif
-static char mountPoint[50];
-static char mountString[10];
-static char cwd[FILENAME_MAX];
static enum frontend_fork ps2_fork_mode = FRONTEND_FORK_NONE;
+static char cwd[FILENAME_MAX] = {0};
+static char mountString[10] = {0};
+static char mountPoint[50] = {0};
static enum HDD_MOUNT_STATUS hddMountStatus = HDD_MOUNT_INIT_STATUS_NOT_READY;
static enum HDD_INIT_STATUS hddStatus = HDD_INIT_STATUS_UNKNOWN;
@@ -265,7 +265,7 @@ static void frontend_ps2_get_env(int *argc, char *argv[],
#ifndef IS_SALAMANDER
if (!string_is_empty(argv[1]))
{
- static char path[FILENAME_MAX];
+ static char path[FILENAME_MAX] = {0};
struct rarch_main_wrap *args =
(struct rarch_main_wrap*)params_data;
diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c
index 54c09b80b0..fed3d5ce9d 100644
--- a/frontend/drivers/platform_psp.c
+++ b/frontend/drivers/platform_psp.c
@@ -81,8 +81,8 @@ PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU);
unsigned int sceLibcHeapSize = SCE_LIBC_SIZE;
#endif
-static char eboot_path[512];
-static char user_path[512];
+static char eboot_path[512] = {0};
+static char user_path[512] = {0};
static enum frontend_fork psp_fork_mode = FRONTEND_FORK_NONE;
static void frontend_psp_get_env_settings(int *argc, char *argv[],
diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c
index be1dd517c2..7410f2cc7d 100644
--- a/frontend/drivers/platform_unix.c
+++ b/frontend/drivers/platform_unix.c
@@ -124,7 +124,7 @@ static uint8_t g_platform_android_flags = 0;
#define PROC_ACPI_SYSFS_AC_ADAPTER_PATH "/sys/class/power_supply/ACAD"
#define PROC_ACPI_SYSFS_BATTERY_PATH "/sys/class/power_supply"
#define PROC_ACPI_AC_ADAPTER_PATH "/proc/acpi/ac_adapter"
-static char unix_cpu_model_name[64];
+static char unix_cpu_model_name[64] = {0};
#endif
/* /proc/meminfo parameters */
@@ -1366,7 +1366,7 @@ static void frontend_unix_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
- static char config_path[PATH_MAX_LENGTH];
+ static char config_path[PATH_MAX_LENGTH] = {0};
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
if (argv && *argv)
diff --git a/frontend/drivers/platform_xdk.c b/frontend/drivers/platform_xdk.c
index f2e4aac799..3ccfb75f6d 100644
--- a/frontend/drivers/platform_xdk.c
+++ b/frontend/drivers/platform_xdk.c
@@ -59,7 +59,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
DWORD volume_device_type;
#endif
#ifndef IS_SALAMANDER
- static char path[PATH_MAX_LENGTH];
+ static char path[PATH_MAX_LENGTH] = {0};
#if defined(_XBOX1)
LAUNCH_DATA ptr;
DWORD launch_type;
diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c
index 958b4459f9..69f9bdefa6 100644
--- a/gfx/common/x11_common.c
+++ b/gfx/common/x11_common.c
@@ -73,19 +73,18 @@ Colormap g_x11_cmap;
#ifdef HAVE_XF86VM
static XF86VidModeModeInfo desktop_mode;
#endif
-static XConfigureEvent g_x11_xce;
+static bool xdg_screensaver_available = true;
+static bool g_x11_has_focus = false;
+static bool g_x11_true_full = false;
+static XConfigureEvent g_x11_xce = {0};
static Atom XA_NET_WM_STATE;
static Atom XA_NET_WM_STATE_FULLSCREEN;
static Atom XA_NET_MOVERESIZE_WINDOW;
static Atom g_x11_quit_atom;
static XIM g_x11_xim;
static XIC g_x11_xic;
+
static enum retro_key x11_keysym_lut[RETROK_LAST];
-
-static bool xdg_screensaver_available = true;
-static bool g_x11_has_focus = false;
-static bool g_x11_true_full = false;
-
static unsigned *x11_keysym_rlut = NULL;
static unsigned x11_keysym_rlut_size = 0;
diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c
index e3967ef182..7ce3597ccb 100644
--- a/input/drivers_joypad/psp_joypad.c
+++ b/input/drivers_joypad/psp_joypad.c
@@ -39,7 +39,7 @@
/* TODO/FIXME - static globals */
static int psp2_model;
static SceCtrlPortInfo old_ctrl_info, curr_ctrl_info;
-static SceCtrlActuator actuators[DEFAULT_MAX_PADS];
+static SceCtrlActuator actuators[DEFAULT_MAX_PADS] = {0};
#define LERP(p, f, t) ((((p * 10) * (t * 10)) / (f * 10)) / 10)
#define AREA(lx, ly, rx, ry, x, y) (lx <= x && x < rx && ly <= y && y < ry)
@@ -202,12 +202,12 @@ static int16_t psp_joypad_state(
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
if (
- (uint16_t)joykey != NO_BTN
+ (uint16_t)joykey != NO_BTN
&& (pad_state[port_idx] & (UINT64_C(1) << (uint16_t)joykey))
)
ret |= ( 1 << i);
else if (joyaxis != AXIS_NONE &&
- ((float)abs(psp_joypad_axis_state(port_idx, joyaxis))
+ ((float)abs(psp_joypad_axis_state(port_idx, joyaxis))
/ 0x8000) > joypad_info->axis_threshold)
ret |= (1 << i);
}
@@ -272,7 +272,7 @@ static void psp_joypad_poll(void)
SceCtrlData state_tmp;
unsigned i = player;
#if defined(VITA)
- unsigned p = (psp2_model == SCE_KERNEL_MODEL_VITATV)
+ unsigned p = (psp2_model == SCE_KERNEL_MODEL_VITATV)
? player + 1 : player;
if (curr_ctrl_info.port[p] == SCE_CTRL_TYPE_UNPAIRED)
continue;
@@ -303,7 +303,7 @@ static void psp_joypad_poll(void)
unsigned i;
SceTouchData touch_surface = {0};
sceTouchPeek(input_backtouch_toggle
- ? SCE_TOUCH_PORT_FRONT
+ ? SCE_TOUCH_PORT_FRONT
: SCE_TOUCH_PORT_BACK,
&touch_surface, 1);
diff --git a/libretro-common/audio/audio_mixer.c b/libretro-common/audio/audio_mixer.c
index ec87bcdf34..a274989be4 100644
--- a/libretro-common/audio/audio_mixer.c
+++ b/libretro-common/audio/audio_mixer.c
@@ -198,7 +198,7 @@ struct audio_mixer_voice
};
/* TODO/FIXME - static globals */
-static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES];
+static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES] = {0};
static unsigned s_rate = 0;
static void audio_mixer_release(audio_mixer_voice_t* voice);
diff --git a/libretro-common/net/net_compat.c b/libretro-common/net/net_compat.c
index ab73e8a963..6f225664b4 100644
--- a/libretro-common/net/net_compat.c
+++ b/libretro-common/net/net_compat.c
@@ -115,8 +115,8 @@ int inet_pton(int af, const char *src, void *dst)
#elif defined(_XBOX)
struct hostent *gethostbyname(const char *name)
{
- static struct in_addr addr;
- static struct hostent he;
+ static struct in_addr addr = {0};
+ static struct hostent he = {0};
WSAEVENT event;
XNDNS *dns = NULL;
struct hostent *ret = NULL;
@@ -180,8 +180,8 @@ uint32_t inet_addr(const char *cp)
struct hostent *gethostbyname(const char *name)
{
- static struct SceNetInAddr addr;
- static struct hostent he;
+ static struct SceNetInAddr addr = {0};
+ static struct hostent he = {0};
int rid;
struct hostent *ret = NULL;
diff --git a/libretro-common/vfs/vfs_implementation_cdrom.c b/libretro-common/vfs/vfs_implementation_cdrom.c
index 4dd83a8d10..093cd9cc02 100644
--- a/libretro-common/vfs/vfs_implementation_cdrom.c
+++ b/libretro-common/vfs/vfs_implementation_cdrom.c
@@ -31,7 +31,7 @@
#endif
/* TODO/FIXME - static global variable */
-static cdrom_toc_t vfs_cdrom_toc;
+static cdrom_toc_t vfs_cdrom_toc = {0};
const cdrom_toc_t* retro_vfs_file_get_cdrom_toc(void)
{
@@ -93,8 +93,8 @@ int64_t retro_vfs_file_seek_cdrom(
break;
case SEEK_END:
{
- ssize_t pregap_lba_len = (vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].audio
- ? 0
+ ssize_t pregap_lba_len = (vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].audio
+ ? 0
: (vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].lba - vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].lba_start));
ssize_t lba_len = vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].track_size - pregap_lba_len;
#ifdef CDROM_DEBUG
@@ -153,7 +153,7 @@ void retro_vfs_file_open_cdrom(
stream->cdrom.cur_track = 1;
- if ( !string_is_equal_noncase(ext, "cue")
+ if ( !string_is_equal_noncase(ext, "cue")
&& !string_is_equal_noncase(ext, "bin"))
return;
@@ -231,7 +231,7 @@ void retro_vfs_file_open_cdrom(
size_t path_len = strlen(path);
const char *ext = path_get_extension(path);
- if ( !string_is_equal_noncase(ext, "cue")
+ if ( !string_is_equal_noncase(ext, "cue")
&& !string_is_equal_noncase(ext, "bin"))
return;
@@ -378,7 +378,7 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
if (string_is_equal_noncase(ext, "cue"))
{
- if ((int64_t)len >= (int64_t)stream->cdrom.cue_len
+ if ((int64_t)len >= (int64_t)stream->cdrom.cue_len
- stream->cdrom.byte_pos)
len = stream->cdrom.cue_len - stream->cdrom.byte_pos - 1;
#ifdef CDROM_DEBUG
@@ -403,17 +403,17 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
unsigned char rframe = 0;
size_t skip = stream->cdrom.byte_pos % 2352;
- if (stream->cdrom.byte_pos >=
+ if (stream->cdrom.byte_pos >=
vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].track_bytes)
return 0;
- if (stream->cdrom.byte_pos + len >
+ if (stream->cdrom.byte_pos + len >
vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].track_bytes)
- len -= (stream->cdrom.byte_pos + len)
+ len -= (stream->cdrom.byte_pos + len)
- vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].track_bytes;
cdrom_lba_to_msf(stream->cdrom.cur_lba, &min, &sec, &frame);
- cdrom_lba_to_msf(stream->cdrom.cur_lba
+ cdrom_lba_to_msf(stream->cdrom.cur_lba
- vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].lba,
&rmin, &rsec, &rframe);
@@ -452,8 +452,8 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
}
stream->cdrom.byte_pos += len;
- stream->cdrom.cur_lba =
- vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].lba
+ stream->cdrom.cur_lba =
+ vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].lba
+ (stream->cdrom.byte_pos / 2352);
cdrom_lba_to_msf(stream->cdrom.cur_lba,
diff --git a/network/cloud_sync/webdav.c b/network/cloud_sync/webdav.c
index 9398adbefd..7620ee7aa3 100644
--- a/network/cloud_sync/webdav.c
+++ b/network/cloud_sync/webdav.c
@@ -61,7 +61,7 @@ typedef struct
unsigned nc;
} webdav_state_t;
-static webdav_state_t webdav_driver_st;
+static webdav_state_t webdav_driver_st = {0};
webdav_state_t *webdav_state_get_ptr(void)
{
diff --git a/network/cloud_sync_driver.c b/network/cloud_sync_driver.c
index db7b038697..4bf166c816 100644
--- a/network/cloud_sync_driver.c
+++ b/network/cloud_sync_driver.c
@@ -35,7 +35,7 @@ const cloud_sync_driver_t *cloud_sync_drivers[] = {
NULL
};
-static cloud_sync_driver_state_t cloud_sync_driver_st;
+static cloud_sync_driver_state_t cloud_sync_driver_st = {0};
cloud_sync_driver_state_t *cloud_sync_state_get_ptr(void)
{
diff --git a/network/discord.c b/network/discord.c
index 643a8b8ff5..347a0802da 100644
--- a/network/discord.c
+++ b/network/discord.c
@@ -1,504 +1,504 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2021 - Daniel De Matteis
- * Copyright (C) 2016-2019 - Andr�s Su�rez
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-#include
-#include
-#include
-#include
-#include