(Location) Add g_extern.system handle to retro_location_callback

This commit is contained in:
twinaphex 2013-12-19 02:54:46 +01:00
parent fd5a3fa9da
commit dfe42f4026
4 changed files with 8 additions and 4 deletions

View File

@ -756,7 +756,7 @@ void init_location(void)
find_location_driver();
driver.location_data = location_init_func(g_settings.location.update_interval_ms, g_settings.location.update_interval_distance);
driver.location_data = location_init_func(g_extern.system.location_callback.interval_in_ms, g_extern.system.location_callback.interval_distance_in_meters);
if (!driver.location_data)
{
@ -821,7 +821,7 @@ void init_drivers(void)
#ifdef HAVE_LOCATION
// FIXME
// Only init location driver if we're ever going to use it.
//if (g_extern.system.camera_callback.caps)
if (g_extern.system.location_callback)
init_location();
#endif

View File

@ -840,6 +840,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
{
RARCH_LOG("Environ GET_LOCATION_INTERFACE.\n");
struct retro_location_interface *cb = (struct retro_location_interface*)data;
g_extern.system.location_callback = *cb;
break;
}
#endif

View File

@ -427,6 +427,9 @@ 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;

View File

@ -41,7 +41,7 @@
// 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_interface * --
// 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.
@ -68,7 +68,7 @@ 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_interface
struct retro_location_callback
{
int interval_in_ms;
int interval_distance_in_meters;