diff --git a/Makefile.common b/Makefile.common
index 236fe2a7e8..31e61bf99f 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -217,7 +217,6 @@ OBJ += frontend/frontend.o \
gfx/video_driver.o \
gfx/video_crt_switch.o \
wifi/wifi_driver.o \
- location/location_driver.o \
configuration.o \
$(LIBRETRO_COMM_DIR)/dynamic/dylib.o \
dynamic.o \
diff --git a/dynamic.c b/dynamic.c
index ee8981257b..7b0990410c 100644
--- a/dynamic.c
+++ b/dynamic.c
@@ -53,7 +53,6 @@
#include "command.h"
#include "audio/audio_driver.h"
-#include "location/location_driver.h"
#include "record/record_driver.h"
#include "driver.h"
#include "performance_counters.h"
@@ -663,7 +662,7 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
rarch_ctl(RARCH_CTL_FRAME_TIME_FREE, NULL);
rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
- location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
+ rarch_ctl(RARCH_CTL_LOCATION_UNSET_ACTIVE, NULL);
/* Performance counters no longer valid. */
performance_counters_clear();
@@ -1440,7 +1439,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
if (system)
system->location_cb = *cb;
- location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
+ rarch_ctl(RARCH_CTL_LOCATION_UNSET_ACTIVE, NULL);
break;
}
diff --git a/griffin/griffin.c b/griffin/griffin.c
index c771ffea1d..e93ad86c44 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -892,7 +892,6 @@ DRIVERS
#include "../input/input_driver.c"
#include "../audio/audio_driver.c"
#include "../libretro-common/audio/audio_mixer.c"
-#include "../location/location_driver.c"
/*============================================================
SCALERS
diff --git a/list_special.c b/list_special.c
index 2f49ed3c14..fe4815404b 100644
--- a/list_special.c
+++ b/list_special.c
@@ -35,8 +35,6 @@
#include "wifi/wifi_driver.h"
#endif
-#include "location/location_driver.h"
-
#include "list_special.h"
#include "frontend/frontend_driver.h"
#include "core_info.h"
diff --git a/location/drivers/android.c b/location/drivers/android.c
index 1fa9c64cd5..e81401e92b 100644
--- a/location/drivers/android.c
+++ b/location/drivers/android.c
@@ -14,7 +14,7 @@
* If not, see .
*/
-#include "../location_driver.h"
+#include "../../retroarch.h"
typedef struct android_location
{
diff --git a/location/drivers/nulllocation.c b/location/drivers/nulllocation.c
index ef0eeede53..da9e45587c 100644
--- a/location/drivers/nulllocation.c
+++ b/location/drivers/nulllocation.c
@@ -14,7 +14,7 @@
* If not, see .
*/
-#include "../location_driver.h"
+#include "../../retroarch.h"
static void *null_location_init(void)
{
diff --git a/location/location_driver.c b/location/location_driver.c
deleted file mode 100644
index 5d8c62b445..0000000000
--- a/location/location_driver.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2017 - 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 "location_driver.h"
-
-#include "../configuration.h"
-#include "../core.h"
-#include "../driver.h"
-#include "../retroarch.h"
-#include "../list_special.h"
-#include "../verbosity.h"
-
-static const location_driver_t *location_drivers[] = {
-#ifdef ANDROID
- &location_android,
-#endif
- &location_null,
- NULL,
-};
-
-static const location_driver_t *location_driver;
-static void *location_data;
-
-/**
- * location_driver_find_handle:
- * @idx : index of driver to get handle to.
- *
- * Returns: handle to location driver at index. Can be NULL
- * if nothing found.
- **/
-const void *location_driver_find_handle(int idx)
-{
- const void *drv = location_drivers[idx];
- if (!drv)
- return NULL;
- return drv;
-}
-
-/**
- * location_driver_find_ident:
- * @idx : index of driver to get handle to.
- *
- * Returns: Human-readable identifier of location driver at index. Can be NULL
- * if nothing found.
- **/
-const char *location_driver_find_ident(int idx)
-{
- const location_driver_t *drv = location_drivers[idx];
- if (!drv)
- return NULL;
- return drv->ident;
-}
-
-/**
- * config_get_location_driver_options:
- *
- * Get an enumerated list of all location driver names,
- * separated by '|'.
- *
- * Returns: string listing of all location driver names,
- * separated by '|'.
- **/
-const char* config_get_location_driver_options(void)
-{
- return char_list_new_special(STRING_LIST_LOCATION_DRIVERS, NULL);
-}
-
-void find_location_driver(void)
-{
- int i;
- driver_ctx_info_t drv;
- settings_t *settings = config_get_ptr();
-
- drv.label = "location_driver";
- drv.s = settings->arrays.location_driver;
-
- driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
-
- i = (int)drv.len;
-
- if (i >= 0)
- location_driver = (const location_driver_t*)location_driver_find_handle(i);
- else
- {
-
- if (verbosity_is_enabled())
- {
- unsigned d;
- RARCH_ERR("Couldn't find any location driver named \"%s\"\n",
- settings->arrays.location_driver);
- RARCH_LOG_OUTPUT("Available location drivers are:\n");
- for (d = 0; location_driver_find_handle(d); d++)
- RARCH_LOG_OUTPUT("\t%s\n", location_driver_find_ident(d));
-
- RARCH_WARN("Going to default to first location driver...\n");
- }
-
- location_driver = (const location_driver_t*)location_driver_find_handle(0);
-
- if (!location_driver)
- retroarch_fail(1, "find_location_driver()");
- }
-}
-
-/**
- * driver_location_start:
- *
- * Starts location driver interface..
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: true (1) if successful, otherwise false (0).
- **/
-bool driver_location_start(void)
-{
- settings_t *settings = config_get_ptr();
-
- if (location_driver && location_data && location_driver->start)
- {
- if (settings->bools.location_allow)
- return location_driver->start(location_data);
-
- runloop_msg_queue_push("Location is explicitly disabled.\n", 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
- }
- return false;
-}
-
-/**
- * driver_location_stop:
- *
- * Stops location driver interface..
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: true (1) if successful, otherwise false (0).
- **/
-void driver_location_stop(void)
-{
- if (location_driver && location_driver->stop && location_data)
- location_driver->stop(location_data);
-}
-
-/**
- * driver_location_set_interval:
- * @interval_msecs : Interval time in milliseconds.
- * @interval_distance : Distance at which to update.
- *
- * Sets interval update time for location driver interface.
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- **/
-void driver_location_set_interval(unsigned interval_msecs,
- unsigned interval_distance)
-{
- if (location_driver && location_driver->set_interval
- && location_data)
- location_driver->set_interval(location_data,
- interval_msecs, interval_distance);
-}
-
-/**
- * driver_location_get_position:
- * @lat : Latitude of current position.
- * @lon : Longitude of current position.
- * @horiz_accuracy : Horizontal accuracy.
- * @vert_accuracy : Vertical accuracy.
- *
- * Gets current positioning information from
- * location driver interface.
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: bool (1) if successful, otherwise false (0).
- **/
-bool driver_location_get_position(double *lat, double *lon,
- double *horiz_accuracy, double *vert_accuracy)
-{
- if (location_driver && location_driver->get_position
- && location_data)
- return location_driver->get_position(location_data,
- lat, lon, horiz_accuracy, vert_accuracy);
-
- *lat = 0.0;
- *lon = 0.0;
- *horiz_accuracy = 0.0;
- *vert_accuracy = 0.0;
- return false;
-}
-
-void init_location(void)
-{
- rarch_system_info_t *system = runloop_get_system_info();
-
- /* Resource leaks will follow if location interface is initialized twice. */
- if (location_data)
- return;
-
- find_location_driver();
-
- location_data = location_driver->init();
-
- if (!location_data)
- {
- RARCH_ERR("Failed to initialize location driver. Will continue without location.\n");
- location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
- }
-
- if (system->location_cb.initialized)
- system->location_cb.initialized();
-}
-
-static void uninit_location(void)
-{
- rarch_system_info_t *system = runloop_get_system_info();
-
- if (location_data && location_driver)
- {
- if (system->location_cb.deinitialized)
- system->location_cb.deinitialized();
-
- if (location_driver->free)
- location_driver->free(location_data);
- }
-
- location_data = NULL;
-}
-
-bool location_driver_ctl(enum rarch_location_ctl_state state, void *data)
-{
- static bool location_driver_active = false;
-
- switch (state)
- {
- case RARCH_LOCATION_CTL_DESTROY:
- location_driver_active = false;
- location_driver = NULL;
- break;
- case RARCH_LOCATION_CTL_DEINIT:
- uninit_location();
- break;
- case RARCH_LOCATION_CTL_SET_ACTIVE:
- location_driver_active = true;
- break;
- case RARCH_LOCATION_CTL_UNSET_ACTIVE:
- location_driver_active = false;
- break;
- case RARCH_LOCATION_CTL_IS_ACTIVE:
- return location_driver_active;
- default:
- break;
- }
-
- return true;
-}
diff --git a/location/location_driver.h b/location/location_driver.h
deleted file mode 100644
index 3cfeda2dba..0000000000
--- a/location/location_driver.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2017 - 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 .
- */
-
-#ifndef __LOCATION_DRIVER__H
-#define __LOCATION_DRIVER__H
-
-#include
-#include
-
-#include
-#include
-
-RETRO_BEGIN_DECLS
-
-enum rarch_location_ctl_state
-{
- RARCH_LOCATION_CTL_NONE = 0,
- RARCH_LOCATION_CTL_DESTROY,
- RARCH_LOCATION_CTL_DEINIT,
- RARCH_LOCATION_CTL_SET_ACTIVE,
- RARCH_LOCATION_CTL_UNSET_ACTIVE,
- RARCH_LOCATION_CTL_IS_ACTIVE
-};
-
-typedef struct location_driver
-{
- void *(*init)(void);
- void (*free)(void *data);
-
- bool (*start)(void *data);
- void (*stop)(void *data);
-
- bool (*get_position)(void *data, double *lat, double *lon,
- double *horiz_accuracy, double *vert_accuracy);
- void (*set_interval)(void *data, unsigned interval_msecs,
- unsigned interval_distance);
- const char *ident;
-} location_driver_t;
-
-extern location_driver_t location_corelocation;
-extern location_driver_t location_android;
-extern location_driver_t location_null;
-
-/**
- * driver_location_start:
- *
- * Starts location driver interface..
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: true (1) if successful, otherwise false (0).
- **/
-bool driver_location_start(void);
-
-/**
- * driver_location_stop:
- *
- * Stops location driver interface..
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: true (1) if successful, otherwise false (0).
- **/
-void driver_location_stop(void);
-
-/**
- * driver_location_get_position:
- * @lat : Latitude of current position.
- * @lon : Longitude of current position.
- * @horiz_accuracy : Horizontal accuracy.
- * @vert_accuracy : Vertical accuracy.
- *
- * Gets current positioning information from
- * location driver interface.
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- *
- * Returns: bool (1) if successful, otherwise false (0).
- **/
-bool driver_location_get_position(double *lat, double *lon,
- double *horiz_accuracy, double *vert_accuracy);
-
-/**
- * driver_location_set_interval:
- * @interval_msecs : Interval time in milliseconds.
- * @interval_distance : Distance at which to update.
- *
- * Sets interval update time for location driver interface.
- * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
- **/
-void driver_location_set_interval(unsigned interval_msecs,
- unsigned interval_distance);
-
-/**
- * config_get_location_driver_options:
- *
- * Get an enumerated list of all location driver names,
- * separated by '|'.
- *
- * Returns: string listing of all location driver names,
- * separated by '|'.
- **/
-const char* config_get_location_driver_options(void);
-
-/**
- * location_driver_find_handle:
- * @index : index of driver to get handle to.
- *
- * Returns: handle to location driver at index. Can be NULL
- * if nothing found.
- **/
-const void *location_driver_find_handle(int index);
-
-/**
- * location_driver_find_ident:
- * @index : index of driver to get handle to.
- *
- * Returns: Human-readable identifier of location driver at index. Can be NULL
- * if nothing found.
- **/
-const char *location_driver_find_ident(int index);
-
-void find_location_driver(void);
-
-void init_location(void);
-
-bool location_driver_ctl(enum rarch_location_ctl_state state, void *data);
-
-RETRO_END_DECLS
-
-#endif
diff --git a/menu/menu_setting.c b/menu/menu_setting.c
index 3f926bd9eb..e58a450ec8 100644
--- a/menu/menu_setting.c
+++ b/menu/menu_setting.c
@@ -75,7 +75,6 @@
#include "../dynamic.h"
#include "../list_special.h"
#include "../wifi/wifi_driver.h"
-#include "../location/location_driver.h"
#include "../record/record_driver.h"
#include "../audio/audio_driver.h"
#include "../input/input_driver.h"
diff --git a/retroarch.c b/retroarch.c
index 8b023b2f5f..e922cc70df 100644
--- a/retroarch.c
+++ b/retroarch.c
@@ -121,7 +121,6 @@
#endif
#include "gfx/video_driver.h"
#include "record/record_driver.h"
-#include "location/location_driver.h"
#include "wifi/wifi_driver.h"
#include "led/led_driver.h"
#include "midi/midi_driver.h"
@@ -792,6 +791,221 @@ bool bsv_movie_check(void)
return true;
}
+/* Location */
+
+static const location_driver_t *location_drivers[] = {
+#ifdef ANDROID
+ &location_android,
+#endif
+ &location_null,
+ NULL,
+};
+
+static const location_driver_t *location_driver;
+static void *location_data;
+
+static bool location_driver_active = false;
+
+/**
+ * location_driver_find_handle:
+ * @idx : index of driver to get handle to.
+ *
+ * Returns: handle to location driver at index. Can be NULL
+ * if nothing found.
+ **/
+const void *location_driver_find_handle(int idx)
+{
+ const void *drv = location_drivers[idx];
+ if (!drv)
+ return NULL;
+ return drv;
+}
+
+/**
+ * location_driver_find_ident:
+ * @idx : index of driver to get handle to.
+ *
+ * Returns: Human-readable identifier of location driver at index. Can be NULL
+ * if nothing found.
+ **/
+const char *location_driver_find_ident(int idx)
+{
+ const location_driver_t *drv = location_drivers[idx];
+ if (!drv)
+ return NULL;
+ return drv->ident;
+}
+
+/**
+ * config_get_location_driver_options:
+ *
+ * Get an enumerated list of all location driver names,
+ * separated by '|'.
+ *
+ * Returns: string listing of all location driver names,
+ * separated by '|'.
+ **/
+const char* config_get_location_driver_options(void)
+{
+ return char_list_new_special(STRING_LIST_LOCATION_DRIVERS, NULL);
+}
+
+static void find_location_driver(void)
+{
+ int i;
+ driver_ctx_info_t drv;
+ settings_t *settings = config_get_ptr();
+
+ drv.label = "location_driver";
+ drv.s = settings->arrays.location_driver;
+
+ driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
+
+ i = (int)drv.len;
+
+ if (i >= 0)
+ location_driver = (const location_driver_t*)location_driver_find_handle(i);
+ else
+ {
+
+ if (verbosity_is_enabled())
+ {
+ unsigned d;
+ RARCH_ERR("Couldn't find any location driver named \"%s\"\n",
+ settings->arrays.location_driver);
+ RARCH_LOG_OUTPUT("Available location drivers are:\n");
+ for (d = 0; location_driver_find_handle(d); d++)
+ RARCH_LOG_OUTPUT("\t%s\n", location_driver_find_ident(d));
+
+ RARCH_WARN("Going to default to first location driver...\n");
+ }
+
+ location_driver = (const location_driver_t*)location_driver_find_handle(0);
+
+ if (!location_driver)
+ retroarch_fail(1, "find_location_driver()");
+ }
+}
+
+/**
+ * driver_location_start:
+ *
+ * Starts location driver interface..
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ *
+ * Returns: true (1) if successful, otherwise false (0).
+ **/
+bool driver_location_start(void)
+{
+ settings_t *settings = config_get_ptr();
+
+ if (location_driver && location_data && location_driver->start)
+ {
+ if (settings->bools.location_allow)
+ return location_driver->start(location_data);
+
+ runloop_msg_queue_push("Location is explicitly disabled.\n", 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
+ }
+ return false;
+}
+
+/**
+ * driver_location_stop:
+ *
+ * Stops location driver interface..
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ *
+ * Returns: true (1) if successful, otherwise false (0).
+ **/
+void driver_location_stop(void)
+{
+ if (location_driver && location_driver->stop && location_data)
+ location_driver->stop(location_data);
+}
+
+/**
+ * driver_location_set_interval:
+ * @interval_msecs : Interval time in milliseconds.
+ * @interval_distance : Distance at which to update.
+ *
+ * Sets interval update time for location driver interface.
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ **/
+void driver_location_set_interval(unsigned interval_msecs,
+ unsigned interval_distance)
+{
+ if (location_driver && location_driver->set_interval
+ && location_data)
+ location_driver->set_interval(location_data,
+ interval_msecs, interval_distance);
+}
+
+/**
+ * driver_location_get_position:
+ * @lat : Latitude of current position.
+ * @lon : Longitude of current position.
+ * @horiz_accuracy : Horizontal accuracy.
+ * @vert_accuracy : Vertical accuracy.
+ *
+ * Gets current positioning information from
+ * location driver interface.
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ *
+ * Returns: bool (1) if successful, otherwise false (0).
+ **/
+bool driver_location_get_position(double *lat, double *lon,
+ double *horiz_accuracy, double *vert_accuracy)
+{
+ if (location_driver && location_driver->get_position
+ && location_data)
+ return location_driver->get_position(location_data,
+ lat, lon, horiz_accuracy, vert_accuracy);
+
+ *lat = 0.0;
+ *lon = 0.0;
+ *horiz_accuracy = 0.0;
+ *vert_accuracy = 0.0;
+ return false;
+}
+
+static void init_location(void)
+{
+ rarch_system_info_t *system = &runloop_system;
+
+ /* Resource leaks will follow if location interface is initialized twice. */
+ if (location_data)
+ return;
+
+ find_location_driver();
+
+ location_data = location_driver->init();
+
+ if (!location_data)
+ {
+ RARCH_ERR("Failed to initialize location driver. Will continue without location.\n");
+ rarch_ctl(RARCH_CTL_LOCATION_UNSET_ACTIVE, NULL);
+ }
+
+ if (system->location_cb.initialized)
+ system->location_cb.initialized();
+}
+
+static void uninit_location(void)
+{
+ rarch_system_info_t *system = &runloop_system;
+
+ if (location_data && location_driver)
+ {
+ if (system->location_cb.deinitialized)
+ system->location_cb.deinitialized();
+
+ if (location_driver->free)
+ location_driver->free(location_data);
+ }
+
+ location_data = NULL;
+}
+
/* Camera */
static const camera_driver_t *camera_drivers[] = {
@@ -1273,7 +1487,7 @@ void drivers_init(int flags)
if (flags & DRIVER_LOCATION_MASK)
{
/* Only initialize location driver if we're ever going to use it. */
- if (location_driver_ctl(RARCH_LOCATION_CTL_IS_ACTIVE, NULL))
+ if (location_driver_active)
init_location();
}
@@ -1362,7 +1576,7 @@ void driver_uninit(int flags)
#endif
if ((flags & DRIVER_LOCATION_MASK))
- location_driver_ctl(RARCH_LOCATION_CTL_DEINIT, NULL);
+ uninit_location();
if ((flags & DRIVER_CAMERA_MASK))
{
@@ -1423,7 +1637,8 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
#ifdef HAVE_MENU
menu_driver_destroy();
#endif
- location_driver_ctl(RARCH_LOCATION_CTL_DESTROY, NULL);
+ location_driver_active = false;
+ location_driver = NULL;
/* Camera */
camera_driver_active = false;
@@ -2887,6 +3102,12 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
switch(state)
{
+ case RARCH_CTL_LOCATION_SET_ACTIVE:
+ location_driver_active = true;
+ break;
+ case RARCH_CTL_LOCATION_UNSET_ACTIVE:
+ location_driver_active = false;
+ break;
case RARCH_CTL_BSV_MOVIE_IS_INITED:
return (bsv_movie_state_handle != NULL);
case RARCH_CTL_IS_PATCH_BLOCKED:
diff --git a/retroarch.h b/retroarch.h
index 89d90ee427..7e8521c1e3 100644
--- a/retroarch.h
+++ b/retroarch.h
@@ -192,7 +192,11 @@ enum rarch_ctl_state
RARCH_CTL_CAMERA_SET_CB,
/* BSV Movie */
- RARCH_CTL_BSV_MOVIE_IS_INITED
+ RARCH_CTL_BSV_MOVIE_IS_INITED,
+
+ /* Location */
+ RARCH_CTL_LOCATION_SET_ACTIVE,
+ RARCH_CTL_LOCATION_UNSET_ACTIVE
};
enum rarch_capabilities
@@ -463,6 +467,108 @@ void bsv_movie_set_input(int16_t *bsv_data);
bool bsv_movie_check(void);
+/* Location */
+
+enum rarch_location_ctl_state
+{
+ RARCH_LOCATION_CTL_NONE = 0,
+};
+
+typedef struct location_driver
+{
+ void *(*init)(void);
+ void (*free)(void *data);
+
+ bool (*start)(void *data);
+ void (*stop)(void *data);
+
+ bool (*get_position)(void *data, double *lat, double *lon,
+ double *horiz_accuracy, double *vert_accuracy);
+ void (*set_interval)(void *data, unsigned interval_msecs,
+ unsigned interval_distance);
+ const char *ident;
+} location_driver_t;
+
+extern location_driver_t location_corelocation;
+extern location_driver_t location_android;
+extern location_driver_t location_null;
+
+/**
+ * driver_location_start:
+ *
+ * Starts location driver interface..
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ *
+ * Returns: true (1) if successful, otherwise false (0).
+ **/
+bool driver_location_start(void);
+
+/**
+ * driver_location_stop:
+ *
+ * Stops location driver interface..
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ *
+ * Returns: true (1) if successful, otherwise false (0).
+ **/
+void driver_location_stop(void);
+
+/**
+ * driver_location_get_position:
+ * @lat : Latitude of current position.
+ * @lon : Longitude of current position.
+ * @horiz_accuracy : Horizontal accuracy.
+ * @vert_accuracy : Vertical accuracy.
+ *
+ * Gets current positioning information from
+ * location driver interface.
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ *
+ * Returns: bool (1) if successful, otherwise false (0).
+ **/
+bool driver_location_get_position(double *lat, double *lon,
+ double *horiz_accuracy, double *vert_accuracy);
+
+/**
+ * driver_location_set_interval:
+ * @interval_msecs : Interval time in milliseconds.
+ * @interval_distance : Distance at which to update.
+ *
+ * Sets interval update time for location driver interface.
+ * Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
+ **/
+void driver_location_set_interval(unsigned interval_msecs,
+ unsigned interval_distance);
+
+/**
+ * config_get_location_driver_options:
+ *
+ * Get an enumerated list of all location driver names,
+ * separated by '|'.
+ *
+ * Returns: string listing of all location driver names,
+ * separated by '|'.
+ **/
+const char* config_get_location_driver_options(void);
+
+/**
+ * location_driver_find_handle:
+ * @index : index of driver to get handle to.
+ *
+ * Returns: handle to location driver at index. Can be NULL
+ * if nothing found.
+ **/
+const void *location_driver_find_handle(int index);
+
+/**
+ * location_driver_find_ident:
+ * @index : index of driver to get handle to.
+ *
+ * Returns: Human-readable identifier of location driver at index. Can be NULL
+ * if nothing found.
+ **/
+const char *location_driver_find_ident(int index);
+
/* Camera */
typedef struct camera_driver