(runtime_file) Remove settings pointer dependency

This commit is contained in:
jdgleaver 2020-03-27 11:12:32 +00:00
parent 7531223846
commit 05744bb69f
4 changed files with 58 additions and 35 deletions

View File

@ -1077,6 +1077,12 @@ static int action_bind_sublabel_playlist_entry(
unsigned playlist_sublabel_runtime_type = settings->uints.playlist_sublabel_runtime_type; unsigned playlist_sublabel_runtime_type = settings->uints.playlist_sublabel_runtime_type;
bool content_runtime_log = settings->bools.content_runtime_log; bool content_runtime_log = settings->bools.content_runtime_log;
bool content_runtime_log_aggregate = settings->bools.content_runtime_log_aggregate; bool content_runtime_log_aggregate = settings->bools.content_runtime_log_aggregate;
const char *directory_runtime_log = settings->paths.directory_runtime_log;
const char *directory_playlist = settings->paths.directory_playlist;
enum playlist_sublabel_last_played_style_type
playlist_sublabel_last_played_style =
(enum playlist_sublabel_last_played_style_type)
settings->uints.playlist_sublabel_last_played_style;
if (!playlist_show_sublabels) if (!playlist_show_sublabels)
return 0; return 0;
@ -1128,7 +1134,12 @@ static int action_bind_sublabel_playlist_entry(
/* Check whether runtime info should be loaded from log file */ /* Check whether runtime info should be loaded from log file */
if (entry->runtime_status == PLAYLIST_RUNTIME_UNKNOWN) if (entry->runtime_status == PLAYLIST_RUNTIME_UNKNOWN)
runtime_update_playlist(playlist, i); runtime_update_playlist(
playlist, i,
directory_runtime_log,
directory_playlist,
(playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE),
playlist_sublabel_last_played_style);
/* Check whether runtime info is valid */ /* Check whether runtime info is valid */
if (entry->runtime_status == PLAYLIST_RUNTIME_VALID) if (entry->runtime_status == PLAYLIST_RUNTIME_VALID)

View File

@ -1794,6 +1794,14 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata; bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata;
bool content_runtime_log = settings->bools.content_runtime_log; bool content_runtime_log = settings->bools.content_runtime_log;
bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate; bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate;
const char *directory_runtime_log = settings->paths.directory_runtime_log;
const char *directory_playlist = settings->paths.directory_playlist;
unsigned runtime_type = settings->uints.playlist_sublabel_runtime_type;
enum playlist_sublabel_last_played_style_type
runtime_last_played_style =
(enum playlist_sublabel_last_played_style_type)
settings->uints.playlist_sublabel_last_played_style;
/* Must check whether core corresponds to 'viewer' /* Must check whether core corresponds to 'viewer'
* content even when not using a playlist, otherwise * content even when not using a playlist, otherwise
* file browser image updates are mishandled */ * file browser image updates are mishandled */
@ -1837,7 +1845,12 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
playlist_get_index(playlist, selection, &entry); playlist_get_index(playlist, selection, &entry);
if (entry->runtime_status == PLAYLIST_RUNTIME_UNKNOWN) if (entry->runtime_status == PLAYLIST_RUNTIME_UNKNOWN)
runtime_update_playlist(playlist, selection); runtime_update_playlist(
playlist, selection,
directory_runtime_log,
directory_playlist,
(runtime_type == PLAYLIST_RUNTIME_PER_CORE),
runtime_last_played_style);
if (!string_is_empty(entry->runtime_str)) if (!string_is_empty(entry->runtime_str))
strlcpy(ozone->selection_playtime, entry->runtime_str, sizeof(ozone->selection_playtime)); strlcpy(ozone->selection_playtime, entry->runtime_str, sizeof(ozone->selection_playtime));

View File

@ -36,7 +36,6 @@
#include "file_path_special.h" #include "file_path_special.h"
#include "paths.h" #include "paths.h"
#include "core_info.h" #include "core_info.h"
#include "configuration.h"
#include "verbosity.h" #include "verbosity.h"
#include "msg_hash.h" #include "msg_hash.h"
@ -1008,23 +1007,24 @@ void runtime_log_convert_usec2hms(retro_time_t usec,
/* Updates specified playlist entry runtime values with /* Updates specified playlist entry runtime values with
* contents of associated log file */ * contents of associated log file */
void runtime_update_playlist(playlist_t *playlist, size_t idx) void runtime_update_playlist(
playlist_t *playlist, size_t idx,
const char *dir_runtime_log,
const char *dir_playlist,
bool log_per_core,
enum playlist_sublabel_last_played_style_type timedate_style)
{ {
char runtime_str[64]; char runtime_str[64];
char last_played_str[64]; char last_played_str[64];
enum playlist_sublabel_last_played_style_type
timedate_style = PLAYLIST_LAST_PLAYED_STYLE_YMD_HMS;
runtime_log_t *runtime_log = NULL; runtime_log_t *runtime_log = NULL;
const struct playlist_entry *entry = NULL; const struct playlist_entry *entry = NULL;
struct playlist_entry update_entry = {0}; struct playlist_entry update_entry = {0};
settings_t *settings = config_get_ptr(); #if defined(HAVE_MENU) && defined(HAVE_OZONE)
unsigned pl_sublabel_last_played_style = settings ? settings->uints.playlist_sublabel_last_played_style : 0;
#ifdef HAVE_MENU
const char *menu_ident = menu_driver_ident(); const char *menu_ident = menu_driver_ident();
#endif #endif
/* Sanity check */ /* Sanity check */
if (!playlist || !settings) if (!playlist)
return; return;
if (idx >= playlist_get_size(playlist)) if (idx >= playlist_get_size(playlist))
@ -1034,12 +1034,6 @@ void runtime_update_playlist(playlist_t *playlist, size_t idx)
* (saves 'if' checks later...) */ * (saves 'if' checks later...) */
update_entry.runtime_status = PLAYLIST_RUNTIME_MISSING; update_entry.runtime_status = PLAYLIST_RUNTIME_MISSING;
#ifdef HAVE_MENU
/* Get current last played formatting type
* > Have to include a 'HAVE_MENU' check here... */
timedate_style = (enum playlist_sublabel_last_played_style_type)pl_sublabel_last_played_style;
#endif
/* 'Attach' runtime/last played strings */ /* 'Attach' runtime/last played strings */
runtime_str[0] = '\0'; runtime_str[0] = '\0';
last_played_str[0] = '\0'; last_played_str[0] = '\0';
@ -1053,9 +1047,9 @@ void runtime_update_playlist(playlist_t *playlist, size_t idx)
runtime_log = runtime_log_init( runtime_log = runtime_log_init(
entry->path, entry->path,
entry->core_path, entry->core_path,
settings->paths.directory_runtime_log, dir_runtime_log,
settings->paths.directory_playlist, dir_playlist,
(settings->uints.playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE)); log_per_core);
if (runtime_log) if (runtime_log)
{ {

View File

@ -182,7 +182,12 @@ void runtime_log_convert_usec2hms(retro_time_t usec, unsigned *hours, unsigned *
/* Updates specified playlist entry runtime values with /* Updates specified playlist entry runtime values with
* contents of associated log file */ * contents of associated log file */
void runtime_update_playlist(playlist_t *playlist, size_t idx); void runtime_update_playlist(
playlist_t *playlist, size_t idx,
const char *dir_runtime_log,
const char *dir_playlist,
bool log_per_core,
enum playlist_sublabel_last_played_style_type timedate_style);
RETRO_END_DECLS RETRO_END_DECLS