mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
Remove eleven write-only state fields
Each of these is assigned and never read anywhere in the tree, so the work that feeds them is spent for nothing: content_label_len on the thumbnail path data, sink_discarded on the audio state, runahead_save_state_size, task_count and msg_queue_regular_padding_x on the widgets, pipeline_active on the display draw struct, resolution_hd_enable on the D3D8 and D3D9 states, memory_search_initialized on the cheat manager, window_title_len and video_frame_delay_auto_t::frame_time_avg on the video state, and input_dialog_kb_type on the menu state. Where a write captured a strlcpy() or fill_pathname() result the call stays and only the assignment goes. Two of them were holding up more than themselves. gfx_widgets_update_icon_layout() branched on whether icons are loaded solely to pick a padding value, so that conditional computed nothing and is gone with the field. memory_search_initialized sat beside memory_initialized, which is read, leaving two near-identical names for the next reader to tell apart.
This commit is contained in:
1 parent
d868be9712
commit
137d495ab1
20 files changed
+7
-61
No files matched your search
@@ -1506,7 +1506,6 @@ static void audio_driver_sink_window(audio_driver_state_t *audio_st,
|
||||
|
||||
if (kept)
|
||||
{
|
||||
audio_st->sink_discarded = 0;
|
||||
if (audio_st->sink_settled < 2)
|
||||
audio_st->sink_settled++;
|
||||
/* The windows left out since the last kept one come in with
|
||||
@@ -1540,7 +1539,6 @@ static void audio_driver_sink_window(audio_driver_state_t *audio_st,
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_st->sink_discarded++;
|
||||
/* Before the sums stand, a left-out window restarts them: a slow
|
||||
* start is not to be in them. After, it is just left out. */
|
||||
if (audio_st->sink_settled < 2)
|
||||
@@ -1729,7 +1727,6 @@ static void audio_driver_sink_update(audio_driver_state_t *audio_st,
|
||||
audio_st->sink_window_at = now_usec + AUDIO_SINK_WINDOW_USEC;
|
||||
audio_st->sink_apply_at = now_usec + AUDIO_SINK_BASELINE_USEC;
|
||||
audio_st->sink_settled = 0;
|
||||
audio_st->sink_discarded = 0;
|
||||
memset(&audio_st->sink_kept, 0, sizeof(audio_st->sink_kept));
|
||||
memset(&audio_st->sink_pending, 0, sizeof(audio_st->sink_pending));
|
||||
audio_st->sink_pending_broken = false;
|
||||
|
||||
@@ -786,7 +786,6 @@ typedef struct
|
||||
bool sink_pending_broken; /* a dry spell is in it: shown, never merged into the kept sums */
|
||||
unsigned sink_settled; /* kept windows in a row, up to 2, after which the sums stand */
|
||||
unsigned sink_applied; /* times the bias has been set */
|
||||
unsigned sink_discarded; /* windows left out in a row */
|
||||
/* AUDIO_SINK_WARNED_* said once each, in two words because the two
|
||||
* sides run on different threads: on the threaded pipeline the
|
||||
* estimator runs on the core's thread, from submit, and the flush
|
||||
|
||||
@@ -411,7 +411,6 @@ static void cheat_manager_free(void)
|
||||
cheat_st->num_memory_buffers = 0;
|
||||
cheat_st->total_memory_size = 0;
|
||||
cheat_st->memory_initialized = false;
|
||||
cheat_st->memory_search_initialized = false;
|
||||
}
|
||||
|
||||
static void cheat_manager_new(unsigned size)
|
||||
@@ -1067,8 +1066,6 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
|
||||
cheat_st->memory_search_initialized = true;
|
||||
}
|
||||
|
||||
cheat_st->memory_initialized = true;
|
||||
|
||||
@@ -189,7 +189,6 @@ struct cheat_manager
|
||||
char *working_code;
|
||||
bool big_endian;
|
||||
bool memory_initialized;
|
||||
bool memory_search_initialized;
|
||||
};
|
||||
|
||||
typedef struct cheat_manager cheat_manager_t;
|
||||
|
||||
@@ -226,13 +226,10 @@ static void d3d9_get_video_size(d3d9_video_t *d3d,
|
||||
*width = video_mode.dwDisplayWidth;
|
||||
*height = video_mode.dwDisplayHeight;
|
||||
|
||||
d3d->resolution_hd_enable = false;
|
||||
|
||||
if (video_mode.fIsHiDef)
|
||||
{
|
||||
*width = 1280;
|
||||
*height = 720;
|
||||
d3d->resolution_hd_enable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -89,9 +89,6 @@ typedef struct d3d9_video
|
||||
bool quitting;
|
||||
bool needs_restore;
|
||||
bool overlays_enabled;
|
||||
/* TODO - refactor this away properly. */
|
||||
bool resolution_hd_enable;
|
||||
|
||||
/* Only used for Xbox */
|
||||
bool widescreen_mode;
|
||||
|
||||
|
||||
@@ -150,9 +150,6 @@ typedef struct d3d8_video
|
||||
bool quitting;
|
||||
bool needs_restore;
|
||||
bool overlays_enabled;
|
||||
/* TODO - refactor this away properly. */
|
||||
bool resolution_hd_enable;
|
||||
|
||||
/* Only used for Xbox */
|
||||
bool widescreen_mode;
|
||||
|
||||
@@ -1997,21 +1994,18 @@ static void d3d8_get_video_size(d3d8_video_t *d3d,
|
||||
*width = 640;
|
||||
*height = 480;
|
||||
d3d->widescreen_mode = false;
|
||||
d3d->resolution_hd_enable = true;
|
||||
}
|
||||
else if (video_mode & XC_VIDEO_FLAGS_HDTV_720p)
|
||||
{
|
||||
*width = 1280;
|
||||
*height = 720;
|
||||
d3d->widescreen_mode = true;
|
||||
d3d->resolution_hd_enable = true;
|
||||
}
|
||||
else if (video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
|
||||
{
|
||||
*width = 1920;
|
||||
*height = 1080;
|
||||
d3d->widescreen_mode = true;
|
||||
d3d->resolution_hd_enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,6 @@ struct gfx_display_ctx_draw
|
||||
float y;
|
||||
float rotation;
|
||||
float scale_factor;
|
||||
bool pipeline_active;
|
||||
};
|
||||
|
||||
typedef struct gfx_display_ctx_coord_draw
|
||||
|
||||
+4
-8
@@ -2907,7 +2907,6 @@ void gfx_thumbnail_path_reset(gfx_thumbnail_path_data_t *path_data)
|
||||
path_data->system_len = 0;
|
||||
path_data->system[0] = '\0';
|
||||
path_data->content_path[0] = '\0';
|
||||
path_data->content_label_len = 0;
|
||||
path_data->content_label[0] = '\0';
|
||||
path_data->content_core_name[0] = '\0';
|
||||
path_data->content_db_name[0] = '\0';
|
||||
@@ -3096,7 +3095,6 @@ bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char
|
||||
|
||||
/* 'Reset' path_data content strings */
|
||||
path_data->content_path[0] = '\0';
|
||||
path_data->content_label_len = 0;
|
||||
path_data->content_label[0] = '\0';
|
||||
path_data->content_core_name[0] = '\0';
|
||||
path_data->content_db_name[0] = '\0';
|
||||
@@ -3113,7 +3111,7 @@ bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char
|
||||
return false;
|
||||
|
||||
/* Cache content label */
|
||||
path_data->content_label_len = strlcpy(path_data->content_label,
|
||||
strlcpy(path_data->content_label,
|
||||
label, sizeof(path_data->content_label));
|
||||
|
||||
/* Determine content image name */
|
||||
@@ -3148,7 +3146,6 @@ bool gfx_thumbnail_set_content_image(
|
||||
|
||||
/* 'Reset' path_data content strings */
|
||||
path_data->content_path[0] = '\0';
|
||||
path_data->content_label_len = 0;
|
||||
path_data->content_label[0] = '\0';
|
||||
path_data->content_core_name[0] = '\0';
|
||||
path_data->content_db_name[0] = '\0';
|
||||
@@ -3176,7 +3173,7 @@ bool gfx_thumbnail_set_content_image(
|
||||
strlcpy(path_data->content_img,
|
||||
img_name, sizeof(path_data->content_img));
|
||||
|
||||
path_data->content_label_len = fill_pathname(
|
||||
fill_pathname(
|
||||
path_data->content_label,
|
||||
path_data->content_img, "",
|
||||
sizeof(path_data->content_label));
|
||||
@@ -3226,7 +3223,6 @@ bool gfx_thumbnail_set_content_playlist(
|
||||
|
||||
/* 'Reset' path_data content strings */
|
||||
path_data->content_path[0] = '\0';
|
||||
path_data->content_label_len = 0;
|
||||
path_data->content_label[0] = '\0';
|
||||
path_data->content_core_name[0] = '\0';
|
||||
path_data->content_db_name[0] = '\0';
|
||||
@@ -3273,10 +3269,10 @@ bool gfx_thumbnail_set_content_playlist(
|
||||
|
||||
/* Get content label */
|
||||
if (content_label && *content_label)
|
||||
path_data->content_label_len = strlcpy(path_data->content_label,
|
||||
strlcpy(path_data->content_label,
|
||||
content_label, sizeof(path_data->content_label));
|
||||
else
|
||||
path_data->content_label_len = fill_pathname(path_data->content_label,
|
||||
fill_pathname(path_data->content_label,
|
||||
path_basename(content_path),
|
||||
"", sizeof(path_data->content_label));
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ struct gfx_thumbnail_path_data
|
||||
enum playlist_thumbnail_mode playlist_icon_mode;
|
||||
size_t playlist_index;
|
||||
size_t system_len;
|
||||
size_t content_label_len;
|
||||
char content_label[NAME_MAX_LENGTH];
|
||||
char content_core_name[NAME_MAX_LENGTH];
|
||||
char system[NAME_MAX_LENGTH];
|
||||
|
||||
@@ -62,11 +62,6 @@ static void gfx_widgets_update_icon_layout(dispgfx_widget_t *p_dispwidget)
|
||||
{
|
||||
bool has_icons = !!(p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS);
|
||||
|
||||
if (has_icons)
|
||||
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding / 2;
|
||||
else
|
||||
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding;
|
||||
|
||||
if (has_icons)
|
||||
{
|
||||
p_dispwidget->msg_queue_icon_size_y = p_dispwidget->msg_queue_height;
|
||||
@@ -428,7 +423,6 @@ static void gfx_widgets_msg_queue_push_state(
|
||||
msg_widget->expiration_timer = 0;
|
||||
|
||||
msg_widget->task_ptr = task;
|
||||
msg_widget->task_count = 0;
|
||||
|
||||
msg_widget->task_progress = 0;
|
||||
msg_widget->task_ident = 0;
|
||||
@@ -471,7 +465,6 @@ static void gfx_widgets_msg_queue_push_state(
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_FINISHED;
|
||||
msg_widget->task_progress = task->progress;
|
||||
msg_widget->task_ident = task->ident;
|
||||
msg_widget->task_count = 1;
|
||||
|
||||
if (task->style == TASK_STYLE_POSITIVE)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_POSITIVE;
|
||||
@@ -610,8 +603,6 @@ static void gfx_widgets_msg_queue_push_state(
|
||||
else
|
||||
msg_widget_msg_transition_animation_done(msg_widget);
|
||||
|
||||
msg_widget->task_count++;
|
||||
|
||||
msg_widget->width = new_width;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,8 +190,6 @@ typedef struct disp_widget_msg
|
||||
|
||||
uint16_t flags;
|
||||
int8_t task_progress;
|
||||
/* How many tasks have used this notification? */
|
||||
uint8_t task_count;
|
||||
bool alternative_look;
|
||||
} disp_widget_msg_t;
|
||||
|
||||
@@ -287,7 +285,6 @@ typedef struct dispgfx_widget
|
||||
unsigned msg_queue_icon_offset_y;
|
||||
unsigned msg_queue_scissor_start_x;
|
||||
unsigned msg_queue_default_rect_width;
|
||||
unsigned msg_queue_regular_padding_x;
|
||||
unsigned msg_queue_regular_text_start;
|
||||
unsigned msg_queue_task_text_start_x;
|
||||
unsigned divider_width_1px;
|
||||
|
||||
+1
-3
@@ -6090,7 +6090,6 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
sizeof(video_st->window_title) - __len);
|
||||
}
|
||||
|
||||
video_st->window_title_len = __len;
|
||||
retro_atomic_store_release_int(&video_st->window_title_update, 1);
|
||||
VIDEO_TITLE_UNLOCK(video_st);
|
||||
|
||||
@@ -6102,7 +6101,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
curr_time = fps_time = new_time;
|
||||
|
||||
VIDEO_TITLE_LOCK(video_st);
|
||||
video_st->window_title_len = strlcpy(
|
||||
strlcpy(
|
||||
video_st->window_title,
|
||||
video_st->title_buf,
|
||||
sizeof(video_st->window_title));
|
||||
@@ -7172,7 +7171,6 @@ static void video_frame_delay_auto(video_driver_state_t *video_st, video_frame_d
|
||||
count_pos_avg = 0;
|
||||
}
|
||||
|
||||
vfda->frame_time_avg = frame_time_avg;
|
||||
vfda->frame_time_target = frame_time_target;
|
||||
|
||||
#if FRAME_DELAY_AUTO_DEBUG
|
||||
|
||||
@@ -1174,8 +1174,6 @@ typedef struct
|
||||
uintptr_t display;
|
||||
uintptr_t window;
|
||||
|
||||
size_t window_title_len;
|
||||
|
||||
uint32_t flags;
|
||||
/* Display state only the main thread writes and reads - the
|
||||
* VIDEO_FLAG_WIDGETS_* bits and VIDEO_FLAG_ACTIVE, several of them
|
||||
@@ -1296,7 +1294,6 @@ typedef struct video_frame_delay_auto
|
||||
{
|
||||
float refresh_rate;
|
||||
uint16_t frame_time_target;
|
||||
uint16_t frame_time_avg;
|
||||
uint8_t frame_time_interval;
|
||||
uint8_t delay_decrease;
|
||||
} video_frame_delay_auto_t;
|
||||
|
||||
@@ -6798,7 +6798,6 @@ MUI_NOINLINE static void materialui_render_background(
|
||||
draw.tex_coord = NULL;
|
||||
draw.vertex_count = 4;
|
||||
draw.pipeline_id = 0;
|
||||
draw.pipeline_active = false;
|
||||
draw.backend_data = NULL;
|
||||
draw.color = draw_color;
|
||||
draw.texture = 0;
|
||||
|
||||
+2
-5
@@ -2226,7 +2226,6 @@ static bool gfx_thumbnail_set_icon_playlist(
|
||||
|
||||
/* 'Reset' path_data content strings */
|
||||
path_data->content_path[0] = '\0';
|
||||
path_data->content_label_len = 0;
|
||||
path_data->content_label[0] = '\0';
|
||||
path_data->content_core_name[0] = '\0';
|
||||
path_data->content_db_name[0] = '\0';
|
||||
@@ -2272,10 +2271,10 @@ static bool gfx_thumbnail_set_icon_playlist(
|
||||
|
||||
/* Get content label */
|
||||
if (content_label && *content_label)
|
||||
path_data->content_label_len = strlcpy(path_data->content_label,
|
||||
strlcpy(path_data->content_label,
|
||||
content_label, sizeof(path_data->content_label));
|
||||
else
|
||||
path_data->content_label_len = fill_pathname(
|
||||
fill_pathname(
|
||||
path_data->content_label,
|
||||
path_basename(content_path),
|
||||
"", sizeof(path_data->content_label));
|
||||
@@ -8599,7 +8598,6 @@ XMB_NOINLINE static void xmb_draw_bg(
|
||||
draw.tex_coord = NULL;
|
||||
draw.vertex_count = 4;
|
||||
draw.pipeline_id = 0;
|
||||
draw.pipeline_active = (menu_shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER) ? false : true;
|
||||
|
||||
if (!video_width || !video_height)
|
||||
return;
|
||||
@@ -8705,7 +8703,6 @@ XMB_NOINLINE static void xmb_draw_dark_layer(
|
||||
draw.vertex_count = 4;
|
||||
draw.texture = 0;
|
||||
draw.pipeline_id = 0;
|
||||
draw.pipeline_active = false;
|
||||
|
||||
gfx_display_blend_begin(dispctx, userdata);
|
||||
gfx_display_draw_bg(p_disp, &draw, &coords, userdata, true, MIN(xmb->alpha, alpha));
|
||||
|
||||
@@ -4625,7 +4625,6 @@ static void menu_input_key_event(bool down, unsigned keycode,
|
||||
void menu_input_dialog_end(void)
|
||||
{
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
menu_st->input_dialog_kb_type = 0;
|
||||
menu_st->input_dialog_kb_idx = 0;
|
||||
menu_st->input_dialog_kb_text_type = MENU_INPUT_DIALOG_KB_TYPE_TEXT;
|
||||
menu_st->flags &= ~MENU_ST_FLAG_INP_DLG_KB_DISPLAY;
|
||||
@@ -8582,7 +8581,6 @@ bool menu_input_dialog_start(menu_input_ctx_line_t *line)
|
||||
line->label_setting,
|
||||
sizeof(menu_st->input_dialog_kb_label_setting));
|
||||
|
||||
menu_st->input_dialog_kb_type = line->type;
|
||||
menu_st->input_dialog_kb_idx = line->idx;
|
||||
menu_st->input_dialog_kb_text_type = line->text_type;
|
||||
|
||||
|
||||
@@ -531,7 +531,6 @@ struct menu_state
|
||||
} scroll;
|
||||
|
||||
/* unsigned alignment */
|
||||
unsigned input_dialog_kb_type;
|
||||
unsigned input_dialog_kb_idx;
|
||||
unsigned input_driver_flushing_input;
|
||||
menu_dialog_t dialog_st;
|
||||
|
||||
@@ -1408,7 +1408,6 @@ static bool runahead_savestate_info_init(
|
||||
{
|
||||
retro_ctx_serialize_info_t *info = &runloop_st->runahead_savestate_info;
|
||||
|
||||
runloop_st->runahead_save_state_size = save_state_size;
|
||||
runloop_st->flags |= RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN;
|
||||
|
||||
/* Free any previous buffer so callers can safely re-init. The
|
||||
@@ -1514,7 +1513,6 @@ static void runahead_err(runloop_state_t *runloop_st)
|
||||
runloop_st->flags &= ~RUNLOOP_FLAG_RUNAHEAD_AVAILABLE;
|
||||
runahead_savestate_info_free(runloop_st);
|
||||
runahead_remove_hooks(runloop_st);
|
||||
runloop_st->runahead_save_state_size = 0;
|
||||
runloop_st->flags |= RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN;
|
||||
}
|
||||
|
||||
@@ -2242,7 +2240,6 @@ error:
|
||||
void runahead_clear_variables(void *data)
|
||||
{
|
||||
runloop_state_t *runloop_st = (runloop_state_t*)data;
|
||||
runloop_st->runahead_save_state_size = 0;
|
||||
runloop_st->flags &= ~RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN;
|
||||
video_driver_modify_disp_flags(VIDEO_FLAG_RUNAHEAD_IS_ACTIVE, 0);
|
||||
runloop_st->flags |= RUNLOOP_FLAG_RUNAHEAD_AVAILABLE
|
||||
|
||||
Reference in new issue
Block a user