mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
Some code de-duplication
This commit is contained in:
parent
dd525d2734
commit
d5de270b8a
@ -380,6 +380,27 @@ static void menu_action_setting_disp_set_label_cheat(
|
|||||||
strlcpy(path_buf, path, path_buf_size);
|
strlcpy(path_buf, path, path_buf_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void menu_action_setting_disp_set_label_perf_counters_common(
|
||||||
|
const struct retro_perf_counter **counters,
|
||||||
|
unsigned offset, char *type_str, size_t type_str_size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!counters[offset])
|
||||||
|
return;
|
||||||
|
if (!counters[offset]->call_cnt)
|
||||||
|
return;
|
||||||
|
|
||||||
|
snprintf(type_str, type_str_size,
|
||||||
|
#ifdef _WIN32
|
||||||
|
"%I64u ticks, %I64u runs.",
|
||||||
|
#else
|
||||||
|
"%llu ticks, %llu runs.",
|
||||||
|
#endif
|
||||||
|
((unsigned long long)counters[offset]->total /
|
||||||
|
(unsigned long long)counters[offset]->call_cnt),
|
||||||
|
(unsigned long long)counters[offset]->call_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
static void menu_action_setting_disp_set_label_perf_counters(
|
static void menu_action_setting_disp_set_label_perf_counters(
|
||||||
file_list_t* list,
|
file_list_t* list,
|
||||||
unsigned *w, unsigned type, unsigned i,
|
unsigned *w, unsigned type, unsigned i,
|
||||||
@ -398,20 +419,8 @@ static void menu_action_setting_disp_set_label_perf_counters(
|
|||||||
*w = 19;
|
*w = 19;
|
||||||
strlcpy(path_buf, path, path_buf_size);
|
strlcpy(path_buf, path, path_buf_size);
|
||||||
|
|
||||||
if (!counters[offset])
|
menu_action_setting_disp_set_label_perf_counters_common(
|
||||||
return;
|
counters, offset, type_str, type_str_size);
|
||||||
if (!counters[offset]->call_cnt)
|
|
||||||
return;
|
|
||||||
|
|
||||||
snprintf(type_str, type_str_size,
|
|
||||||
#ifdef _WIN32
|
|
||||||
"%I64u ticks, %I64u runs.",
|
|
||||||
#else
|
|
||||||
"%llu ticks, %llu runs.",
|
|
||||||
#endif
|
|
||||||
((unsigned long long)counters[offset]->total /
|
|
||||||
(unsigned long long)counters[offset]->call_cnt),
|
|
||||||
(unsigned long long)counters[offset]->call_cnt);
|
|
||||||
|
|
||||||
menu->label.is_updated = true;
|
menu->label.is_updated = true;
|
||||||
}
|
}
|
||||||
@ -434,20 +443,8 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters(
|
|||||||
*w = 19;
|
*w = 19;
|
||||||
strlcpy(path_buf, path, path_buf_size);
|
strlcpy(path_buf, path, path_buf_size);
|
||||||
|
|
||||||
if (!counters[offset])
|
menu_action_setting_disp_set_label_perf_counters_common(
|
||||||
return;
|
counters, offset, type_str, type_str_size);
|
||||||
if (!counters[offset]->call_cnt)
|
|
||||||
return;
|
|
||||||
|
|
||||||
snprintf(type_str, type_str_size,
|
|
||||||
#ifdef _WIN32
|
|
||||||
"%I64u ticks, %I64u runs.",
|
|
||||||
#else
|
|
||||||
"%llu ticks, %llu runs.",
|
|
||||||
#endif
|
|
||||||
((unsigned long long)counters[offset]->total /
|
|
||||||
(unsigned long long)counters[offset]->call_cnt),
|
|
||||||
(unsigned long long)counters[offset]->call_cnt);
|
|
||||||
|
|
||||||
menu->label.is_updated = true;
|
menu->label.is_updated = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user