diff --git a/Makefile b/Makefile index 9a9f9a60ab..75cb52d78d 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ OBJ = frontend/frontend.o \ audio/dsp_filter.o \ audio/sinc.o \ audio/cc_resampler.o \ + location/null.o \ performance.o diff --git a/Makefile.win b/Makefile.win index a400d3590a..2902cecaf3 100644 --- a/Makefile.win +++ b/Makefile.win @@ -49,6 +49,7 @@ OBJ = frontend/frontend.o \ audio/dsp_filter.o \ audio/sinc.o \ audio/cc_resampler.o \ + location/null.o \ performance.o JOBJ := conf/config_file.o \ diff --git a/android/phoenix/jni/Android.mk b/android/phoenix/jni/Android.mk index d213e25d8b..48dd4a8031 100644 --- a/android/phoenix/jni/Android.mk +++ b/android/phoenix/jni/Android.mk @@ -54,7 +54,7 @@ else GLES_LIB := -lGLESv2 endif -LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_CAMERA -DRARCH_INTERNAL -DHAVE_LOCATION -DHAVE_CC_RESAMPLER -DHAVE_FILTERS_BUILTIN +LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_CAMERA -DRARCH_INTERNAL -DHAVE_CC_RESAMPLER -DHAVE_FILTERS_BUILTIN LOCAL_CFLAGS += -O2 diff --git a/config.def.h b/config.def.h index 41d9e7286d..22696754ea 100644 --- a/config.def.h +++ b/config.def.h @@ -96,6 +96,7 @@ enum LOCATION_ANDROID, LOCATION_APPLE, + LOCATION_NULL, OSK_PS3, OSK_NULL, @@ -230,6 +231,8 @@ enum #define LOCATION_DEFAULT_DRIVER LOCATION_ANDROID #elif defined(IOS) || defined(OSX) #define LOCATION_DEFAULT_DRIVER LOCATION_APPLE +#else +#define LOCATION_DEFAULT_DRIVER LOCATION_NULL #endif #if defined(__CELLOS_LV2__) diff --git a/driver.c b/driver.c index 6fbf012040..ce05a7e4cf 100644 --- a/driver.c +++ b/driver.c @@ -401,7 +401,6 @@ void uninit_camera(void) } #endif -#ifdef HAVE_LOCATION static const location_driver_t *location_drivers[] = { #ifdef ANDROID &location_android, @@ -409,6 +408,7 @@ static const location_driver_t *location_drivers[] = { #if defined(IOS) || defined(OSX) &location_apple, #endif + &location_null, NULL, }; @@ -527,7 +527,6 @@ void uninit_location(void) } driver.location_data = NULL; } -#endif #ifdef HAVE_MENU static const menu_ctx_driver_t *menu_ctx_drivers[] = { @@ -777,9 +776,7 @@ void init_drivers_pre(void) #ifdef HAVE_CAMERA find_camera_driver(); #endif -#ifdef HAVE_LOCATION find_location_driver(); -#endif #ifdef HAVE_OSK find_osk_driver(); #endif @@ -941,9 +938,7 @@ void init_drivers(void) #ifdef HAVE_CAMERA driver.camera_data_own = false; #endif -#ifdef HAVE_LOCATION driver.location_data_own = false; -#endif #ifdef HAVE_OSK driver.osk_data_own = false; #endif @@ -970,11 +965,9 @@ void init_drivers(void) init_camera(); #endif -#ifdef HAVE_LOCATION // Only initialize location driver if we're ever going to use it. if (g_extern.location_active) init_location(); -#endif #ifdef HAVE_OSK init_osk(); @@ -1073,13 +1066,11 @@ void uninit_drivers(void) } #endif -#ifdef HAVE_LOCATION if (!driver.location_data_own) { uninit_location(); driver.location_data = NULL; } -#endif #ifdef HAVE_OSK if (!driver.osk_data_own) diff --git a/driver.h b/driver.h index 8d473ee8fa..cd2f312dac 100644 --- a/driver.h +++ b/driver.h @@ -423,10 +423,8 @@ typedef struct driver const camera_driver_t *camera; void *camera_data; #endif -#ifdef HAVE_LOCATION const location_driver_t *location; void *location_data; -#endif void *audio_data; void *video_data; void *input_data; @@ -457,9 +455,7 @@ typedef struct driver #ifdef HAVE_CAMERA bool camera_data_own; #endif -#ifdef HAVE_LOCATION bool location_data_own; -#endif #ifdef HAVE_OSK bool osk_data_own; #endif @@ -531,12 +527,10 @@ void find_prev_camera_driver(void); void find_next_camera_driver(void); #endif -#ifdef HAVE_LOCATION void init_location(void); void uninit_location(void); void find_prev_location_driver(void); void find_next_location_driver(void); -#endif void driver_set_monitor_refresh_rate(float hz); bool driver_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points); @@ -571,12 +565,10 @@ void driver_camera_poll(void); #endif // Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE -#ifdef HAVE_LOCATION bool driver_location_start(void); void driver_location_stop(void); bool driver_location_get_position(double *lat, double *lon, double *horiz_accuracy, double *vert_accuracy); void driver_location_set_interval(unsigned interval_msecs, unsigned interval_distance); -#endif #ifdef HAVE_MENU const void *menu_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize. @@ -646,6 +638,7 @@ extern const camera_driver_t camera_rwebcam; extern const camera_driver_t camera_ios; extern const location_driver_t location_apple; extern const location_driver_t location_android; +extern const location_driver_t location_null; extern const input_osk_driver_t input_ps3_osk; extern const menu_ctx_driver_t menu_ctx_rmenu; diff --git a/dynamic.c b/dynamic.c index 3145c95ac3..675c204487 100644 --- a/dynamic.c +++ b/dynamic.c @@ -382,9 +382,7 @@ void uninit_libretro_sym(void) #ifdef HAVE_CAMERA g_extern.camera_active = false; #endif -#ifdef HAVE_LOCATION g_extern.location_active = false; -#endif // Performance counters no longer valid. retro_perf_clear(); @@ -834,7 +832,6 @@ bool rarch_environment_cb(unsigned cmd, void *data) break; } #endif -#ifdef HAVE_LOCATION case RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE: { RARCH_LOG("Environ GET_LOCATION_INTERFACE.\n"); @@ -847,7 +844,6 @@ bool rarch_environment_cb(unsigned cmd, void *data) g_extern.location_active = true; break; } -#endif case RETRO_ENVIRONMENT_GET_LOG_INTERFACE: { diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index e5e6a293e9..cd055cbfc1 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -315,9 +315,7 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) #ifdef HAVE_CAMERA file_list_push(menu->selection_buf, "", "camera_allow", MENU_SETTINGS_PRIVACY_CAMERA_ALLOW, 0); #endif -#ifdef HAVE_LOCATION file_list_push(menu->selection_buf, "", "location_allow", MENU_SETTINGS_PRIVACY_LOCATION_ALLOW, 0); -#endif break; case MENU_SETTINGS_DISK_OPTIONS: file_list_clear(menu->selection_buf); @@ -413,9 +411,7 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) #ifdef HAVE_CAMERA file_list_push(menu->selection_buf, "Camera Driver", "", MENU_SETTINGS_DRIVER_CAMERA, 0); #endif -#ifdef HAVE_LOCATION file_list_push(menu->selection_buf, "Location Driver", "", MENU_SETTINGS_DRIVER_LOCATION, 0); -#endif #ifdef HAVE_MENU file_list_push(menu->selection_buf, "Menu Driver", "", MENU_SETTINGS_DRIVER_MENU, 0); #endif @@ -3803,14 +3799,12 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t find_next_camera_driver(); break; #endif -#ifdef HAVE_LOCATION case MENU_SETTINGS_DRIVER_LOCATION: if (action == MENU_ACTION_LEFT) find_prev_location_driver(); else if (action == MENU_ACTION_RIGHT) find_next_location_driver(); break; -#endif #ifdef HAVE_MENU case MENU_SETTINGS_DRIVER_MENU: if (action == MENU_ACTION_LEFT) @@ -4257,11 +4251,9 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size, strlcpy(type_str, g_settings.camera.driver, type_str_size); break; #endif -#ifdef HAVE_LOCATION case MENU_SETTINGS_DRIVER_LOCATION: strlcpy(type_str, g_settings.location.driver, type_str_size); break; -#endif #ifdef HAVE_MENU case MENU_SETTINGS_DRIVER_MENU: strlcpy(type_str, g_settings.menu.driver, type_str_size); @@ -4676,11 +4668,9 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size, snprintf(type_str, type_str_size, g_settings.camera.allow ? "ON" : "OFF"); break; #endif -#ifdef HAVE_LOCATION case MENU_SETTINGS_PRIVACY_LOCATION_ALLOW: snprintf(type_str, type_str_size, g_settings.location.allow ? "ON" : "OFF"); break; -#endif #ifdef HAVE_OSK case MENU_SETTINGS_ONSCREEN_KEYBOARD_ENABLE: snprintf(type_str, type_str_size, g_settings.osk.enable ? "ON" : "OFF"); diff --git a/general.h b/general.h index e7e3c84333..cb4eb19f09 100644 --- a/general.h +++ b/general.h @@ -257,7 +257,6 @@ struct settings } camera; #endif -#ifdef HAVE_LOCATION struct { char driver[32]; @@ -265,7 +264,6 @@ struct settings int update_interval_ms; int update_interval_distance; } location; -#endif #ifdef HAVE_OSK struct @@ -406,9 +404,7 @@ struct global #ifdef HAVE_CAMERA bool camera_active; #endif -#ifdef HAVE_LOCATION bool location_active; -#endif #ifdef HAVE_OSK bool osk_active; #endif @@ -757,9 +753,7 @@ void config_set_defaults(void); #ifdef HAVE_CAMERA const char *config_get_default_camera(void); #endif -#ifdef HAVE_LOCATION const char *config_get_default_location(void); -#endif #ifdef HAVE_OSK const char *config_get_default_osk(void); #endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 14b57c17a3..9d4372f082 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -383,13 +383,11 @@ CAMERA /*============================================================ LOCATION ============================================================ */ -#ifdef HAVE_LOCATION - #if defined(ANDROID) #include "../location/android.c" #endif -#endif +#include "../location/null.c" /*============================================================ RSOUND diff --git a/location/null.c b/location/null.c new file mode 100644 index 0000000000..700a431eaa --- /dev/null +++ b/location/null.c @@ -0,0 +1,62 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2014 - 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 "../driver.h" + +typedef struct null_location +{ +} nulllocation_t; + +static void *null_location_init(void) +{ + return NULL; +} + +static void null_location_free(void *data) +{ + (void)data; +} + +static bool null_location_start(void *data) +{ + (void)data; + return true; +} + +static void null_location_stop(void *data) +{ + (void)data; +} + +static bool null_location_get_position(void *data, double *latitude, double *longitude, double *horiz_accuracy, + double *vert_accuracy) +{ + return true; +} + +static void null_location_set_interval(void *data, unsigned interval_ms, unsigned interval_distance) +{ +} + +const location_driver_t location_null = { + null_location_init, + null_location_free, + null_location_start, + null_location_stop, + null_location_get_position, + null_location_set_interval, + "null", +}; diff --git a/msvc/msvc-2010/RetroArch-msvc2010.vcxproj b/msvc/msvc-2010/RetroArch-msvc2010.vcxproj index 6c86dd76ed..cb83953e32 100644 --- a/msvc/msvc-2010/RetroArch-msvc2010.vcxproj +++ b/msvc/msvc-2010/RetroArch-msvc2010.vcxproj @@ -319,6 +319,8 @@ + + diff --git a/msvc/msvc-2010/RetroArch-msvc2010.vcxproj.filters b/msvc/msvc-2010/RetroArch-msvc2010.vcxproj.filters index ae69a5c69c..2814735747 100644 --- a/msvc/msvc-2010/RetroArch-msvc2010.vcxproj.filters +++ b/msvc/msvc-2010/RetroArch-msvc2010.vcxproj.filters @@ -22,6 +22,7 @@ + @@ -321,4 +322,4 @@ {4a5338d9-92ad-4d07-bb1a-97bd6eb475e4} - \ No newline at end of file + diff --git a/settings.c b/settings.c index 62a21e9b59..f171fedb4c 100644 --- a/settings.c +++ b/settings.c @@ -212,19 +212,18 @@ const char *config_get_default_camera(void) return "video4linux2"; case CAMERA_RWEBCAM: return "rwebcam"; - case CAMERA_NULL: - return "null"; case CAMERA_ANDROID: return "android"; case CAMERA_IOS: return "ios"; + case CAMERA_NULL: + return "null"; default: return NULL; } } #endif -#ifdef HAVE_LOCATION const char *config_get_default_location(void) { switch (LOCATION_DEFAULT_DRIVER) @@ -233,11 +232,12 @@ const char *config_get_default_location(void) return "android"; case LOCATION_APPLE: return "apple"; + case LOCATION_NULL: + return "null"; default: return NULL; } } -#endif void config_set_defaults(void) { @@ -256,12 +256,10 @@ void config_set_defaults(void) strlcpy(g_settings.camera.driver, def_camera, sizeof(g_settings.camera.driver)); #endif -#ifdef HAVE_LOCATION const char *def_location = config_get_default_location(); if (def_location) strlcpy(g_settings.location.driver, def_location, sizeof(g_settings.location.driver)); -#endif #ifdef HAVE_OSK const char *def_osk = config_get_default_osk(); @@ -374,9 +372,7 @@ void config_set_defaults(void) g_settings.menu_show_start_screen = menu_show_start_screen; #endif -#ifdef HAVE_LOCATION g_settings.location.allow = false; -#endif #ifdef HAVE_CAMERA g_settings.camera.allow = false; @@ -984,10 +980,7 @@ bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_BOOL(camera.allow, "camera_allow"); #endif -#ifdef HAVE_LOCATION CONFIG_GET_BOOL(location.allow, "location_allow"); -#endif - CONFIG_GET_STRING(video.driver, "video_driver"); CONFIG_GET_STRING(menu.driver, "menu_driver"); CONFIG_GET_STRING(video.gl_context, "video_gl_context"); @@ -1406,9 +1399,7 @@ bool config_save_file(const char *path) config_set_bool(conf, "audio_enable", g_settings.audio.enable); config_set_int(conf, "audio_out_rate", g_settings.audio.out_rate); -#ifdef HAVE_LOCATION config_set_bool(conf, "location_allow", g_settings.location.allow); -#endif config_set_float(conf, "video_font_size", g_settings.video.font_size); config_set_bool(conf, "video_font_enable", g_settings.video.font_enable); diff --git a/settings_data.c b/settings_data.c index 20e6a8fe4d..a08322e8dd 100644 --- a/settings_data.c +++ b/settings_data.c @@ -1001,10 +1001,8 @@ static void general_read_handler(const void *data) else if (!strcmp(setting->name, "camera_allow")) *setting->value.boolean = g_settings.camera.allow; #endif -#ifdef HAVE_LOCATION else if (!strcmp(setting->name, "location_allow")) *setting->value.boolean = g_settings.location.allow; -#endif else if (!strcmp(setting->name, "video_shared_context")) *setting->value.boolean = g_settings.video.shared_context; #ifdef HAVE_NETPLAY @@ -1334,10 +1332,8 @@ static void general_write_handler(const void *data) else if (!strcmp(setting->name, "camera_allow")) g_settings.camera.allow = *setting->value.boolean; #endif -#ifdef HAVE_LOCATION else if (!strcmp(setting->name, "location_allow")) g_settings.location.allow = *setting->value.boolean; -#endif else if (!strcmp(setting->name, "video_shared_context")) g_settings.video.shared_context = *setting->value.boolean; #ifdef HAVE_NETPLAY @@ -1460,9 +1456,7 @@ rarch_setting_t* setting_data_get_list(void) #ifdef HAVE_CAMERA CONFIG_STRING(g_settings.camera.device, "camera_device", "Camera Driver", config_get_default_camera(), GROUP_NAME, SUBGROUP_NAME, NULL, NULL) #endif -#ifdef HAVE_LOCATION CONFIG_STRING(g_settings.location.driver, "location_driver", "Location Driver", config_get_default_location(), GROUP_NAME, SUBGROUP_NAME, NULL, NULL) -#endif CONFIG_STRING(g_settings.input.joypad_driver, "input_joypad_driver", "Joypad Driver", "", GROUP_NAME, SUBGROUP_NAME, NULL, NULL) CONFIG_STRING(g_settings.input.keyboard_layout, "input_keyboard_layout", "Keyboard Layout", "", GROUP_NAME, SUBGROUP_NAME, NULL, NULL) @@ -1764,9 +1758,7 @@ rarch_setting_t* setting_data_get_list(void) #ifdef HAVE_CAMERA CONFIG_BOOL(g_settings.camera.allow, "camera_allow", "Allow Camera", false, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) #endif -#ifdef HAVE_LOCATION CONFIG_BOOL(g_settings.location.allow, "location_allow", "Allow Location", false, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) -#endif END_SUB_GROUP() END_GROUP() }