diff --git a/driver.c b/driver.c index 153178d874..6aa1d9a913 100644 --- a/driver.c +++ b/driver.c @@ -641,6 +641,28 @@ void driver_location_stop(void) if (driver.location && driver.location_data) driver.location->stop(driver.location_data); } + +void driver_location_set_interval(int interval_msecs, int interval_distance) +{ + if (driver.location && driver.location_data) + driver.location->set_interval(driver.location_data, interval_msecs, interval_distance); +} + +double driver_location_get_latitude(void) +{ + if (driver.location && driver.location_data) + return driver.location->get_latitude(driver.location_data); + else + return 0.0; +} + +double driver_location_get_longitude(void) +{ + if (driver.location && driver.location_data) + return driver.location->get_longitude(driver.location_data); + else + return 0.0; +} #endif uintptr_t driver_get_current_framebuffer(void) diff --git a/driver.h b/driver.h index 1851d5730f..c62fb06b10 100644 --- a/driver.h +++ b/driver.h @@ -604,6 +604,9 @@ void driver_camera_poll(void); #ifdef HAVE_LOCATION bool driver_location_start(void); void driver_location_stop(void); +double driver_location_get_latitude(void); +double driver_location_get_longitude(void); +void driver_location_set_interval(int, int); #endif extern driver_t driver; diff --git a/dynamic.c b/dynamic.c index ad6c7bc471..eeb1da977a 100644 --- a/dynamic.c +++ b/dynamic.c @@ -840,6 +840,11 @@ bool rarch_environment_cb(unsigned cmd, void *data) { RARCH_LOG("Environ GET_LOCATION_INTERFACE.\n"); struct retro_location_callback *cb = (struct retro_location_callback*)data; + cb->start = driver_location_start; + cb->stop = driver_location_stop; + cb->get_latitude = driver_location_get_latitude; + cb->get_longitude = driver_location_get_longitude; + cb->set_interval = driver_location_set_interval; g_extern.system.location_callback = *cb; break; } diff --git a/libretro.h b/libretro.h index 376f26c32d..4985f64179 100755 --- a/libretro.h +++ b/libretro.h @@ -758,7 +758,7 @@ typedef void (*retro_location_set_interval_t)(int interval_ms, int interval_dist //Start location services. The device will start listening for changes to the //current location at regular intervals (which are defined with retro_location_set_interval_t). -typedef void (*retro_location_start_t)(void); +typedef bool (*retro_location_start_t)(void); //Stop location services. The device will stop listening for changes to the current //location.