Merge pull request #4481 from lioncash/cpp-dep

yuzu: Resolve C++20 deprecation warnings related to lambda captures
This commit is contained in:
David 2020-08-04 14:06:07 +10:00 committed by GitHub
commit 723314b682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 88 additions and 81 deletions

View file

@ -71,7 +71,7 @@ public:
stream = audio_core.OpenStream(system.CoreTiming(), audio_params.sample_rate, stream = audio_core.OpenStream(system.CoreTiming(), audio_params.sample_rate,
audio_params.channel_count, std::move(unique_name), audio_params.channel_count, std::move(unique_name),
[=]() { buffer_event.writable->Signal(); }); [this] { buffer_event.writable->Signal(); });
} }
private: private:

View file

@ -60,24 +60,24 @@ void NVDRV::IoctlBase(Kernel::HLERequestContext& ctx, IoctlVersion version) {
if (ctrl.must_delay) { if (ctrl.must_delay) {
ctrl.fresh_call = false; ctrl.fresh_call = false;
ctx.SleepClientThread("NVServices::DelayedResponse", ctrl.timeout, ctx.SleepClientThread(
[=](std::shared_ptr<Kernel::Thread> thread, "NVServices::DelayedResponse", ctrl.timeout,
Kernel::HLERequestContext& ctx, [=, this](std::shared_ptr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx_,
Kernel::ThreadWakeupReason reason) { Kernel::ThreadWakeupReason reason) {
IoctlCtrl ctrl2{ctrl}; IoctlCtrl ctrl2{ctrl};
std::vector<u8> tmp_output = output; std::vector<u8> tmp_output = output;
std::vector<u8> tmp_output2 = output2; std::vector<u8> tmp_output2 = output2;
u32 result = nvdrv->Ioctl(fd, command, input, input2, tmp_output, const u32 ioctl_result = nvdrv->Ioctl(fd, command, input, input2, tmp_output,
tmp_output2, ctrl2, version); tmp_output2, ctrl2, version);
ctx.WriteBuffer(tmp_output, 0); ctx_.WriteBuffer(tmp_output, 0);
if (version == IoctlVersion::Version3) { if (version == IoctlVersion::Version3) {
ctx.WriteBuffer(tmp_output2, 1); ctx_.WriteBuffer(tmp_output2, 1);
} }
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx_, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(result); rb.Push(ioctl_result);
}, },
nvdrv->GetEventWriteable(ctrl.event_id)); nvdrv->GetEventWriteable(ctrl.event_id));
} else { } else {
ctx.WriteBuffer(output); ctx.WriteBuffer(output);
if (version == IoctlVersion::Version3) { if (version == IoctlVersion::Version3) {

View file

@ -548,8 +548,8 @@ private:
// Wait the current thread until a buffer becomes available // Wait the current thread until a buffer becomes available
ctx.SleepClientThread( ctx.SleepClientThread(
"IHOSBinderDriver::DequeueBuffer", UINT64_MAX, "IHOSBinderDriver::DequeueBuffer", UINT64_MAX,
[=](std::shared_ptr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx, [=, this](std::shared_ptr<Kernel::Thread> thread,
Kernel::ThreadWakeupReason reason) { Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) {
// Repeat TransactParcel DequeueBuffer when a buffer is available // Repeat TransactParcel DequeueBuffer when a buffer is available
const auto guard = nv_flinger->Lock(); const auto guard = nv_flinger->Lock();
auto& buffer_queue = nv_flinger->FindBufferQueue(id); auto& buffer_queue = nv_flinger->FindBufferQueue(id);

View file

@ -81,7 +81,7 @@ void GPU::WaitFence(u32 syncpoint_id, u32 value) {
} }
MICROPROFILE_SCOPE(GPU_wait); MICROPROFILE_SCOPE(GPU_wait);
std::unique_lock lock{sync_mutex}; std::unique_lock lock{sync_mutex};
sync_cv.wait(lock, [=]() { return syncpoints[syncpoint_id].load() >= value; }); sync_cv.wait(lock, [=, this] { return syncpoints[syncpoint_id].load() >= value; });
} }
void GPU::IncrementSyncPoint(const u32 syncpoint_id) { void GPU::IncrementSyncPoint(const u32 syncpoint_id) {

View file

@ -567,7 +567,7 @@ void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_p
screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32); screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32);
renderer.RequestScreenshot( renderer.RequestScreenshot(
screenshot_image.bits(), screenshot_image.bits(),
[=] { [=, this] {
const std::string std_screenshot_path = screenshot_path.toStdString(); const std::string std_screenshot_path = screenshot_path.toStdString();
if (screenshot_image.mirrored(false, true).save(screenshot_path)) { if (screenshot_image.mirrored(false, true).save(screenshot_path)) {
LOG_INFO(Frontend, "Screenshot saved to \"{}\"", std_screenshot_path); LOG_INFO(Frontend, "Screenshot saved to \"{}\"", std_screenshot_path);

View file

@ -280,9 +280,9 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
} }
button->setContextMenuPolicy(Qt::CustomContextMenu); button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(button, &QPushButton::clicked, [=] { connect(button, &QPushButton::clicked, [=, this] {
HandleClick(button_map[button_id], HandleClick(button_map[button_id],
[=](Common::ParamPackage params) { [=, this](Common::ParamPackage params) {
// Workaround for ZL & ZR for analog triggers like on XBOX controllors. // Workaround for ZL & ZR for analog triggers like on XBOX controllors.
// Analog triggers (from controllers like the XBOX controller) would not // Analog triggers (from controllers like the XBOX controller) would not
// work due to a different range of their signals (from 0 to 255 on // work due to a different range of their signals (from 0 to 255 on
@ -300,19 +300,20 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
}, },
InputCommon::Polling::DeviceType::Button); InputCommon::Polling::DeviceType::Button);
}); });
connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { connect(button, &QPushButton::customContextMenuRequested,
QMenu context_menu; [=, this](const QPoint& menu_location) {
context_menu.addAction(tr("Clear"), [&] { QMenu context_menu;
buttons_param[button_id].Clear(); context_menu.addAction(tr("Clear"), [&] {
button_map[button_id]->setText(tr("[not set]")); buttons_param[button_id].Clear();
}); button_map[button_id]->setText(tr("[not set]"));
context_menu.addAction(tr("Restore Default"), [&] { });
buttons_param[button_id] = Common::ParamPackage{ context_menu.addAction(tr("Restore Default"), [&] {
InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])}; buttons_param[button_id] = Common::ParamPackage{
button_map[button_id]->setText(ButtonToText(buttons_param[button_id])); InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])};
}); button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location)); });
}); context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
});
} }
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) { for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
@ -323,16 +324,16 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
} }
analog_button->setContextMenuPolicy(Qt::CustomContextMenu); analog_button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(analog_button, &QPushButton::clicked, [=]() { connect(analog_button, &QPushButton::clicked, [=, this] {
HandleClick(analog_map_buttons[analog_id][sub_button_id], HandleClick(analog_map_buttons[analog_id][sub_button_id],
[=](const Common::ParamPackage& params) { [=, this](const Common::ParamPackage& params) {
SetAnalogButton(params, analogs_param[analog_id], SetAnalogButton(params, analogs_param[analog_id],
analog_sub_buttons[sub_button_id]); analog_sub_buttons[sub_button_id]);
}, },
InputCommon::Polling::DeviceType::Button); InputCommon::Polling::DeviceType::Button);
}); });
connect(analog_button, &QPushButton::customContextMenuRequested, connect(analog_button, &QPushButton::customContextMenuRequested,
[=](const QPoint& menu_location) { [=, this](const QPoint& menu_location) {
QMenu context_menu; QMenu context_menu;
context_menu.addAction(tr("Clear"), [&] { context_menu.addAction(tr("Clear"), [&] {
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]); analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]);
@ -350,32 +351,35 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
menu_location)); menu_location));
}); });
} }
connect(analog_map_stick[analog_id], &QPushButton::clicked, [=] { connect(analog_map_stick[analog_id], &QPushButton::clicked, [=, this] {
if (QMessageBox::information( if (QMessageBox::information(
this, tr("Information"), this, tr("Information"),
tr("After pressing OK, first move your joystick horizontally, " tr("After pressing OK, first move your joystick horizontally, "
"and then vertically."), "and then vertically."),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
HandleClick( HandleClick(analog_map_stick[analog_id],
analog_map_stick[analog_id], [=, this](const Common::ParamPackage& params) {
[=](const Common::ParamPackage& params) { analogs_param[analog_id] = params; }, analogs_param[analog_id] = params;
InputCommon::Polling::DeviceType::Analog); },
InputCommon::Polling::DeviceType::Analog);
} }
}); });
connect(analog_map_deadzone_and_modifier_slider[analog_id], &QSlider::valueChanged, [=] { connect(analog_map_deadzone_and_modifier_slider[analog_id], &QSlider::valueChanged,
const float slider_value = analog_map_deadzone_and_modifier_slider[analog_id]->value(); [=, this] {
if (analogs_param[analog_id].Get("engine", "") == "sdl" || const float slider_value =
analogs_param[analog_id].Get("engine", "") == "gcpad") { analog_map_deadzone_and_modifier_slider[analog_id]->value();
analog_map_deadzone_and_modifier_slider_label[analog_id]->setText( if (analogs_param[analog_id].Get("engine", "") == "sdl" ||
tr("Deadzone: %1%").arg(slider_value)); analogs_param[analog_id].Get("engine", "") == "gcpad") {
analogs_param[analog_id].Set("deadzone", slider_value / 100.0f); analog_map_deadzone_and_modifier_slider_label[analog_id]->setText(
} else { tr("Deadzone: %1%").arg(slider_value));
analog_map_deadzone_and_modifier_slider_label[analog_id]->setText( analogs_param[analog_id].Set("deadzone", slider_value / 100.0f);
tr("Modifier Scale: %1%").arg(slider_value)); } else {
analogs_param[analog_id].Set("modifier_scale", slider_value / 100.0f); analog_map_deadzone_and_modifier_slider_label[analog_id]->setText(
} tr("Modifier Scale: %1%").arg(slider_value));
}); analogs_param[analog_id].Set("modifier_scale", slider_value / 100.0f);
}
});
} }
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); }); connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });

