diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 2d11ce7026..6925926542 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -424,7 +424,7 @@ static void menu_action_setting_disp_set_label_cheat( } static void menu_action_setting_disp_set_label_perf_counters_common( - const struct retro_perf_counter **counters, + struct retro_perf_counter **counters, unsigned offset, char *s, size_t len ) { @@ -445,7 +445,7 @@ static void menu_action_setting_disp_set_label_perf_counters_common( } static void general_disp_set_label_perf_counters( - const struct retro_perf_counter **counters, + struct retro_perf_counter **counters, unsigned offset, char *s, size_t len, char *s2, size_t len2, @@ -470,8 +470,7 @@ static void menu_action_setting_disp_set_label_perf_counters( const char *path, char *s2, size_t len2) { - const struct retro_perf_counter **counters = - (const struct retro_perf_counter **)perf_counters_rarch; + struct retro_perf_counter **counters = retro_get_perf_counter_rarch(); unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN; general_disp_set_label_perf_counters(counters, offset, s, len, s2, len, path, w); @@ -486,8 +485,7 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters( const char *path, char *s2, size_t len2) { - const struct retro_perf_counter **counters = - (const struct retro_perf_counter **)perf_counters_libretro; + struct retro_perf_counter **counters = retro_get_perf_counter_libretro(); unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN; general_disp_set_label_perf_counters(counters, offset, s, len, s2, len, path, w); diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 191706c0fd..339a8d6e82 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -65,8 +65,7 @@ static int generic_action_start_performance_counters(struct retro_perf_counter * static int action_start_performance_counters_core(unsigned type, const char *label) { - struct retro_perf_counter **counters = (struct retro_perf_counter**) - perf_counters_libretro; + struct retro_perf_counter **counters = retro_get_perf_counter_libretro(); unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN; return generic_action_start_performance_counters(counters, offset, type, label); @@ -75,8 +74,7 @@ static int action_start_performance_counters_core(unsigned type, const char *lab static int action_start_performance_counters_frontend(unsigned type, const char *label) { - struct retro_perf_counter **counters = (struct retro_perf_counter**) - perf_counters_rarch; + struct retro_perf_counter **counters = retro_get_perf_counter_rarch(); unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN; return generic_action_start_performance_counters(counters, offset, type, label); } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e7f52c8921..5198a6684c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -232,7 +232,7 @@ static void menu_list_refresh(file_list_t *list) static void menu_displaylist_push_perfcounter( menu_displaylist_info_t *info, - const struct retro_perf_counter **counters, + struct retro_perf_counter **counters, unsigned num, unsigned id) { unsigned i; @@ -2674,9 +2674,9 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) case DISPLAYLIST_PERFCOUNTERS_FRONTEND: menu_displaylist_push_perfcounter(info, (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? - perf_counters_libretro : perf_counters_rarch, + retro_get_perf_counter_libretro() : retro_get_perf_counter_rarch(), (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? - perf_ptr_libretro : perf_ptr_rarch , + retro_get_perf_count_libretro() : retro_get_perf_count_rarch(), (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN : MENU_SETTINGS_PERF_COUNTERS_BEGIN); diff --git a/performance.c b/performance.c index a7d6614bc6..e35264c3e0 100644 --- a/performance.c +++ b/performance.c @@ -108,10 +108,30 @@ static int clock_gettime(int clk_ik, struct timespec *t) #include "frontend/drivers/platform_linux.h" #endif -const struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS]; -const struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS]; -unsigned perf_ptr_rarch; -unsigned perf_ptr_libretro; +static struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS]; +static struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS]; +static unsigned perf_ptr_rarch; +static unsigned perf_ptr_libretro; + +struct retro_perf_counter **retro_get_perf_counter_rarch(void) +{ + return perf_counters_rarch; +} + +struct retro_perf_counter **retro_get_perf_counter_libretro(void) +{ + return perf_counters_libretro; +} + +unsigned retro_get_perf_count_rarch(void) +{ + return perf_ptr_rarch; +} + +unsigned retro_get_perf_count_libretro(void) +{ + return perf_ptr_libretro; +} void rarch_perf_register(struct retro_perf_counter *perf) { @@ -140,8 +160,7 @@ void retro_perf_clear(void) memset(perf_counters_libretro, 0, sizeof(perf_counters_libretro)); } -static void log_counters( - const struct retro_perf_counter **counters, unsigned num) +static void log_counters(struct retro_perf_counter **counters, unsigned num) { unsigned i; for (i = 0; i < num; i++) diff --git a/performance.h b/performance.h index 7e764156d7..cb824944af 100644 --- a/performance.h +++ b/performance.h @@ -31,12 +31,15 @@ extern "C" { #define MAX_COUNTERS 64 #endif -extern const struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS]; -extern const struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS]; -extern unsigned perf_ptr_rarch; -extern unsigned perf_ptr_libretro; +struct retro_perf_counter **retro_get_perf_counter_rarch(void); -/** +struct retro_perf_counter **retro_get_perf_counter_libretro(void); + +unsigned retro_get_perf_count_rarch(void); + +unsigned retro_get_perf_count_libretro(void); + +/* * retro_get_perf_counter: * * Gets performance counter.