Source: Remove redundant lambda parameter lists

This commit is contained in:
Dr. Dystopia
2025-04-28 22:02:56 +02:00
parent 95f6c76713
commit ca8f9b672b
54 changed files with 108 additions and 111 deletions

View File

@ -504,16 +504,15 @@ void GekkoIRPlugin::AddBinaryEvaluator(u32 (*evaluator)(u32, u32))
m_fixup_stack.pop();
std::function<u32()> lhs = std::move(m_fixup_stack.top());
m_fixup_stack.pop();
m_fixup_stack.emplace([evaluator, lhs = std::move(lhs), rhs = std::move(rhs)]() {
return evaluator(lhs(), rhs());
});
m_fixup_stack.emplace(
[evaluator, lhs = std::move(lhs), rhs = std::move(rhs)] { return evaluator(lhs(), rhs()); });
}
void GekkoIRPlugin::AddUnaryEvaluator(u32 (*evaluator)(u32))
{
std::function<u32()> sub = std::move(m_fixup_stack.top());
m_fixup_stack.pop();
m_fixup_stack.emplace([evaluator, sub = std::move(sub)]() { return evaluator(sub()); });
m_fixup_stack.emplace([evaluator, sub = std::move(sub)] { return evaluator(sub()); });
}
void GekkoIRPlugin::AddAbsoluteAddressConv()
@ -579,7 +578,7 @@ void GekkoIRPlugin::AddNumLabelSymResolve(std::string_view sym, u32 num)
// Searching forward only
size_t search_start_idx = static_cast<size_t>(m_numlabs.size());
m_fixup_stack.emplace(
[this, num, source_address, search_start_idx, err_on_fail = std::move(err_on_fail)]() {
[this, num, source_address, search_start_idx, err_on_fail = std::move(err_on_fail)] {
for (size_t i = search_start_idx; i < m_numlabs.size(); i++)
{
if (num == m_numlabs[i].first)

View File

@ -380,7 +380,7 @@ bool AchievementManager::CanPause()
void AchievementManager::DoIdle()
{
std::thread([this]() {
std::thread([this] {
while (true)
{
Common::SleepCurrentThread(1000);
@ -959,7 +959,7 @@ void AchievementManager::LeaderboardEntriesCallback(int result, const char* erro
rc_client_t* client, void* userdata)
{
u32* leaderboard_id = static_cast<u32*>(userdata);
Common::ScopeGuard on_end_scope([&]() { delete leaderboard_id; });
Common::ScopeGuard on_end_scope([&] { delete leaderboard_id; });
if (result != RC_OK)
{
@ -1372,7 +1372,7 @@ void AchievementManager::FetchBadge(AchievementManager::Badge* badge, u32 badge_
m_image_queue.Push([this, badge, badge_type, function = std::move(function),
callback_data = std::move(callback_data)] {
Common::ScopeGuard on_end_scope([&]() {
Common::ScopeGuard on_end_scope([&] {
if (m_display_welcome_message && badge_type == RC_IMAGE_TYPE_GAME)
DisplayWelcomeMessage();
});

View File

@ -506,14 +506,13 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
Config::Get(Config::MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC);
if (sync_sd_folder)
{
sync_sd_folder =
Common::SyncSDFolderToSDImage([]() { return false; }, Core::WantsDeterminism());
sync_sd_folder = Common::SyncSDFolderToSDImage([] { return false; }, Core::WantsDeterminism());
}
Common::ScopeGuard sd_folder_sync_guard{[sync_sd_folder] {
if (sync_sd_folder && Config::Get(Config::MAIN_ALLOW_SD_WRITES))
{
const bool sync_ok = Common::SyncSDImageToSDFolder([]() { return false; });
const bool sync_ok = Common::SyncSDImageToSDFolder([] { return false; });
if (!sync_ok)
{
PanicAlertFmtT(
@ -829,7 +828,7 @@ void RunOnCPUThread(Core::System& system, Common::MoveOnlyFunction<void()> funct
{
// Trigger the event after executing the function.
s_cpu_thread_job_finished.Reset();
system.GetCPU().AddCPUThreadJob([&function]() {
system.GetCPU().AddCPUThreadJob([&function] {
function();
s_cpu_thread_job_finished.Set();
});

View File

@ -209,7 +209,7 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
if (!file)
return nullptr;
auto panic_failed_to_read = []() {
auto panic_failed_to_read = [] {
CriticalAlertFmtT("Failed to read DFF file.");
return nullptr;
};

View File

@ -296,7 +296,7 @@ void CEXIIPL::TransferByte(u8& data)
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "IPL-DEV data {} {:08x} {:02x}",
m_command.is_write() ? "write" : "read", address, data);
auto UartFifoAccess = [&]() {
auto UartFifoAccess = [&] {
if (m_command.is_write())
{
if (data != '\0')

View File

@ -305,7 +305,7 @@ ErrorCode WriteToVFF(const std::string& path, const std::string& filename,
{
VffFatFsCallbacks callbacks;
ErrorCode return_value;
Common::RunInFatFsContext(callbacks, [&]() {
Common::RunInFatFsContext(callbacks, [&] {
auto temp = fs->OpenFile(PID_KD, PID_KD, path, FS::Mode::ReadWrite);
if (!temp)
{
@ -360,7 +360,7 @@ ErrorCode ReadFromVFF(const std::string& path, const std::string& filename,
{
VffFatFsCallbacks callbacks;
ErrorCode return_value;
Common::RunInFatFsContext(callbacks, [&]() {
Common::RunInFatFsContext(callbacks, [&] {
auto temp = fs->OpenFile(PID_KD, PID_KD, path, FS::Mode::ReadWrite);
if (!temp)
{
@ -411,7 +411,7 @@ ErrorCode DeleteFileFromVFF(const std::string& path, const std::string& filename
{
VffFatFsCallbacks callbacks;
ErrorCode return_value;
Common::RunInFatFsContext(callbacks, [&]() {
Common::RunInFatFsContext(callbacks, [&] {
auto temp = fs->OpenFile(PID_KD, PID_KD, path, FS::Mode::ReadWrite);
if (!temp)
{

View File

@ -335,7 +335,7 @@ std::optional<IPCReply> OH0::DeviceIOCtlV(const u64 device_id, const IOCtlVReque
case USB::IOCTLV_USBV0_INTRMSG:
case USB::IOCTLV_USBV0_ISOMSG:
return HandleTransfer(device, request.request,
[&, this]() { return SubmitTransfer(*device, request); });
[&, this] { return SubmitTransfer(*device, request); });
case USB::IOCTLV_USBV0_UNKNOWN_32:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_USB);
return IPCReply(IPC_SUCCESS);

View File

@ -61,7 +61,7 @@ std::optional<IPCReply> USB_HIDv4::IOCtl(const IOCtlRequest& request)
if (!device->Attach())
return IPCReply(IPC_EINVAL);
return HandleTransfer(device, request.request,
[&, this]() { return SubmitTransfer(*device, request); });
[&, this] { return SubmitTransfer(*device, request); });
}
default:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_USB);

View File

@ -75,7 +75,7 @@ std::optional<IPCReply> USB_HIDv5::IOCtlV(const IOCtlVRequest& request)
else
host_device->AttachAndChangeInterface(device->interface_number);
return HandleTransfer(host_device, request.request,
[&, this]() { return SubmitTransfer(*device, *host_device, request); });
[&, this] { return SubmitTransfer(*device, *host_device, request); });
}
default:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_USB);

View File

@ -85,7 +85,7 @@ std::optional<IPCReply> USB_VEN::IOCtlV(const IOCtlVRequest& request)
else
host_device->AttachAndChangeInterface(device->interface_number);
return HandleTransfer(host_device, request.request,
[&, this]() { return SubmitTransfer(*host_device, request); });
[&, this] { return SubmitTransfer(*host_device, request); });
}
default:
return IPCReply(IPC_EINVAL);

View File

@ -2596,7 +2596,7 @@ void NetPlayClient::ComputeGameDigest(const SyncIdentifier& sync_identifier)
if (m_game_digest_thread.joinable())
m_game_digest_thread.join();
m_game_digest_thread = std::thread([this, file]() {
m_game_digest_thread = std::thread([this, file] {
std::string sum = SHA1Sum(file, [&](int progress) {
sf::Packet packet;
packet << MessageID::GameDigestProgress;

View File

@ -119,7 +119,7 @@ std::size_t CachedInterpreter::Disassemble(const JitBlock& block, std::ostream&
#undef LOOKUP_KV
std::call_once(s_sorted_lookup_flag, []() {
std::call_once(s_sorted_lookup_flag, [] {
const auto end = std::ranges::sort(sorted_lookup, {}, &LookupKV::first);
ASSERT_MSG(DYNA_REC, std::ranges::adjacent_find(sorted_lookup, {}, &LookupKV::first) == end,
"Sorted lookup should not contain duplicate keys.");

View File

@ -765,7 +765,7 @@ static void LoadFileStateData(const std::string& filename, Common::UniqueBuffer<
if (s_state_writes_in_queue != 0)
{
if (!s_state_write_queue_is_empty.wait_for(lk, std::chrono::seconds(3),
[]() { return s_state_writes_in_queue == 0; }))
[] { return s_state_writes_in_queue == 0; }))
{
Core::DisplayMessage(
"A previous state saving operation is still in progress, cancelling load.", 2000);

View File

@ -85,7 +85,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
return false;
}
const bool contents_imported = [&]() {
const bool contents_imported = [&] {
const u64 title_id = tmd.GetTitleId();
for (const IOS::ES::Content& content : tmd.GetContents())
{
@ -584,7 +584,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
// Now download and install contents listed in the TMD.
const std::vector<IOS::ES::Content> stored_contents = es.GetStoredContentsFromTMD(tmd.first);
const UpdateResult import_result = [&]() {
const UpdateResult import_result = [&] {
for (const IOS::ES::Content& content : tmd.first.GetContents())
{
const bool is_already_installed =

View File

@ -518,7 +518,7 @@ bool VolumeWii::HashGroup(const std::array<u8, BLOCK_DATA_SIZE> in[BLOCKS_PER_GR
if (read_function && success)
success = read_function(i);
hash_futures[i] = std::async(std::launch::async, [&in, &out, &hash_futures, success, i]() {
hash_futures[i] = std::async(std::launch::async, [&in, &out, &hash_futures, success, i] {
const size_t h1_base = Common::AlignDown(i, 8);
if (success)

View File

@ -1569,7 +1569,7 @@ WIARVZFileReader<RVZ>::ProcessAndCompress(CompressThreadState* state, CompressPa
continue;
}
const auto pad_exception_lists = [&entry]() {
const auto pad_exception_lists = [&entry] {
while (entry.exception_lists.size() % 4 != 0)
entry.exception_lists.push_back(0);
};

View File

@ -33,7 +33,7 @@ void ConfigInteger::OnConfigChanged()
ConfigIntegerLabel::ConfigIntegerLabel(const QString& text, ConfigInteger* widget)
: QLabel(text), m_widget(QPointer<ConfigInteger>(widget))
{
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() {
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
// Label shares font changes with ConfigInteger to mark game ini settings.
if (m_widget)
setFont(m_widget->font());

View File

@ -113,7 +113,7 @@ void ConfigSliderU32::OnConfigChanged()
ConfigSliderLabel::ConfigSliderLabel(const QString& text, ConfigSlider* slider)
: QLabel(text), m_slider(QPointer<ConfigSlider>(slider))
{
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() {
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
// Label shares font changes with slider to mark game ini settings.
if (m_slider)
setFont(m_slider->font());

View File

@ -88,7 +88,7 @@ GameConfigWidget::GameConfigWidget(const UICommon::GameFile& game) : m_game(game
}
// Fails to change font if it's directly called at this time. Is there a better workaround?
QTimer::singleShot(100, this, [this]() {
QTimer::singleShot(100, this, [this] {
SetItalics();
Config::OnConfigChanged();
});

View File

@ -41,10 +41,10 @@ EnhancementsWidget::EnhancementsWidget(GraphicsWindow* parent)
// BackendChanged is called by parent on window creation.
connect(parent, &GraphicsWindow::BackendChanged, this, &EnhancementsWidget::OnBackendChanged);
connect(parent, &GraphicsWindow::UseFastTextureSamplingChanged, this, [this]() {
connect(parent, &GraphicsWindow::UseFastTextureSamplingChanged, this, [this] {
m_texture_filtering_combo->setEnabled(ReadSetting(Config::GFX_HACK_FAST_TEXTURE_SAMPLING));
});
connect(parent, &GraphicsWindow::UseGPUTextureDecodingChanged, this, [this]() {
connect(parent, &GraphicsWindow::UseGPUTextureDecodingChanged, this, [this] {
m_arbitrary_mipmap_detection->setEnabled(!ReadSetting(Config::GFX_ENABLE_GPU_TEXTURE_DECODING));
});
}

View File

@ -113,7 +113,7 @@ QTextCharFormat GetCommentCharFormat()
ControlExpressionSyntaxHighlighter::ControlExpressionSyntaxHighlighter(QTextDocument* parent)
: QObject(parent)
{
connect(parent, &QTextDocument::contentsChanged, this, [this, parent]() { Highlight(parent); });
connect(parent, &QTextDocument::contentsChanged, this, [this, parent] { Highlight(parent); });
}
void QComboBoxWithMouseWheelDisabled::wheelEvent(QWheelEvent* event)

View File

@ -990,15 +990,15 @@ void CalibrationWidget::SetupActions()
const auto center_action = new QAction(tr("Center and Calibrate"), this);
const auto reset_action = new QAction(tr("Reset"), this);
connect(calibrate_action, &QAction::triggered, [this]() {
connect(calibrate_action, &QAction::triggered, [this] {
StartCalibration();
m_new_center = Common::DVec2{};
});
connect(center_action, &QAction::triggered, [this]() {
connect(center_action, &QAction::triggered, [this] {
StartCalibration();
m_new_center = std::nullopt;
});
connect(reset_action, &QAction::triggered, [this]() {
connect(reset_action, &QAction::triggered, [this] {
m_input.SetCalibrationToDefault();
m_input.SetCenter({0, 0});
});
@ -1012,7 +1012,7 @@ void CalibrationWidget::SetupActions()
setDefaultAction(calibrate_action);
m_completion_action = new QAction(tr("Finish Calibration"), this);
connect(m_completion_action, &QAction::triggered, [this]() {
connect(m_completion_action, &QAction::triggered, [this] {
m_input.SetCenter(GetCenter());
m_input.SetCalibrationData(std::move(m_calibration_data));
m_informative_timer->stop();
@ -1027,7 +1027,7 @@ void CalibrationWidget::StartCalibration()
// Cancel calibration.
const auto cancel_action = new QAction(tr("Cancel Calibration"), this);
connect(cancel_action, &QAction::triggered, [this]() {
connect(cancel_action, &QAction::triggered, [this] {
m_calibration_data.clear();
m_informative_timer->stop();
SetupActions();

View File

@ -343,7 +343,7 @@ void MappingWidget::CreateControl(const ControllerEmu::Control* control, QFormLa
if (m_previous_mapping_button)
{
connect(m_previous_mapping_button, &MappingButton::QueueNextButtonMapping,
[this, button]() { m_parent->QueueInputDetection(button); });
[this, button] { m_parent->QueueInputDetection(button); });
}
m_previous_mapping_button = button;
}
@ -383,7 +383,7 @@ MappingWidget::CreateSettingAdvancedMappingButton(ControllerEmu::NumericSettingB
const auto button = new QPushButton(tr("..."));
button->setFixedWidth(QFontMetrics(font()).boundingRect(button->text()).width() * 2);
button->connect(button, &QPushButton::clicked, [this, &setting]() {
button->connect(button, &QPushButton::clicked, [this, &setting] {
if (setting.IsSimpleValue())
setting.SetExpressionFromValue();

View File

@ -127,7 +127,7 @@ BreakpointWidget::BreakpointWidget(QWidget* parent)
setHidden(!enabled || !Settings::Instance().IsBreakpointsVisible());
});
connect(&Settings::Instance(), &Settings::ThemeChanged, this, [this]() {
connect(&Settings::Instance(), &Settings::ThemeChanged, this, [this] {
UpdateIcons();
Update();
});
@ -525,7 +525,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos)
menu->addAction(tr("Show in Code"), [this, bp_address] { emit ShowCode(bp_address); });
menu->addAction(tr("Edit..."), [this, bp_address] { OnEditBreakpoint(bp_address, true); });
menu->addAction(tr("Delete"), [this, &bp_address]() {
menu->addAction(tr("Delete"), [this, &bp_address] {
m_system.GetPowerPC().GetBreakPoints().Remove(bp_address);
emit Host::GetInstance()->PPCBreakpointsChanged();
});
@ -538,7 +538,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos)
menu->addAction(tr("Show in Memory"), [this, bp_address] { emit ShowMemory(bp_address); });
menu->addAction(tr("Edit..."), [this, bp_address] { OnEditBreakpoint(bp_address, false); });
menu->addAction(tr("Delete"), [this, &bp_address]() {
menu->addAction(tr("Delete"), [this, &bp_address] {
const QSignalBlocker blocker(Settings::Instance());
m_system.GetPowerPC().GetMemChecks().Remove(bp_address);
emit Host::GetInstance()->PPCBreakpointsChanged();

View File

@ -186,11 +186,11 @@ void CodeWidget::ConnectWidgets()
connect(m_search_address, &QLineEdit::textChanged, this, &CodeWidget::OnSearchAddress);
connect(m_search_address, &QLineEdit::returnPressed, this, &CodeWidget::OnSearchAddress);
connect(m_search_symbols, &QLineEdit::textChanged, this, &CodeWidget::OnSearchSymbols);
connect(m_search_calls, &QLineEdit::textChanged, this, [this]() {
connect(m_search_calls, &QLineEdit::textChanged, this, [this] {
if (const Common::Symbol* symbol = m_ppc_symbol_db.GetSymbolFromAddr(m_code_view->GetAddress()))
UpdateFunctionCalls(symbol);
});
connect(m_search_callers, &QLineEdit::textChanged, this, [this]() {
connect(m_search_callers, &QLineEdit::textChanged, this, [this] {
if (const Common::Symbol* symbol = m_ppc_symbol_db.GetSymbolFromAddr(m_code_view->GetAddress()))
UpdateFunctionCallers(symbol);
});

View File

@ -56,7 +56,7 @@ void JitBlockTableModel::PrefetchSymbols()
{
for (const JitBlock& block : m_jit_blocks)
{
m_symbol_list.emplace_back([this, &block]() {
m_symbol_list.emplace_back([this, &block] {
return GetSymbolNameQVariant(m_ppc_symbol_db.GetSymbolFromAddr(block.effectiveAddress));
});
}

View File

@ -176,7 +176,7 @@ void RegisterWidget::ShowContextMenu()
const std::string type_string =
fmt::format("{}{}", type == RegisterType::gpr ? "r" : "f", m_table->currentItem()->row());
menu->addAction(tr("Run until hit (ignoring breakpoints)"),
[this, type_string]() { AutoStep(type_string); });
[this, type_string] { AutoStep(type_string); });
}
for (auto* action : {view_hex, view_int, view_uint, view_float, view_double})

View File

@ -37,7 +37,7 @@ static void RestartCore(const std::weak_ptr<HW::GBA::Core>& core, std::string_vi
{
Core::RunOnCPUThread(
Core::System::GetInstance(),
[core, rom_path = std::string(rom_path)]() {
[core, rom_path = std::string(rom_path)] {
if (auto core_ptr = core.lock())
{
auto& info = Config::MAIN_GBA_ROM_PATHS[core_ptr->GetCoreInfo().device_number];
@ -58,7 +58,7 @@ static void QueueEReaderCard(const std::weak_ptr<HW::GBA::Core>& core, std::stri
{
Core::RunOnCPUThread(
Core::System::GetInstance(),
[core, card_path = std::string(card_path)]() {
[core, card_path = std::string(card_path)] {
if (auto core_ptr = core.lock())
core_ptr->EReaderQueueCard(card_path);
},
@ -161,7 +161,7 @@ void GBAWidget::ToggleDisconnect()
Core::RunOnCPUThread(
Core::System::GetInstance(),
[core = m_core, force_disconnect = m_force_disconnect]() {
[core = m_core, force_disconnect = m_force_disconnect] {
if (auto core_ptr = core.lock())
core_ptr->SetForceDisconnect(force_disconnect);
},
@ -224,7 +224,7 @@ void GBAWidget::DoState(bool export_state)
Core::RunOnCPUThread(
Core::System::GetInstance(),
[export_state, core = m_core, state_path = state_path.toStdString()]() {
[export_state, core = m_core, state_path = state_path.toStdString()] {
if (auto core_ptr = core.lock())
{
if (export_state)
@ -255,7 +255,7 @@ void GBAWidget::ImportExportSave(bool export_save)
Core::RunOnCPUThread(
Core::System::GetInstance(),
[export_save, core = m_core, save_path = save_path.toStdString()]() {
[export_save, core = m_core, save_path = save_path.toStdString()] {
if (auto core_ptr = core.lock())
{
if (export_save)

View File

@ -580,7 +580,7 @@ void GameList::OpenProperties()
connect(properties, &PropertiesDialog::OpenGraphicsSettings, this,
&GameList::OpenGraphicsSettings);
connect(properties, &PropertiesDialog::finished, this,
[properties]() { properties->deleteLater(); });
[properties] { properties->deleteLater(); });
#ifdef USE_RETRO_ACHIEVEMENTS
connect(properties, &PropertiesDialog::OpenAchievementSettings, this,

View File

@ -345,7 +345,7 @@ void HotkeyScheduler::Run()
else if (IsHotkey(HK_NEXT_GAME_WIIMOTE_PROFILE_4))
m_profile_cycler.NextWiimoteProfileForGame(3);
auto ShowVolume = []() {
auto ShowVolume = [] {
OSD::AddMessage(std::string("Volume: ") +
(Config::Get(Config::MAIN_AUDIO_MUTED) ?
"Muted" :
@ -450,7 +450,7 @@ void HotkeyScheduler::Run()
OSD::AddMessage(fmt::format("Copy EFB: {}", new_value ? "to Texture" : "to RAM"));
}
auto ShowXFBCopies = []() {
auto ShowXFBCopies = [] {
OSD::AddMessage(fmt::format(
"Copy XFB: {}{}", Config::Get(Config::GFX_HACK_IMMEDIATE_XFB) ? " (Immediate)" : "",
Config::Get(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM) ? "to Texture" : "to RAM"));
@ -504,7 +504,7 @@ void HotkeyScheduler::Run()
AudioCommon::UpdateSoundStream(system);
}
auto ShowEmulationSpeed = []() {
auto ShowEmulationSpeed = [] {
const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
if (!AchievementManager::GetInstance().IsHardcoreModeActive() ||
Config::Get(Config::MAIN_EMULATION_SPEED) >= 1.0f ||

View File

@ -266,7 +266,7 @@ CreateFigureDialog::CreateFigureDialog(QWidget* parent, FigureUIPosition slot) :
}
});
connect(buttons, &QDialogButtonBox::accepted, this, [=, this]() {
connect(buttons, &QDialogButtonBox::accepted, this, [=, this] {
bool ok_char = false;
const u32 char_number = edit_num->text().toULong(&ok_char);
if (!ok_char)

View File

@ -277,7 +277,7 @@ MainWindow::MainWindow(Core::System& system, std::unique_ptr<BootParameters> boo
Settings::Instance().SetDebugModeEnabled(false);
// This needs to trigger on both RA_HARDCORE_ENABLED and RA_ENABLED
m_config_changed_callback_id = Config::AddConfigChangedCallback(
[this]() { QueueOnObject(this, [this] { this->OnHardcoreChanged(); }); });
[this] { QueueOnObject(this, [this] { this->OnHardcoreChanged(); }); });
// If hardcore is enabled when the emulator starts, make sure it turns off what it needs to
if (Config::Get(Config::RA_HARDCORE_ENABLED))
OnHardcoreChanged();
@ -540,7 +540,7 @@ void MainWindow::ConnectMenuBar()
// Emulation
connect(m_menu_bar, &MenuBar::Pause, this, &MainWindow::Pause);
connect(m_menu_bar, &MenuBar::Play, this, [this]() { Play(); });
connect(m_menu_bar, &MenuBar::Play, this, [this] { Play(); });
connect(m_menu_bar, &MenuBar::Stop, this, &MainWindow::RequestStop);
connect(m_menu_bar, &MenuBar::Reset, this, &MainWindow::Reset);
connect(m_menu_bar, &MenuBar::Fullscreen, this, &MainWindow::FullScreen);
@ -697,7 +697,7 @@ void MainWindow::ConnectToolBar()
connect(m_tool_bar, &ToolBar::OpenPressed, this, &MainWindow::Open);
connect(m_tool_bar, &ToolBar::RefreshPressed, this, &MainWindow::RefreshGameList);
connect(m_tool_bar, &ToolBar::PlayPressed, this, [this]() { Play(); });
connect(m_tool_bar, &ToolBar::PlayPressed, this, [this] { Play(); });
connect(m_tool_bar, &ToolBar::PausePressed, this, &MainWindow::Pause);
connect(m_tool_bar, &ToolBar::StopPressed, this, &MainWindow::RequestStop);
connect(m_tool_bar, &ToolBar::FullScreenPressed, this, &MainWindow::FullScreen);
@ -716,7 +716,7 @@ void MainWindow::ConnectToolBar()
void MainWindow::ConnectGameList()
{
connect(m_game_list, &GameList::GameSelected, this, [this]() { Play(); });
connect(m_game_list, &GameList::GameSelected, this, [this] { Play(); });
connect(m_game_list, &GameList::NetPlayHost, this, &MainWindow::NetPlayHost);
connect(m_game_list, &GameList::OnStartWithRiivolution, this,
&MainWindow::ShowRiivolutionBootWidget);

View File

@ -296,7 +296,7 @@ void MenuBar::AddToolsMenu()
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
m_achievements_dev_menu = tools_menu->addMenu(tr("RetroAchievements Development"));
AchievementManager::GetInstance().SetDevMenuUpdateCallback(
[this]() { QueueOnObject(this, [this] { this->UpdateAchievementDevelopmentMenu(); }); });
[this] { QueueOnObject(this, [this] { this->UpdateAchievementDevelopmentMenu(); }); });
m_achievements_dev_menu->menuAction()->setVisible(false);
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
tools_menu->addSeparator();
@ -406,7 +406,7 @@ void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
{
QAction* action = m_state_load_slots_menu->addAction(QString{});
connect(action, &QAction::triggered, this, [=, this]() { emit StateLoadSlotAt(i); });
connect(action, &QAction::triggered, this, [=, this] { emit StateLoadSlotAt(i); });
}
}
@ -423,7 +423,7 @@ void MenuBar::AddStateSaveMenu(QMenu* emu_menu)
{
QAction* action = m_state_save_slots_menu->addAction(QString{});
connect(action, &QAction::triggered, this, [=, this]() { emit StateSaveSlotAt(i); });
connect(action, &QAction::triggered, this, [=, this] { emit StateSaveSlotAt(i); });
}
}
@ -440,7 +440,7 @@ void MenuBar::AddStateSlotMenu(QMenu* emu_menu)
if (Settings::Instance().GetStateSlot() == i)
action->setChecked(true);
connect(action, &QAction::triggered, this, [=, this]() { emit SetStateSlot(i); });
connect(action, &QAction::triggered, this, [=, this] { emit SetStateSlot(i); });
connect(this, &MenuBar::SetStateSlot, [action, i](const int slot) {
if (slot == i)
action->setChecked(true);
@ -629,7 +629,7 @@ void MenuBar::AddOptionsMenu()
m_reset_ignore_panic_handler = options_menu->addAction(tr("Reset Ignore Panic Handler"));
connect(m_reset_ignore_panic_handler, &QAction::triggered, this, []() {
connect(m_reset_ignore_panic_handler, &QAction::triggered, this, [] {
Config::DeleteKey(Config::LayerType::CurrentRun, Config::MAIN_USE_PANIC_HANDLERS);
});
@ -652,17 +652,17 @@ void MenuBar::AddHelpMenu()
QAction* website = help_menu->addAction(tr("&Website"));
connect(website, &QAction::triggered, this,
[]() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); });
[] { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); });
QAction* documentation = help_menu->addAction(tr("Online &Documentation"));
connect(documentation, &QAction::triggered, this, []() {
connect(documentation, &QAction::triggered, this, [] {
QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides")));
});
QAction* github = help_menu->addAction(tr("&GitHub Repository"));
connect(github, &QAction::triggered, this, []() {
connect(github, &QAction::triggered, this, [] {
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin")));
});
QAction* bugtracker = help_menu->addAction(tr("&Bug Tracker"));
connect(bugtracker, &QAction::triggered, this, []() {
connect(bugtracker, &QAction::triggered, this, [] {
QDesktopServices::openUrl(
QUrl(QStringLiteral("https://bugs.dolphin-emu.org/projects/emulator")));
});
@ -1163,7 +1163,7 @@ void MenuBar::UpdateAchievementDevelopmentMenu()
}
auto* ra_dev_menu_item = m_achievements_dev_menu->addAction(
QString::fromStdString(menu_item.label), this,
[menu_item]() { AchievementManager::GetInstance().ActivateDevMenuItem(menu_item.id); });
[menu_item] { AchievementManager::GetInstance().ActivateDevMenuItem(menu_item.id); });
ra_dev_menu_item->setEnabled(menu_item.enabled);
// Recommended hardcode by RAIntegration.dll developer Jamiras
ra_dev_menu_item->setCheckable(i < 2);

View File

@ -570,7 +570,7 @@ void NetPlayDialog::UpdateDiscordPresence()
if (m_player_count == 0 || m_current_game_name.empty())
return;
const auto use_default = [this]() {
const auto use_default = [this] {
Discord::UpdateDiscordPresence(m_player_count, Discord::SecretType::Empty, "",
m_current_game_name);
};

View File

@ -186,7 +186,7 @@ void RiivolutionBootWidget::MakeGUIForParsedFile(std::string path, std::string r
xml_root_layout->addWidget(xml_root_line_edit, 0);
xml_root_layout->addWidget(xml_root_open, 0);
disc_layout->addLayout(xml_root_layout);
connect(xml_root_open, &QPushButton::clicked, this, [this, xml_root_line_edit, disc_index]() {
connect(xml_root_open, &QPushButton::clicked, this, [this, xml_root_line_edit, disc_index] {
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
this, tr("Select the Virtual SD Card Root"), xml_root_line_edit->text()));
if (!dir.isEmpty())

View File

@ -114,7 +114,7 @@ void GeneralPane::ConnectLayout()
}
// Advanced
connect(m_combobox_speedlimit, &QComboBox::currentIndexChanged, [this]() {
connect(m_combobox_speedlimit, &QComboBox::currentIndexChanged, [this] {
Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED,
m_combobox_speedlimit->currentIndex() * 0.1f);
Config::Save();

View File

@ -279,7 +279,7 @@ void WiiPane::CreateSDCard()
progress_dialog.GetRaw()->setWindowTitle(tr("Progress"));
auto success = std::async(std::launch::async, [&] {
const bool good = Common::SyncSDFolderToSDImage(
[&progress_dialog]() { return progress_dialog.WasCanceled(); }, false);
[&progress_dialog] { return progress_dialog.WasCanceled(); }, false);
progress_dialog.Reset();
return good;
});
@ -303,7 +303,7 @@ void WiiPane::CreateSDCard()
progress_dialog.GetRaw()->setWindowTitle(tr("Progress"));
auto success = std::async(std::launch::async, [&] {
const bool good = Common::SyncSDImageToSDFolder(
[&progress_dialog]() { return progress_dialog.WasCanceled(); });
[&progress_dialog] { return progress_dialog.WasCanceled(); });
progress_dialog.Reset();
return good;
});

View File

@ -210,7 +210,7 @@ void SkylanderModifyDialog::PopulateSkylanderOptions(QVBoxLayout* layout)
layout->addLayout(hbox_last_reset);
layout->addLayout(hbox_last_placed);
connect(m_buttons, &QDialogButtonBox::accepted, this, [=, this]() {
connect(m_buttons, &QDialogButtonBox::accepted, this, [=, this] {
if (!edit_money->hasAcceptableInput())
{
QMessageBox::warning(this, tr("Incorrect money value!"),
@ -323,7 +323,7 @@ bool SkylanderModifyDialog::PopulateTrophyOptions(QVBoxLayout* layout)
layout->addLayout(hbox);
}
connect(m_buttons, &QDialogButtonBox::accepted, this, [=, this]() {
connect(m_buttons, &QDialogButtonBox::accepted, this, [=, this] {
m_figure_data.trophy_data.unlocked_villains = 0x0;
for (size_t i = 0; i < MAX_VILLAINS; ++i)
m_figure_data.trophy_data.unlocked_villains |=

View File

@ -115,7 +115,7 @@ void SkylanderPortalWindow::CreateMainWindow()
auto* modify_btn = new QPushButton(tr("Modify Slot"));
connect(create_btn, &QAbstractButton::clicked, this,
&SkylanderPortalWindow::CreateSkylanderAdvanced);
connect(clear_btn, &QAbstractButton::clicked, this, [this]() { ClearSlot(GetCurrentSlot()); });
connect(clear_btn, &QAbstractButton::clicked, this, [this] { ClearSlot(GetCurrentSlot()); });
connect(load_btn, &QAbstractButton::clicked, this, &SkylanderPortalWindow::LoadSelected);
connect(load_file_btn, &QAbstractButton::clicked, this, &SkylanderPortalWindow::LoadFromFile);
connect(modify_btn, &QAbstractButton::clicked, this, &SkylanderPortalWindow::ModifySkylander);
@ -591,7 +591,7 @@ void SkylanderPortalWindow::CreateSkylanderAdvanced()
create_window->setLayout(layout);
connect(buttons, &QDialogButtonBox::accepted, this, [=, this]() {
connect(buttons, &QDialogButtonBox::accepted, this, [=, this] {
bool ok_id = false, ok_var = false;
m_sky_id = edit_id->text().toUShort(&ok_id);
if (!ok_id)

View File

@ -360,7 +360,7 @@ HotkeySuppressions::MakeSuppressor(const Modifiers* modifiers,
}
}
return Suppressor(std::make_unique<std::function<void()>>([this, modifiers, final_input]() {
return Suppressor(std::make_unique<std::function<void()>>([this, modifiers, final_input] {
for (auto& modifier : *modifiers)
RemoveSuppression(modifier->GetInput(), (*final_input)->GetInput());
}).release(),

View File

@ -80,7 +80,7 @@ std::string BuildExpression(const Core::InputDetector::Results& detections,
new_alternation = true;
};
const auto handle_release = [&]() {
const auto handle_release = [&] {
if (!new_alternation)
return;

View File

@ -131,7 +131,7 @@ void Init()
Core::RestoreWiiSettings(Core::RestoreReason::CrashRecovery);
Config::Init();
const auto config_changed_callback = []() {
const auto config_changed_callback = [] {
InitCustomPaths();
RefreshConfig();
};

View File

@ -504,36 +504,35 @@ void CommandBufferManager::DeferBufferViewDestruction(VkBufferView object)
{
CmdBufferResources& cmd_buffer_resources = GetCurrentCmdBufferResources();
cmd_buffer_resources.cleanup_resources.push_back(
[object]() { vkDestroyBufferView(g_vulkan_context->GetDevice(), object, nullptr); });
[object] { vkDestroyBufferView(g_vulkan_context->GetDevice(), object, nullptr); });
}
void CommandBufferManager::DeferBufferDestruction(VkBuffer buffer, VmaAllocation alloc)
{
CmdBufferResources& cmd_buffer_resources = GetCurrentCmdBufferResources();
cmd_buffer_resources.cleanup_resources.push_back([buffer, alloc]() {
vmaDestroyBuffer(g_vulkan_context->GetMemoryAllocator(), buffer, alloc);
});
cmd_buffer_resources.cleanup_resources.push_back(
[buffer, alloc] { vmaDestroyBuffer(g_vulkan_context->GetMemoryAllocator(), buffer, alloc); });
}
void CommandBufferManager::DeferFramebufferDestruction(VkFramebuffer object)
{
CmdBufferResources& cmd_buffer_resources = GetCurrentCmdBufferResources();
cmd_buffer_resources.cleanup_resources.push_back(
[object]() { vkDestroyFramebuffer(g_vulkan_context->GetDevice(), object, nullptr); });
[object] { vkDestroyFramebuffer(g_vulkan_context->GetDevice(), object, nullptr); });
}
void CommandBufferManager::DeferImageDestruction(VkImage image, VmaAllocation alloc)
{
CmdBufferResources& cmd_buffer_resources = GetCurrentCmdBufferResources();
cmd_buffer_resources.cleanup_resources.push_back(
[image, alloc]() { vmaDestroyImage(g_vulkan_context->GetMemoryAllocator(), image, alloc); });
[image, alloc] { vmaDestroyImage(g_vulkan_context->GetMemoryAllocator(), image, alloc); });
}
void CommandBufferManager::DeferImageViewDestruction(VkImageView object)
{
CmdBufferResources& cmd_buffer_resources = GetCurrentCmdBufferResources();
cmd_buffer_resources.cleanup_resources.push_back(
[object]() { vkDestroyImageView(g_vulkan_context->GetDevice(), object, nullptr); });
[object] { vkDestroyImageView(g_vulkan_context->GetDevice(), object, nullptr); });
}
std::unique_ptr<CommandBufferManager> g_command_buffer_mgr;

View File

@ -53,7 +53,7 @@ std::vector<std::string> GlobalConflicts(std::string_view source)
continue;
}
const auto parse_identifier = [&]() {
const auto parse_identifier = [&] {
const u32 start = i;
for (; i < source.size(); i++)
{
@ -76,7 +76,7 @@ std::vector<std::string> GlobalConflicts(std::string_view source)
}
else if (source[i] == '#')
{
const auto parse_until_end_of_preprocessor = [&]() {
const auto parse_until_end_of_preprocessor = [&] {
bool continue_until_next_newline = false;
for (; i < source.size(); i++)
{

View File

@ -141,7 +141,7 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
float window_y = window_padding;
float window_x = display_size.x - window_padding;
const auto clamp_window_position = [&]() {
const auto clamp_window_position = [&] {
const ImVec2 position = ImGui::GetWindowPos();
const ImVec2 size = ImGui::GetWindowSize();
const float window_min_x = window_padding;

View File

@ -31,7 +31,7 @@ bool InitializeGlslang()
return false;
}
std::atexit([]() { glslang::FinalizeProcess(); });
std::atexit([] { glslang::FinalizeProcess(); });
glslang_initialized = true;
return true;

View File

@ -323,7 +323,7 @@ void Statistics::DisplayScissor()
}
};
constexpr auto NUM_SCISSOR_COLUMNS = 8;
const auto draw_scissor_table_header = [&]() {
const auto draw_scissor_table_header = [&] {
ImGui::TableSetupColumn("#");
ImGui::TableSetupColumn("x0");
ImGui::TableSetupColumn("y0");
@ -413,7 +413,7 @@ void Statistics::DisplayScissor()
}
};
constexpr auto NUM_VIEWPORT_COLUMNS = 5;
const auto draw_viewport_table_header = [&]() {
const auto draw_viewport_table_header = [&] {
ImGui::TableSetupColumn("#");
ImGui::TableSetupColumn("vx0");
ImGui::TableSetupColumn("vy0");

View File

@ -125,7 +125,7 @@ void VertexLoaderX64::ReadVertex(OpArg data, VertexComponentFormat attribute,
X64Reg coords = XMM0;
const auto write_zfreeze = [&]() { // zfreeze
const auto write_zfreeze = [&] { // zfreeze
if (native_format == &m_native_vtx_decl.position)
{
CMP(32, R(remaining_reg), Imm8(3));

View File

@ -59,7 +59,7 @@ void VideoConfig::Refresh()
// invalid values. Instead, pause the video thread first, update the config and correct
// it, then resume emulation, after which the video thread will detect the config has
// changed and act accordingly.
const auto config_changed_callback = []() {
const auto config_changed_callback = [] {
auto& system = Core::System::GetInstance();
const bool lock_gpu_thread = Core::IsRunning(system);

View File

@ -24,8 +24,8 @@ TEST(BlockingLoop, MultiThreaded)
// Must not block as the loop is stopped.
loop.Wait();
std::thread loop_thread([&]() {
loop.Run([&]() {
std::thread loop_thread([&] {
loop.Run([&] {
received_a.store(signaled_a.load());
received_b.store(signaled_b.load());
});
@ -39,7 +39,7 @@ TEST(BlockingLoop, MultiThreaded)
EXPECT_EQ(signaled_a.load(), received_a.load());
EXPECT_EQ(signaled_b.load(), received_b.load());
std::thread run_a_thread([&]() {
std::thread run_a_thread([&] {
for (int j = 0; j < 100; j++)
{
for (int k = 0; k < 100; k++)
@ -52,7 +52,7 @@ TEST(BlockingLoop, MultiThreaded)
EXPECT_EQ(signaled_a.load(), received_a.load());
}
});
std::thread run_b_thread([&]() {
std::thread run_b_thread([&] {
for (int j = 0; j < 100; j++)
{
for (int k = 0; k < 100; k++)

View File

@ -16,7 +16,7 @@ TEST(BusyLoopTest, MultiThreaded)
for (int i = 0; i < 10; i++)
{
loop.Prepare();
std::thread loop_thread([&]() { loop.Run([&]() { e.Set(); }); });
std::thread loop_thread([&] { loop.Run([&] { e.Set(); }); });
// Ping - Pong
for (int j = 0; j < 10; j++)

View File

@ -14,7 +14,7 @@ TEST(Event, MultiThreaded)
int shared_obj;
constexpr int ITERATIONS_COUNT = 100000;
auto sender = [&]() {
auto sender = [&] {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
can_send.Wait();
@ -23,7 +23,7 @@ TEST(Event, MultiThreaded)
}
};
auto receiver = [&]() {
auto receiver = [&] {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
has_sent.Wait();

View File

@ -36,7 +36,7 @@ TEST(Flag, MultiThreaded)
int count = 0;
constexpr int ITERATIONS_COUNT = 100000;
auto setter = [&]() {
auto setter = [&] {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
while (f.IsSet())
@ -45,7 +45,7 @@ TEST(Flag, MultiThreaded)
}
};
auto clearer = [&]() {
auto clearer = [&] {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
while (!f.IsSet())
@ -72,7 +72,7 @@ TEST(Flag, SpinLock)
constexpr int ITERATIONS_COUNT = 5000;
constexpr int THREADS_COUNT = 50;
auto adder_func = [&]() {
auto adder_func = [&] {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
// Acquire the spinlock.

View File

@ -61,7 +61,7 @@ TEST(SPSCQueue, MultiThreaded)
constexpr u32 reps = 100000;
auto inserter = [&]() {
auto inserter = [&] {
for (u32 i = 0; i != reps; ++i)
q.Push({sptr, i});
@ -71,7 +71,7 @@ TEST(SPSCQueue, MultiThreaded)
EXPECT_EQ(sptr.use_count(), 2);
};
auto popper = [&]() {
auto popper = [&] {
for (u32 i = 0; i != reps; ++i)
{
q.WaitForData();