misc: fix old some style casts and redundancies

This commit is contained in:
Megamouse 2021-04-12 22:23:24 +02:00
parent 14a64e2529
commit fc9b3c13e6
3 changed files with 23 additions and 25 deletions

View file

@ -153,8 +153,8 @@ namespace rsx
auto renderer = get_font(); auto renderer = get_font();
const auto caret_loc = renderer->get_char_offset(text.c_str(), caret_position, clip_text ? w : UINT16_MAX, wrap_text); const auto caret_loc = renderer->get_char_offset(text.c_str(), caret_position, clip_text ? w : UINT16_MAX, wrap_text);
caret.set_pos(u16(caret_loc.first + padding_left + x), u16(caret_loc.second + padding_top + y)); caret.set_pos(static_cast<u16>(caret_loc.first) + padding_left + x, static_cast<u16>(caret_loc.second) + padding_top + y);
caret.set_size(1, u16(renderer->get_size_px() + 2)); caret.set_size(1, static_cast<u16>(renderer->get_size_px() + 2));
caret.fore_color = fore_color; caret.fore_color = fore_color;
caret.back_color = fore_color; caret.back_color = fore_color;
caret.pulse_effect_enabled = true; caret.pulse_effect_enabled = true;
@ -172,7 +172,7 @@ namespace rsx
{ {
// TODO: Scrolling by using scroll offset // TODO: Scrolling by using scroll offset
cmd.config.clip_region = true; cmd.config.clip_region = true;
cmd.config.clip_rect = {f32(x), f32(y), f32(x + w), f32(y + h)}; cmd.config.clip_rect = {static_cast<f32>(x), static_cast<f32>(y), static_cast<f32>(x + w), static_cast<f32>(y + h)};
} }
is_compiled = true; is_compiled = true;

View file

@ -131,11 +131,11 @@ namespace rsx
if (layer >= num_shift_layers_by_charset.size()) if (layer >= num_shift_layers_by_charset.size())
{ {
num_shift_layers_by_charset.push_back(u32(cell_shift_layers)); num_shift_layers_by_charset.push_back(static_cast<u32>(cell_shift_layers));
} }
else else
{ {
num_shift_layers_by_charset[layer] = std::max(num_shift_layers_by_charset[layer], u32(cell_shift_layers)); num_shift_layers_by_charset[layer] = std::max(num_shift_layers_by_charset[layer], static_cast<u32>(cell_shift_layers));
} }
} }
@ -206,10 +206,10 @@ namespace rsx
const u16 preview_height = (flags & CELL_OSKDIALOG_NO_RETURN) ? 40 : 90; const u16 preview_height = (flags & CELL_OSKDIALOG_NO_RETURN) ? 40 : 90;
// Place elements with absolute positioning // Place elements with absolute positioning
u16 frame_w = u16(num_columns * cell_size_x); const u16 frame_w = static_cast<u16>(num_columns * cell_size_x);
u16 frame_h = u16(num_rows * cell_size_y) + 30 + preview_height; const u16 frame_h = static_cast<u16>(num_rows * cell_size_y) + 30 + preview_height;
u16 frame_x = (1280 - frame_w) / 2; const u16 frame_x = (1280 - frame_w) / 2;
u16 frame_y = (720 - frame_h) / 2; const u16 frame_y = (720 - frame_h) / 2;
m_frame.set_pos(frame_x, frame_y); m_frame.set_pos(frame_x, frame_y);
m_frame.set_size(frame_w, frame_h); m_frame.set_size(frame_w, frame_h);
@ -358,9 +358,9 @@ namespace rsx
void osk_dialog::update_selection_by_index(u32 index) void osk_dialog::update_selection_by_index(u32 index)
{ {
auto select_cell = [&](u32 index, bool state) auto select_cell = [&](u32 i, bool state)
{ {
const auto info = get_cell_geometry(index); const auto info = get_cell_geometry(i);
// Tag all in range // Tag all in range
for (u32 _index = info.first, _ctr = 0; _ctr < info.second; ++_index, ++_ctr) for (u32 _index = info.first, _ctr = 0; _ctr < info.second; ++_index, ++_ctr)
@ -719,8 +719,8 @@ namespace rsx
for (const auto& c : m_grid) for (const auto& c : m_grid)
{ {
u16 x = u16(c.pos.x); u16 x = static_cast<u16>(c.pos.x);
u16 y = u16(c.pos.y); u16 y = static_cast<u16>(c.pos.y);
u16 w = cell_size_x; u16 w = cell_size_x;
u16 h = cell_size_y; u16 h = cell_size_y;
@ -744,8 +744,8 @@ namespace rsx
if (output_count) if (output_count)
{ {
const u16 offset_x = u16(buffered_cell_count * cell_size_x); const u16 offset_x = static_cast<u16>(buffered_cell_count * cell_size_x);
const u16 full_width = u16(offset_x + cell_size_x); const u16 full_width = static_cast<u16>(offset_x + cell_size_x);
m_label.set_pos(x - offset_x, y); m_label.set_pos(x - offset_x, y);
m_label.set_size(full_width, cell_size_y); m_label.set_size(full_width, cell_size_y);
@ -806,11 +806,11 @@ namespace rsx
flags = prohibit_flags; flags = prohibit_flags;
char_limit = charlimit; char_limit = charlimit;
callback_t shift_cb = std::bind(&osk_dialog::on_shift, this, std::placeholders::_1); const callback_t shift_cb = [this](const std::u32string& text){ on_shift(text); };
callback_t layer_cb = std::bind(&osk_dialog::on_layer, this, std::placeholders::_1); const callback_t layer_cb = [this](const std::u32string& text){ on_layer(text); };
callback_t space_cb = std::bind(&osk_dialog::on_space, this, std::placeholders::_1); const callback_t space_cb = [this](const std::u32string& text){ on_space(text); };
callback_t delete_cb = std::bind(&osk_dialog::on_backspace, this, std::placeholders::_1); const callback_t delete_cb = [this](const std::u32string& text){ on_backspace(text); };
callback_t enter_cb = std::bind(&osk_dialog::on_enter, this, std::placeholders::_1); const callback_t enter_cb = [this](const std::u32string& text){ on_enter(text); };
if (panel_flag & CELL_OSKDIALOG_PANELMODE_PASSWORD) if (panel_flag & CELL_OSKDIALOG_PANELMODE_PASSWORD)
{ {
@ -1035,7 +1035,7 @@ namespace rsx
{ {
g_thread_bit = tbit; g_thread_bit = tbit;
if (auto error = run_input_loop()) if (const auto error = run_input_loop())
{ {
rsx_log.error("Osk input loop exited with error code=%d", error); rsx_log.error("Osk input loop exited with error code=%d", error);
} }

View file

@ -300,10 +300,8 @@ void Emulator::Init(bool add_only)
sys_log.fatal("Failed to fix save data: %s (%s)", pending, fs::g_tls_error); sys_log.fatal("Failed to fix save data: %s (%s)", pending, fs::g_tls_error);
continue; continue;
} }
else
{ sys_log.success("Fixed save data: %s", desired);
sys_log.success("Fixed save data: %s", desired);
}
} }
// Remove pending backup data // Remove pending backup data