View file

@ -83,25 +83,28 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
} }
button->setContextMenuPolicy(Qt::CustomContextMenu); button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(button, &QPushButton::clicked, [=] { connect(button, &QPushButton::clicked, [=, this] {
HandleClick( HandleClick(button_map[button_id],
button_map[button_id], [=, this](const Common::ParamPackage& params) {
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; }, buttons_param[button_id] = params;
InputCommon::Polling::DeviceType::Button); },
}); InputCommon::Polling::DeviceType::Button);
connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) {
QMenu context_menu;
context_menu.addAction(tr("Clear"), [&] {
buttons_param[button_id].Clear();
button_map[button_id]->setText(tr("[not set]"));
});
context_menu.addAction(tr("Restore Default"), [&] {
buttons_param[button_id] = Common::ParamPackage{
InputCommon::GenerateKeyboardParam(Config::default_mouse_buttons[button_id])};
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
});
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
}); });
connect(button, &QPushButton::customContextMenuRequested,
[=, this](const QPoint& menu_location) {
QMenu context_menu;
context_menu.addAction(tr("Clear"), [&] {
buttons_param[button_id].Clear();
button_map[button_id]->setText(tr("[not set]"));
});
context_menu.addAction(tr("Restore Default"), [&] {
buttons_param[button_id] =
Common::ParamPackage{InputCommon::GenerateKeyboardParam(
Config::default_mouse_buttons[button_id])};
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
});
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
});
} }
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); }); connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });

