diff --git a/driver.c b/driver.c index fb8ef60b9c..d6f98c362c 100644 --- a/driver.c +++ b/driver.c @@ -821,8 +821,8 @@ void init_drivers(void) #ifdef HAVE_LOCATION // FIXME // Only init location driver if we're ever going to use it. - if (g_extern.system.location_callback) - init_location(); + if (g_extern.system.location_callback.enable) + init_location(); #endif #ifdef HAVE_OSK diff --git a/dynamic.c b/dynamic.c index 923ff24029..8424683231 100644 --- a/dynamic.c +++ b/dynamic.c @@ -839,7 +839,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) case RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE: { RARCH_LOG("Environ GET_LOCATION_INTERFACE.\n"); - struct retro_location_interface *cb = (struct retro_location_interface*)data; + struct retro_location_callback *cb = (struct retro_location_callback*)data; g_extern.system.location_callback = *cb; break; } diff --git a/general.h b/general.h index af08e7cadf..6878130345 100644 --- a/general.h +++ b/general.h @@ -427,9 +427,7 @@ struct global struct retro_disk_control_callback disk_control; struct retro_hw_render_callback hw_render_callback; struct retro_camera_callback camera_callback; -#ifdef HAVE_LOCATION struct retro_location_callback location_callback; -#endif struct retro_frame_time_callback frame_time; retro_usec_t frame_time_last; diff --git a/libretro.h b/libretro.h index ede60f040b..376f26c32d 100755 --- a/libretro.h +++ b/libretro.h @@ -568,6 +568,12 @@ enum retro_mod // struct retro_perf_callback * -- // Gets an interface for performance counters. This is useful for performance logging in a // cross-platform way and for detecting architecture-specific features, such as SIMD support. +#define RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE 29 + // struct retro_location_callback * -- + // Gets access to the location interface. + // The purpose of this interface is to be able to retrieve location-based information from the host device, + // such as current latitude / longitude. + // enum retro_log_level { @@ -743,6 +749,39 @@ struct retro_camera_callback retro_camera_lifetime_status_t deinitialized; }; +//Sets the interval of time and/or distance at which to update/poll location-based data. +//To ensure compatibility with all location-based implementations, values for both +//interval_ms and interval_distance should be provided. +//interval_ms is the interval expressed in milliseconds +//interval_distance is the distance interval expressed in meters. +typedef void (*retro_location_set_interval_t)(int interval_ms, int interval_distance); + +//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); + +//Stop location services. The device will stop listening for changes to the current +//location. +typedef void (*retro_location_stop_t)(void); + +//Get the latitude of the current location. +typedef double (*retro_location_get_latitude_t)(void); + +//Get the longitude of the current location. +typedef double (*retro_location_get_longitude_t)(void); + +struct retro_location_callback +{ + bool enable; + int interval_in_ms; + int interval_distance_in_meters; + retro_location_start_t start; + retro_location_stop_t stop; + retro_location_get_latitude_t get_latitude; + retro_location_get_longitude_t get_longitude; + retro_location_set_interval_t set_interval; +}; + enum retro_rumble_effect { RETRO_RUMBLE_STRONG = 0, diff --git a/libretro_private.h b/libretro_private.h index 4c0b121e5d..2c4cc5a916 100644 --- a/libretro_private.h +++ b/libretro_private.h @@ -40,44 +40,7 @@ // Requests that this core is deinitialized, and a new core is loaded. It also escapes the main loop the core is currently // bound to. // The libretro core used is set with SET_LIBRETRO_PATH, and path to game is passed in _EXEC. NULL means no game. -#define RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE (RETRO_ENVIRONMENT_PRIVATE | 3) - // struct retro_location_callback * -- - // Gets access to the location interface. - // The purpose of this interface is to be able to retrieve location-based information from the host device, - // such as current latitude / longitude. - // -//Sets the interval of time and/or distance at which to update/poll location-based data. -//To ensure compatibility with all location-based implementations, values for both -//interval_ms and interval_distance should be provided. -//interval_ms is the interval expressed in milliseconds -//interval_distance is the distance interval expressed in meters. -typedef void (*retro_location_set_interval_t)(int interval_ms, int interval_distance); - -//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); - -//Stop location services. The device will stop listening for changes to the current -//location. -typedef void (*retro_location_stop_t)(void); - -//Get the latitude of the current location. -typedef double (*retro_location_get_latitude_t)(void); - -//Get the longitude of the current location. -typedef double (*retro_location_get_longitude_t)(void); - -struct retro_location_callback -{ - int interval_in_ms; - int interval_distance_in_meters; - retro_location_start_t start; - retro_location_stop_t stop; - retro_location_get_latitude_t get_latitude; - retro_location_get_longitude_t get_longitude; - retro_location_set_interval_t set_interval; -}; #endif