View file

@ -54,9 +54,9 @@ ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::Configur
// Update text ComboBoxes after user interaction. // Update text ComboBoxes after user interaction.
connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::activated), connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::activated),
[=]() { ConfigureUi::UpdateSecondRowComboBox(); }); [this] { ConfigureUi::UpdateSecondRowComboBox(); });
connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::activated), connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::activated),
[=]() { ConfigureUi::UpdateFirstRowComboBox(); }); [this] { ConfigureUi::UpdateFirstRowComboBox(); });
// Set screenshot path to user specification. // Set screenshot path to user specification.
connect(ui->screenshot_path_button, &QToolButton::pressed, this, [this] { connect(ui->screenshot_path_button, &QToolButton::pressed, this, [this] {

View file

@ -583,7 +583,7 @@ void GMainWindow::InitializeWidgets() {
renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton")); renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton"));
renderer_status_button->setCheckable(true); renderer_status_button->setCheckable(true);
renderer_status_button->setFocusPolicy(Qt::NoFocus); renderer_status_button->setFocusPolicy(Qt::NoFocus);
connect(renderer_status_button, &QPushButton::toggled, [=](bool checked) { connect(renderer_status_button, &QPushButton::toggled, [this](bool checked) {
renderer_status_button->setText(checked ? tr("VULKAN") : tr("OPENGL")); renderer_status_button->setText(checked ? tr("VULKAN") : tr("OPENGL"));
}); });
renderer_status_button->toggle(); renderer_status_button->toggle();
@ -595,7 +595,7 @@ void GMainWindow::InitializeWidgets() {
#else #else
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan); Settings::RendererBackend::Vulkan);
connect(renderer_status_button, &QPushButton::clicked, [=] { connect(renderer_status_button, &QPushButton::clicked, [this] {
if (emulation_running) { if (emulation_running) {
return; return;
} }